You are viewing a plain text version of this content. The canonical link for it is here.
Posted to stonehenge-commits@incubator.apache.org by sh...@apache.org on 2009/04/21 05:31:18 UTC

svn commit: r766980 [1/2] - in /incubator/stonehenge/trunk/stocktrader/wsas: ./ business_service/ business_service/resources/META-INF/ business_service/src/org/apache/ business_service/src/org/apache/stocktrader/ business_service/src/org/apache/stocktr...

Author: shankar
Date: Tue Apr 21 05:31:16 2009
New Revision: 766980

URL: http://svn.apache.org/viewvc?rev=766980&view=rev
Log:
Changing package names from wso2 to apache

Added:
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeConfigServiceClient.java
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderConfig.java
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClient.java
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClientPasswordCB.java
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeServiceImpl.java
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TraderServiceManager.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountBean.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountProfileBean.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomHoldingBean.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomMarketSummaryBean.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomOrderBean.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomQuoteBean.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/HoldingBean.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/QuoteBean.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/CustomerDAO.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOException.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOFactory.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/MarketSummaryDAO.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/OrderDAO.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/AbstractMSSQLDAO.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/MSSQLCustomerDAO.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/MSSQLDAOFactory.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/MSSQLMarketSummaryDAO.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/MSSQLOrderDAO.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/util/
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/util/OrderProcessorUtility.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/util/StockTraderSQLUtil.java
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/util/StockTraderUtility.java
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/stocktrader/
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/stocktrader/service/
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/stocktrader/service/OrderProcessManager.java
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/stocktrader/service/OrderProcessorImpl.java
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/stocktrader/service/OrderProcessorServicePasswordCB.java
Removed:
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/wso2/stocktrader/
    incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/wso2/
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/wso2/
Modified:
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml
    incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META-INF/services.xml
    incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/pom.xml
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/resources/msec/META-INF/services.xml
    incubator/stonehenge/trunk/stocktrader/wsas/order_processor/resources/nosec/META-INF/services.xml
    incubator/stonehenge/trunk/stocktrader/wsas/pom.xml
    incubator/stonehenge/trunk/stocktrader/wsas/resources/conf/config-svc.properties
    incubator/stonehenge/trunk/stocktrader/wsas/resources/conf/mssql-db.properties
    incubator/stonehenge/trunk/stocktrader/wsas/resources/conf/security-policy.xml

Modified: incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml?rev=766980&r1=766979&r2=766980&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml (original)
+++ incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml Tue Apr 21 05:31:16 2009
@@ -24,7 +24,7 @@
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<artifactId>TradeService</artifactId>
-	<groupId>org.wso2.stocktrader.trade-service</groupId>
+	<groupId>org.apache.stocktrader.trade-service</groupId>
 	<name>WSAS Stock Trader Business Service</name>
 	<version>SNAPSHOT</version>
 	<properties>
@@ -365,7 +365,7 @@
             <version>${version}</version>
         </dependency>
 		<dependency>
-			<groupId>org.wso2.stocktrader.common</groupId>
+			<groupId>org.apache.stocktrader.common</groupId>
 			<artifactId>stocktrader-wsas</artifactId>
             <version>${version}</version>
         </dependency>

Modified: incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META-INF/services.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META-INF/services.xml?rev=766980&r1=766979&r2=766980&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META-INF/services.xml (original)
+++ incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META-INF/services.xml Tue Apr 21 05:31:16 2009
@@ -25,7 +25,7 @@
             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only" class="org.tempuri.TradeServiceWcfMessageReceiverInOnly"/>
             <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.tempuri.TradeServiceWcfMessageReceiverInOut"/>
         </messageReceivers>
-        <parameter name="ServiceClass">org.wso2.stocktrader.services.TradeServiceImpl</parameter>
+        <parameter name="ServiceClass">org.apache.stocktrader.services.TradeServiceImpl</parameter>
         <parameter name="useOriginalwsdl">true</parameter>
         <parameter name="modifyUserWSDLPortAddress">true</parameter>
         <operation name="getHolding" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://trade.samples.websphere.ibm.com">

Added: incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeConfigServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeConfigServiceClient.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeConfigServiceClient.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeConfigServiceClient.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,70 @@
+/*
+ * 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.apache.stocktrader.services;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.rmi.RemoteException;
+import java.util.Properties;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.stocktrader.util.StockTraderUtility;
+import org.wso2.interop.stocktrader.Config_svcStub;
+import org.wso2.interop.stocktrader.xsd.BSConfigRequest;
+import org.wso2.interop.stocktrader.xsd.BSConfigRequestE;
+import org.wso2.interop.stocktrader.xsd.BSConfigResponse;
+import org.wso2.interop.stocktrader.xsd.BSConfigResponseE;
+
+public class TradeConfigServiceClient {
+	private static final String SERVICE_URL = "org.apache.stocktrader.TradeConfigServiceClient.url";
+	private static TradeConfigServiceClient self = null;
+
+	private Properties prop = new Properties();
+
+	public static TradeConfigServiceClient getInstance() throws IOException {
+		if (self == null) {
+			self = new TradeConfigServiceClient();
+		}
+		return self;
+	}
+
+	private TradeConfigServiceClient() throws IOException {
+		super();
+		// CHECKME .. there might be a better of doing this
+		ClassLoader cl = MessageContext.getCurrentMessageContext()
+				.getAxisService().getClassLoader();
+		InputStream is = cl
+				.getResourceAsStream(StockTraderUtility.TRADE_ORDER_SERVICE_PROPERTY_FILE);
+		prop.load(is);
+	}
+
+	public TradeOrderConfig getTradeOrderConfig() throws RemoteException {
+		Config_svcStub stub = new Config_svcStub(prop.getProperty(SERVICE_URL));
+		BSConfigRequestE configRequestE = new BSConfigRequestE();
+		BSConfigRequest param = new BSConfigRequest();
+		param.setBS("JAVA_BS");
+		configRequestE.setBSConfigRequest(param);
+		BSConfigResponseE configResponseE = stub.bSConfigRequest(configRequestE);
+		BSConfigResponse configResponse = configResponseE.getBSConfigResponse();
+		TradeOrderConfig config = new TradeOrderConfig();
+		config.setEndpointURL(configResponse.getOPS().toString());
+		config.setSecure(configResponse.getSec());
+		return config;
+	}
+
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderConfig.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderConfig.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderConfig.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderConfig.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.apache.stocktrader.services;
+
+public class TradeOrderConfig {
+	private String endpointURL;
+	private boolean secure;
+	
+	public String getEndpointURL() {
+		return endpointURL;
+	}
+	public void setEndpointURL(String endpointURL) {
+		this.endpointURL = endpointURL;
+	}
+	public boolean isSecure() {
+		return secure;
+	}
+	public void setSecure(boolean secure) {
+		this.secure = secure;
+	}
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClient.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClient.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClient.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,88 @@
+/*
+ * 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.apache.stocktrader.services;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyEngine;
+import org.apache.stocktrader.CustomOrderBean;
+import org.apache.stocktrader.util.StockTraderUtility;
+
+import traderorderhost.trade.OrderProcessorStub;
+import traderorderhost.trade.SubmitOrder;
+import traderorderhost.trade.SubmitOrderTransactedQueue;
+
+public class TradeOrderServiceClient extends ServiceClient {
+
+	private static TradeOrderServiceClient self = null;
+	private Policy securityPolicy = null;
+
+	private TradeOrderServiceClient() throws IOException {
+		super();
+		// CHECKME .. there might be a better of doing this
+		ClassLoader cl = MessageContext.getCurrentMessageContext()
+				.getAxisService().getClassLoader();
+		InputStream is = cl
+				.getResourceAsStream(StockTraderUtility.TRADE_ORDER_SERVICE_SECURITY_FILE);
+		securityPolicy = PolicyEngine.getPolicy(is);
+	}
+
+	public static final TradeOrderServiceClient getInstance()
+			throws IOException {
+		if (self == null) {
+			self = new TradeOrderServiceClient();
+		}
+		return self;
+	}
+
+	public void SubmitOrderTrasactedQueue(CustomOrderBean order)
+			throws IOException {
+		TradeOrderConfig config = geTradeOrderConfig();
+		OrderProcessorStub stub = new OrderProcessorStub(config
+				.getEndpointURL());
+		if (config.isSecure()) {
+			enableSecurity(stub);
+		}
+		ServiceClient serviceClient = stub._getServiceClient();
+		serviceClient.getOptions().setProperty(HTTPConstants.CHUNKED,  Boolean.FALSE);
+		SubmitOrder param = new SubmitOrder();
+		param.setOrder(order);
+		stub.submitOrder(param);
+	}
+
+	private TradeOrderConfig geTradeOrderConfig() throws IOException {
+		TradeConfigServiceClient client = TradeConfigServiceClient
+				.getInstance();
+		return client.getTradeOrderConfig();
+	}
+
+	private void enableSecurity(OrderProcessorStub stub) throws AxisFault {
+		ServiceClient serviceClient = stub._getServiceClient();
+		AxisService axisService = serviceClient.getAxisService();
+		axisService.getPolicySubject().attachPolicy(securityPolicy);
+		serviceClient.engageModule("rampart");
+	}
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClientPasswordCB.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClientPasswordCB.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClientPasswordCB.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeOrderServiceClientPasswordCB.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.stocktrader.services;
+
+import java.io.IOException;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.ws.security.WSPasswordCallback;
+
+public class TradeOrderServiceClientPasswordCB implements CallbackHandler {
+	public void handle(Callback[] callbacks) throws IOException,
+			UnsupportedCallbackException {
+		for (int i = 0; i < callbacks.length; i++) {
+			WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[i];
+			String id = pwcb.getIdentifer();
+			if ("bob".equals(id))
+				pwcb.setPassword("password");
+			else if ("bob.cer".equals(id)) 
+				pwcb.setPassword("password");
+		}
+	}
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeServiceImpl.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeServiceImpl.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TradeServiceImpl.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,321 @@
+/*
+ * 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.apache.stocktrader.services;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stocktrader.CustomAccountBean;
+import org.apache.stocktrader.CustomAccountProfileBean;
+import org.apache.stocktrader.CustomHoldingBean;
+import org.apache.stocktrader.CustomMarketSummaryBean;
+import org.apache.stocktrader.CustomOrderBean;
+import org.apache.stocktrader.CustomQuoteBean;
+import org.apache.stocktrader.dal.DAOException;
+import org.tempuri.TradeServiceWcfSkeleton;
+
+import com.ibm.websphere.samples.trade.ArrayOfHoldingDataBean;
+import com.ibm.websphere.samples.trade.ArrayOfOrderDataBean;
+import com.ibm.websphere.samples.trade.Buy;
+import com.ibm.websphere.samples.trade.BuyResponse;
+import com.ibm.websphere.samples.trade.GetAccountData;
+import com.ibm.websphere.samples.trade.GetAccountDataResponse;
+import com.ibm.websphere.samples.trade.GetAccountProfileData;
+import com.ibm.websphere.samples.trade.GetAccountProfileDataResponse;
+import com.ibm.websphere.samples.trade.GetClosedOrders;
+import com.ibm.websphere.samples.trade.GetClosedOrdersResponse;
+import com.ibm.websphere.samples.trade.GetHolding;
+import com.ibm.websphere.samples.trade.GetHoldingResponse;
+import com.ibm.websphere.samples.trade.GetHoldings;
+import com.ibm.websphere.samples.trade.GetHoldingsResponse;
+import com.ibm.websphere.samples.trade.GetMarketSummary;
+import com.ibm.websphere.samples.trade.GetMarketSummaryResponse;
+import com.ibm.websphere.samples.trade.GetOrders;
+import com.ibm.websphere.samples.trade.GetOrdersResponse;
+import com.ibm.websphere.samples.trade.GetQuote;
+import com.ibm.websphere.samples.trade.GetQuoteResponse;
+import com.ibm.websphere.samples.trade.GetTopOrders;
+import com.ibm.websphere.samples.trade.GetTopOrdersResponse;
+import com.ibm.websphere.samples.trade.HoldingDataBean;
+import com.ibm.websphere.samples.trade.IsOnline;
+import com.ibm.websphere.samples.trade.Login;
+import com.ibm.websphere.samples.trade.LoginResponse;
+import com.ibm.websphere.samples.trade.Logout;
+import com.ibm.websphere.samples.trade.LogoutResponse;
+import com.ibm.websphere.samples.trade.OrderDataBean;
+import com.ibm.websphere.samples.trade.Register;
+import com.ibm.websphere.samples.trade.RegisterResponse;
+import com.ibm.websphere.samples.trade.Sell;
+import com.ibm.websphere.samples.trade.SellEnhanced;
+import com.ibm.websphere.samples.trade.SellEnhancedResponse;
+import com.ibm.websphere.samples.trade.SellResponse;
+import com.ibm.websphere.samples.trade.UpdateAccountProfile;
+import com.ibm.websphere.samples.trade.UpdateAccountProfileResponse;
+
+public class TradeServiceImpl extends TradeServiceWcfSkeleton {
+	private static final Log logger = LogFactory.getLog(TradeServiceImpl.class);
+
+	private final TraderServiceManager mgr = new TraderServiceManager();
+
+	public BuyResponse buy(Buy buy) {
+		CustomOrderBean order;
+		try {
+			order = mgr
+					.buy(buy.getUserID(), buy.getSymbol(), buy.getQuantity());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		BuyResponse buyResponse = new BuyResponse();
+		buyResponse.setBuyReturn(order);
+		return buyResponse;
+	}
+
+	public GetAccountDataResponse getAccountData(GetAccountData getAccountData) {
+		CustomAccountBean accountData;
+		try {
+			accountData = mgr.getAccountData(getAccountData.getUserID());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetAccountDataResponse getAccountDataResponse = new GetAccountDataResponse();
+		getAccountDataResponse.setGetAccountDataReturn(accountData);
+		return getAccountDataResponse;
+	}
+
+	public GetAccountProfileDataResponse getAccountProfileData(
+			GetAccountProfileData getAccountProfileData) {
+		CustomAccountProfileBean accountProfileData;
+		try {
+			accountProfileData = mgr
+					.getAccountProfileData(getAccountProfileData.getUserID());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetAccountProfileDataResponse response = new GetAccountProfileDataResponse();
+		response.setGetAccountProfileDataReturn(accountProfileData);
+		return response;
+	}
+
+	public GetClosedOrdersResponse getClosedOrders(
+			GetClosedOrders getClosedOrders) {
+		List<CustomOrderBean> closedOrders;
+		try {
+			closedOrders = mgr.getClosedOrders(getClosedOrders.getUserID());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetClosedOrdersResponse response = new GetClosedOrdersResponse();
+		ArrayOfOrderDataBean arrayOfOrderBean = new ArrayOfOrderDataBean();
+		arrayOfOrderBean.setOrderDataBean(toArray(closedOrders));
+		response.setGetClosedOrdersReturn(arrayOfOrderBean);
+		return response;
+	}
+
+	public GetHoldingResponse getHolding(GetHolding getHolding) {
+		CustomHoldingBean holding;
+		try {
+			holding = mgr.getHolding(getHolding.getUserID(), getHolding
+					.getHoldingID());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetHoldingResponse response = new GetHoldingResponse();
+		response.setGetHoldingReturn(holding);
+		return response;
+	}
+
+	public GetHoldingsResponse getHoldings(GetHoldings getHoldings) {
+		List<CustomHoldingBean> holdingBeans;
+		try {
+			holdingBeans = mgr.getHoldings(getHoldings.getUserID());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetHoldingsResponse response = new GetHoldingsResponse();
+		ArrayOfHoldingDataBean param = new ArrayOfHoldingDataBean();
+		param.setHoldingDataBean(toArray(holdingBeans));
+		response.setGetHoldingsReturn(param);
+		return response;
+	}
+
+	public GetMarketSummaryResponse getMarketSummary(
+			GetMarketSummary getMarketSummary) {
+		CustomMarketSummaryBean param;
+		try {
+			param = mgr.getMarketSummary();
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetMarketSummaryResponse response = new GetMarketSummaryResponse();
+		response.setGetMarketSummaryReturn(param);
+		return response;
+	}
+
+	public GetOrdersResponse getOrders(GetOrders getOrders) {
+		List<CustomOrderBean> orders;
+		try {
+			orders = mgr.getOrders(getOrders.getUserID());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetOrdersResponse response = new GetOrdersResponse();
+		ArrayOfOrderDataBean param = new ArrayOfOrderDataBean();
+		param.setOrderDataBean(toArray(orders));
+		response.setGetOrdersReturn(param);
+		return response;
+	}
+
+	public GetQuoteResponse getQuote(GetQuote getQuote) {
+		CustomQuoteBean param;
+		try {
+			param = mgr.getQuote(getQuote.getSymbol());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetQuoteResponse response = new GetQuoteResponse();
+		response.setGetQuoteReturn(param);
+		return response;
+	}
+
+	public GetTopOrdersResponse getTopOrders(GetTopOrders getTopOrders) {
+		List<CustomOrderBean> topOrders;
+		try {
+			topOrders = mgr.getTopOrders(getTopOrders.getUserID());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		GetTopOrdersResponse response = new GetTopOrdersResponse();
+		ArrayOfOrderDataBean param = new ArrayOfOrderDataBean();
+		param.setOrderDataBean(toArray(topOrders));
+		response.setGetTopOrdersReturn(param);
+		return response;
+	}
+
+	public void isOnline(IsOnline isOnline) {
+		if (logger.isDebugEnabled()) {
+			logger.debug("TradeServiceImpl.isOnline()");
+		}
+	}
+
+	public LoginResponse login(Login login) {
+		CustomAccountBean param;
+		try {
+			param = mgr.login(login.getUserID(), login.getPassword());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		LoginResponse response = new LoginResponse();
+		response.setLoginReturn(param);
+		return response;
+	}
+
+	public LogoutResponse logout(Logout logout) {
+		try {
+			mgr.logout(logout.getUserID());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		LogoutResponse response = new LogoutResponse();
+		return response;
+	}
+
+	public RegisterResponse register(Register register) {
+		CustomAccountBean param;
+		try {
+			param = mgr.register(register.getUserID(), register.getPassword(),
+					register.getFullname(), register.getAddress(), register
+							.getEmail(), register.getCreditcard(), register
+							.getOpenBalance());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		RegisterResponse response = new RegisterResponse();
+		response.setRegisterReturn(param);
+		return response;
+	}
+
+	public SellResponse sell(Sell sell) {
+		CustomOrderBean param;
+		try {
+			param = mgr.sell(sell.getUserID(), sell.getHoldingID(), sell
+					.getOrderProcessingMode());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		SellResponse response = new SellResponse();
+		response.setSellReturn(param);
+		return response;
+	}
+
+	public SellEnhancedResponse sellEnhanced(SellEnhanced sellEnhanced) {
+		CustomOrderBean param;
+		try {
+			param = mgr.sellEnhanced(sellEnhanced.getUserID(), sellEnhanced
+					.getHoldingID(), sellEnhanced.getQuantity());
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+		SellEnhancedResponse response = new SellEnhancedResponse();
+		response.setSellEnhancedReturn(param);
+		return response;
+	}
+
+	public UpdateAccountProfileResponse updateAccountProfile(
+			UpdateAccountProfile updateAccountProfile) {
+		CustomAccountProfileBean accountProfile = new CustomAccountProfileBean(
+				updateAccountProfile.getProfileData());
+		CustomAccountProfileBean param;
+		try {
+			param = mgr.updateAccountProfile(accountProfile);
+		} catch (DAOException e) {
+			logger.debug("", e);
+			throw new RuntimeException(e);
+		}
+
+		UpdateAccountProfileResponse response = new UpdateAccountProfileResponse();
+		response.setUpdateAccountProfileReturn(param);
+		return response;
+	}
+
+	private OrderDataBean[] toArray(List<CustomOrderBean> orders) {
+		OrderDataBean[] arrayOfOrders = new OrderDataBean[orders.size()];
+		return (OrderDataBean[]) orders.toArray(arrayOfOrders);
+	}
+
+	private HoldingDataBean[] toArray(List<CustomHoldingBean> holdings) {
+		HoldingDataBean[] arrayOfHoldings = new HoldingDataBean[holdings.size()];
+		return (HoldingDataBean[]) holdings.toArray(arrayOfHoldings);
+	}
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TraderServiceManager.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TraderServiceManager.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TraderServiceManager.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache/stocktrader/services/TraderServiceManager.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,229 @@
+/*
+ * 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.apache.stocktrader.services;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stocktrader.CustomAccountBean;
+import org.apache.stocktrader.CustomAccountProfileBean;
+import org.apache.stocktrader.CustomHoldingBean;
+import org.apache.stocktrader.CustomMarketSummaryBean;
+import org.apache.stocktrader.CustomOrderBean;
+import org.apache.stocktrader.CustomQuoteBean;
+import org.apache.stocktrader.dal.CustomerDAO;
+import org.apache.stocktrader.dal.DAOException;
+import org.apache.stocktrader.dal.DAOFactory;
+import org.apache.stocktrader.dal.MarketSummaryDAO;
+import org.apache.stocktrader.dal.OrderDAO;
+import org.apache.stocktrader.mssql.MSSQLOrderDAO;
+import org.apache.stocktrader.util.StockTraderUtility;
+
+public class TraderServiceManager {
+
+	private static final Log logger = LogFactory
+			.getLog(TraderServiceManager.class);
+
+	private DAOFactory factory = null;
+
+	public TraderServiceManager() {
+		factory = DAOFactory.getFacotry(DAOFactory.MS_SQL_FACTORY);
+	}
+
+	public CustomAccountBean login(String userId, String password)
+			throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.login(userId, password);
+	}
+
+	public void logout(String userId) throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		customerDAO.logoutUser(userId);
+	}
+
+	public CustomAccountBean getAccountData(String userId) throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.getCustomerByUserId(userId);
+	}
+
+	public CustomAccountProfileBean getAccountProfileData(String userId)
+			throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.getAccountProfileData(userId);
+	}
+
+	public List<CustomOrderBean> getOrders(String userId) throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.getOrders(userId, false,
+				StockTraderUtility.MAX_QUERY_TOP_ORDERS,
+				StockTraderUtility.MAX_QUERY_ORDERS);
+	}
+
+	public List<CustomOrderBean> getTopOrders(String userId)
+			throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.getOrders(userId, true,
+				StockTraderUtility.MAX_QUERY_TOP_ORDERS,
+				StockTraderUtility.MAX_QUERY_ORDERS);
+	}
+
+	public List<CustomOrderBean> getClosedOrders(String userId)
+			throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.getClosedOrders(userId);
+	}
+
+	public CustomAccountBean register(String userId, String password,
+			String fullName, String address, String email, String creditcard,
+			BigDecimal openBalance) throws DAOException {
+		throw new UnsupportedOperationException();
+	}
+
+	public CustomAccountBean addNewRegisteredUser(String userId,
+			String password, String fullName, String address, String email,
+			String creditcard, BigDecimal openBalance) throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		CustomAccountProfileBean customerProfile = new CustomAccountProfileBean(
+				userId, password, fullName, address, email, creditcard);
+		customerDAO.insertAccountProfile(customerProfile);
+		CustomAccountBean customer = new CustomAccountBean(0, userId, Calendar
+				.getInstance(), openBalance, 0, openBalance, Calendar
+				.getInstance(), 0);
+		return customer;
+	}
+
+	public CustomAccountProfileBean updateAccountProfile(
+			CustomAccountProfileBean customAccountProfile) throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.update(customAccountProfile);
+	}
+
+	public CustomMarketSummaryBean getMarketSummary() throws DAOException {
+		MarketSummaryDAO marketSummaryDAO = factory.getMarketSummaryDAO();
+		return marketSummaryDAO.getCustomMarketSummary();
+	}
+
+	public CustomQuoteBean getQuote(String symbol) throws DAOException {
+		MarketSummaryDAO marketSummaryDAO = factory.getMarketSummaryDAO();
+		return marketSummaryDAO.getQuote(symbol);
+	}
+
+	public CustomOrderBean buy(String userID, String symbol, double quantity)
+			throws DAOException {
+		return placeOrder(StockTraderUtility.ORDER_TYPE_BUY, userID, 0, symbol,
+				quantity);
+	}
+
+	public CustomOrderBean sell(String userID, int holdingID,
+			int orderProcessingMode) throws DAOException {
+		return placeOrder(StockTraderUtility.ORDER_TYPE_SELL, userID,
+				holdingID, null, 0);
+	}
+
+	public CustomOrderBean sellEnhanced(String userID, int holdingID,
+			double quantity) throws DAOException {
+		return placeOrder(StockTraderUtility.ORDER_TYPE_SELL_ENHANCED, userID,
+				holdingID, null, quantity);
+	}
+
+	public CustomOrderBean placeOrder(String orderType, String userID,
+			int holdingID, String symbol, double quantity) throws DAOException {
+		MSSQLOrderDAO orderDAO = (MSSQLOrderDAO) factory.getOrderDAO();
+		CustomOrderBean order = null;
+		CustomHoldingBean holding = new CustomHoldingBean();
+		try {
+
+			orderDAO.beginTransaction();
+			order = createOrder(orderType, userID, holdingID, symbol, quantity,
+					holding);
+
+			TradeOrderServiceClient asynClient = TradeOrderServiceClient.getInstance();
+			asynClient.SubmitOrderTrasactedQueue(order);
+			orderDAO.commitTransaction();
+			return order;
+		} catch (Exception e) {
+			try {
+				orderDAO.rollbackTransaction();
+			} catch (DAOException e2) {
+				throw e2;
+			}
+			throw new RuntimeException(e);
+		}
+	}
+
+	private CustomOrderBean createOrder(String orderType, String userID,
+			int holdingID, String symbol, double quantity,
+			CustomHoldingBean holding) throws DAOException {
+		CustomOrderBean order = null;
+		OrderDAO orderDAO = factory.getOrderDAO();
+
+		if (StockTraderUtility.ORDER_TYPE_SELL.equals(orderType)) {
+			// CHECKME holding is the argument
+			holding = orderDAO.getHolding(holdingID);
+			if (holding == null) {
+				throw new DAOException("No holding entry found for HoldingID<"
+						+ holdingID + ">");
+			}
+			order = orderDAO.createOrder(userID, holding.getQuoteID(),
+					StockTraderUtility.ORDER_TYPE_SELL, holding.getQuantity(),
+					holdingID);
+
+		} else if (StockTraderUtility.ORDER_TYPE_SELL_ENHANCED
+				.equals(orderType)) {
+			holding = orderDAO.getHolding(holdingID);
+			if (holding == null) {
+				throw new DAOException("No holding entry found for HoldingID<"
+						+ holdingID + ">");
+			}
+			if (quantity > holding.getQuantity()) {
+				order = orderDAO.createOrder(userID, holding.getQuoteID(),
+						StockTraderUtility.ORDER_TYPE_SELL, holding
+								.getQuantity(), holdingID);
+			} else {
+				order = orderDAO
+						.createOrder(userID, holding.getQuoteID(),
+								StockTraderUtility.ORDER_TYPE_SELL, quantity,
+								holdingID);
+			}
+		} else if (StockTraderUtility.ORDER_TYPE_BUY.equals(orderType)) {
+			order = orderDAO.createOrder(userID, symbol,
+					StockTraderUtility.ORDER_TYPE_BUY, quantity, -1);
+		} else {
+			throw new IllegalArgumentException("Invalid orderType<" + orderType
+					+ ">");
+		}
+		return order;
+	}
+
+	public CustomHoldingBean getHolding(String userID, int holdingID)
+			throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.getHolding(userID, holdingID);
+	}
+
+	public List<CustomHoldingBean> getHoldings(String userID)
+			throws DAOException {
+		CustomerDAO customerDAO = factory.getCustomerDAO();
+		return customerDAO.getHoldings(userID);
+	}
+
+}

Modified: incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml?rev=766980&r1=766979&r2=766980&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml (original)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml Tue Apr 21 05:31:16 2009
@@ -24,7 +24,7 @@
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<artifactId>stocktrader-wsas</artifactId>
-	<groupId>org.wso2.stocktrader.common</groupId>
+	<groupId>org.apache.stocktrader.common</groupId>
 	<name>WSAS Stock Trader Common</name>
 	<version>SNAPSHOT</version>
 	<properties>

Added: incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountBean.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountProfileBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountProfileBean.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountProfileBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomAccountProfileBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomHoldingBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomHoldingBean.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomHoldingBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomHoldingBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomMarketSummaryBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomMarketSummaryBean.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomMarketSummaryBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomMarketSummaryBean.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,59 @@
+/*
+ * 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.apache.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<CustomQuoteBean> topGainers,
+			List<CustomQuoteBean> topLosers) {
+		setTSIA(tSIA);
+		setOpenTSIA(openTSIA);
+		setVolume(volume);
+		setTopGainers(topGainers);
+		setTopLosers(topLosers);
+	}
+
+	private void setTopGainers(List<CustomQuoteBean> topGainers) {
+		ArrayOfQuoteDataBean arrayOfQuoteDataBean = new ArrayOfQuoteDataBean();
+		CustomQuoteBean[] qouteBeans = new CustomQuoteBean[topGainers.size()];
+		qouteBeans = (CustomQuoteBean[]) topGainers.toArray(qouteBeans);
+		arrayOfQuoteDataBean.setQuoteDataBean(qouteBeans);
+		setTopGainers(arrayOfQuoteDataBean);
+	}
+
+	private void setTopLosers(List<CustomQuoteBean> topLosers) {
+		ArrayOfQuoteDataBean arrayOfQouteDataBean = new ArrayOfQuoteDataBean();
+		CustomQuoteBean[] qouteBeans = new CustomQuoteBean[topLosers.size()];
+		qouteBeans = (CustomQuoteBean[]) topLosers.toArray(qouteBeans);
+		arrayOfQouteDataBean.setQuoteDataBean(qouteBeans);
+		setTopLosers(arrayOfQouteDataBean);
+	}
+
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomOrderBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomOrderBean.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomOrderBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomOrderBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomQuoteBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomQuoteBean.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomQuoteBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/CustomQuoteBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/HoldingBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/HoldingBean.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/HoldingBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/HoldingBean.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,105 @@
+/*
+ * 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.apache.stocktrader;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+/**
+ * This class is to be used as the data model for holding information.
+ */
+public class HoldingBean {
+
+	private int accountId;
+	private int holdingId;
+	private double quantity;
+	private BigDecimal purchasePrice;
+	private Calendar purchaseDate;
+	private String quoteId;
+
+	public HoldingBean() {
+	}
+
+	/**
+	 * 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 HoldingBean(int accountId, int holdingId, double quantity,
+			BigDecimal purchasePrice, Calendar purchaseDate, String quoteId) {
+		this.accountId = accountId;
+		this.holdingId = holdingId;
+		this.quantity = quantity;
+		this.purchasePrice = purchasePrice;
+		this.purchaseDate = purchaseDate;
+		this.quoteId = quoteId;
+	}
+
+	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;
+	}
+
+	public double getQuantity() {
+		return quantity;
+	}
+
+	public void setQuantity(double quantity) {
+		this.quantity = quantity;
+	}
+
+	public BigDecimal getPurchasePrice() {
+		return purchasePrice;
+	}
+
+	public void setPurchasePrice(BigDecimal purchasePrice) {
+		this.purchasePrice = purchasePrice;
+	}
+
+	public Calendar getPurchaseDate() {
+		return purchaseDate;
+	}
+
+	public void setPurchaseDate(Calendar purchaseDate) {
+		this.purchaseDate = purchaseDate;
+	}
+
+	public String getQuoteId() {
+		return quoteId;
+	}
+
+	public void setQuoteId(String quoteId) {
+		this.quoteId = quoteId;
+	}
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/QuoteBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/QuoteBean.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/QuoteBean.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/QuoteBean.java Tue Apr 21 05:31:16 2009
@@ -0,0 +1,127 @@
+/*
+ * 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.apache.stocktrader;
+
+import java.math.BigDecimal;
+
+/**
+ * This class to be used as the data model for quote information.
+ */
+public class QuoteBean {
+
+	private String symbol;
+	private String companyName;
+	private double volume;
+	private BigDecimal price;
+	private BigDecimal open;
+	private BigDecimal low;
+	private BigDecimal high;
+	private double change;
+
+	public QuoteBean() {
+	}
+
+	/**
+	 * Constructs an instance for quote information.
+	 * 
+	 * @param symbol
+	 * @param companyName
+	 * @param volume
+	 * @param price
+	 * @param open
+	 * @param low
+	 * @param high
+	 * @param change
+	 */
+	public QuoteBean(String symbol, String companyName, double volume,
+			BigDecimal price, BigDecimal open, BigDecimal low, BigDecimal high,
+			double change) {
+		this.symbol = symbol;
+		this.companyName = companyName;
+		this.volume = volume;
+		this.price = price;
+		this.open = open;
+		this.low = low;
+		this.high = high;
+		this.change = change;
+	}
+
+	public String getSymbol() {
+		return symbol;
+	}
+
+	public void setSymbol(String symbol) {
+		this.symbol = symbol;
+	}
+
+	public String getCompanyName() {
+		return companyName;
+	}
+
+	public void setCompanyName(String companyName) {
+		this.companyName = companyName;
+	}
+
+	public double getVolume() {
+		return volume;
+	}
+
+	public void setVolume(double volume) {
+		this.volume = volume;
+	}
+
+	public BigDecimal getPrice() {
+		return price;
+	}
+
+	public void setPrice(BigDecimal price) {
+		this.price = price;
+	}
+
+	public BigDecimal getOpen() {
+		return open;
+	}
+
+	public void setOpen(BigDecimal open) {
+		this.open = open;
+	}
+
+	public BigDecimal getLow() {
+		return low;
+	}
+
+	public void setLow(BigDecimal low) {
+		this.low = low;
+	}
+
+	public BigDecimal getHigh() {
+		return high;
+	}
+
+	public void setHigh(BigDecimal high) {
+		this.high = high;
+	}
+
+	public double getChange() {
+		return change;
+	}
+
+	public void setChange(double change) {
+		this.change = change;
+	}
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/CustomerDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/CustomerDAO.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/CustomerDAO.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/CustomerDAO.java Tue Apr 21 05:31:16 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.apache.stocktrader.dal;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import org.apache.stocktrader.CustomAccountBean;
+import org.apache.stocktrader.CustomAccountProfileBean;
+import org.apache.stocktrader.CustomHoldingBean;
+import org.apache.stocktrader.CustomOrderBean;
+
+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<CustomOrderBean> getOrders(String userId, boolean top,
+			int maxTop, int maxDefault) throws DAOException;
+
+	public List<CustomOrderBean> 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<CustomHoldingBean> getHoldings(String userID)
+			throws DAOException;
+
+}

Added: incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOException.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOException.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOException.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOException.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOFactory.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOFactory.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOFactory.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/DAOFactory.java Tue Apr 21 05:31:16 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.apache.stocktrader.dal;
+
+import org.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/MarketSummaryDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/MarketSummaryDAO.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/MarketSummaryDAO.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/MarketSummaryDAO.java Tue Apr 21 05:31:16 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.apache.stocktrader.dal;
+
+import org.apache.stocktrader.CustomMarketSummaryBean;
+import org.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/OrderDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/OrderDAO.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/OrderDAO.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/dal/OrderDAO.java Tue Apr 21 05:31:16 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.apache.stocktrader.dal;
+
+import java.math.BigDecimal;
+
+import org.apache.stocktrader.CustomHoldingBean;
+import org.apache.stocktrader.CustomOrderBean;
+import org.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/AbstractMSSQLDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/AbstractMSSQLDAO.java?rev=766980&view=auto
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/AbstractMSSQLDAO.java (added)
+++ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrader/mssql/AbstractMSSQLDAO.java Tue Apr 21 05:31:16 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.apache.stocktrader.mssql;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.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);
+		}
+	}
+}



Re: svn commit: r766980 [1/2] - in /incubator/stonehenge/trunk/stocktrader/wsas: ./ business_service/ business_service/resources/META-INF/ business_service/src/org/apache/ business_service/src/org/apache/stocktrader/ business_service/src/org/apache/stocktr...

Posted by Daniel Kulp <dk...@apache.org>.
They really should be changed to org.apache.stonehenge.stocktrader* to keep 
them in the project namespace.

Thanks for picking this up.

Dan

On Tue April 21 2009 1:31:18 am shankar@apache.org wrote:
> Author: shankar
> Date: Tue Apr 21 05:31:16 2009
> New Revision: 766980
>
> URL: http://svn.apache.org/viewvc?rev=766980&view=rev
> Log:
> Changing package names from wso2 to apache
>
> Added:
>    
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeConfigServiceClient.java
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderConfig.java
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderServiceClient.java
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderServiceClientPasswordCB.java
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeServiceImpl.java
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TraderServiceManager.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomAccountBean.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomAccountProfileBean.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomHoldingBean.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomMarketSummaryBean.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomOrderBean.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomQuoteBean.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/HoldingBean.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/QuoteBean.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/CustomerDAO.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/DAOException.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/DAOFactory.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/MarketSummaryDAO.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/OrderDAO.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/AbstractMSSQLDAO.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/MSSQLCustomerDAO.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/MSSQLDAOFactory.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/MSSQLMarketSummaryDAO.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/MSSQLOrderDAO.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/util/
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/util/OrderProcessorUtility.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/util/StockTraderSQLUtil.java
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/util/StockTraderUtility.java
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/
>stocktrader/
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/
>stocktrader/service/
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/
>stocktrader/service/OrderProcessManager.java
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/
>stocktrader/service/OrderProcessorImpl.java
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/apache/
>stocktrader/service/OrderProcessorServicePasswordCB.java Removed:
>    
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/wso2/s
>tocktrader/ incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/wso2/
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/src/org/wso2/
> Modified:
>     incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml
>    
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META
>-INF/services.xml incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml
>     incubator/stonehenge/trunk/stocktrader/wsas/order_processor/pom.xml
>    
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/resources/msec/
>META-INF/services.xml
> incubator/stonehenge/trunk/stocktrader/wsas/order_processor/resources/nosec
>/META-INF/services.xml incubator/stonehenge/trunk/stocktrader/wsas/pom.xml
>    
> incubator/stonehenge/trunk/stocktrader/wsas/resources/conf/config-svc.prope
>rties
> incubator/stonehenge/trunk/stocktrader/wsas/resources/conf/mssql-db.propert
>ies
> incubator/stonehenge/trunk/stocktrader/wsas/resources/conf/security-policy.
>xml
>
> Modified:
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/bu
>siness_service/pom.xml?rev=766980&r1=766979&r2=766980&view=diff
> ===========================================================================
>=== --- incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml
> (original) +++
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/pom.xml Tue
> Apr 21 05:31:16 2009 @@ -24,7 +24,7 @@
>  	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
>  	<artifactId>TradeService</artifactId>
> -	<groupId>org.wso2.stocktrader.trade-service</groupId>
> +	<groupId>org.apache.stocktrader.trade-service</groupId>
>  	<name>WSAS Stock Trader Business Service</name>
>  	<version>SNAPSHOT</version>
>  	<properties>
> @@ -365,7 +365,7 @@
>              <version>${version}</version>
>          </dependency>
>  		<dependency>
> -			<groupId>org.wso2.stocktrader.common</groupId>
> +			<groupId>org.apache.stocktrader.common</groupId>
>  			<artifactId>stocktrader-wsas</artifactId>
>              <version>${version}</version>
>          </dependency>
>
> Modified:
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META
>-INF/services.xml URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/bu
>siness_service/resources/META-INF/services.xml?rev=766980&r1=766979&r2=76698
>0&view=diff
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META
>-INF/services.xml (original) +++
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/resources/META
>-INF/services.xml Tue Apr 21 05:31:16 2009 @@ -25,7 +25,7 @@
>              <messageReceiver mep="http://www.w3.org/ns/wsdl/in-only"
> class="org.tempuri.TradeServiceWcfMessageReceiverInOnly"/> <messageReceiver
> mep="http://www.w3.org/ns/wsdl/in-out"
> class="org.tempuri.TradeServiceWcfMessageReceiverInOut"/>
> </messageReceivers>
> -        <parameter
> name="ServiceClass">org.wso2.stocktrader.services.TradeServiceImpl</paramet
>er> +        <parameter
> name="ServiceClass">org.apache.stocktrader.services.TradeServiceImpl</param
>eter> <parameter name="useOriginalwsdl">true</parameter>
>          <parameter name="modifyUserWSDLPortAddress">true</parameter>
>          <operation name="getHolding"
> mep="http://www.w3.org/ns/wsdl/in-out"
> namespace="http://trade.samples.websphere.ibm.com">
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeConfigServiceClient.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/bu
>siness_service/src/org/apache/stocktrader/services/TradeConfigServiceClient.
>java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeConfigServiceClient.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeConfigServiceClient.java Tue Apr 21 05:31:16 2009
> @@ -0,0 +1,70 @@
> +/*
> + * 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.apache.stocktrader.services;
> +
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.rmi.RemoteException;
> +import java.util.Properties;
> +
> +import org.apache.axis2.context.MessageContext;
> +import org.apache.stocktrader.util.StockTraderUtility;
> +import org.wso2.interop.stocktrader.Config_svcStub;
> +import org.wso2.interop.stocktrader.xsd.BSConfigRequest;
> +import org.wso2.interop.stocktrader.xsd.BSConfigRequestE;
> +import org.wso2.interop.stocktrader.xsd.BSConfigResponse;
> +import org.wso2.interop.stocktrader.xsd.BSConfigResponseE;
> +
> +public class TradeConfigServiceClient {
> +	private static final String SERVICE_URL =
> "org.apache.stocktrader.TradeConfigServiceClient.url"; +	private static
> TradeConfigServiceClient self = null;
> +
> +	private Properties prop = new Properties();
> +
> +	public static TradeConfigServiceClient getInstance() throws IOException {
> +		if (self == null) {
> +			self = new TradeConfigServiceClient();
> +		}
> +		return self;
> +	}
> +
> +	private TradeConfigServiceClient() throws IOException {
> +		super();
> +		// CHECKME .. there might be a better of doing this
> +		ClassLoader cl = MessageContext.getCurrentMessageContext()
> +				.getAxisService().getClassLoader();
> +		InputStream is = cl
> +				.getResourceAsStream(StockTraderUtility.TRADE_ORDER_SERVICE_PROPERTY_F
>ILE); +		prop.load(is);
> +	}
> +
> +	public TradeOrderConfig getTradeOrderConfig() throws RemoteException {
> +		Config_svcStub stub = new Config_svcStub(prop.getProperty(SERVICE_URL));
> +		BSConfigRequestE configRequestE = new BSConfigRequestE();
> +		BSConfigRequest param = new BSConfigRequest();
> +		param.setBS("JAVA_BS");
> +		configRequestE.setBSConfigRequest(param);
> +		BSConfigResponseE configResponseE =
> stub.bSConfigRequest(configRequestE); +		BSConfigResponse configResponse =
> configResponseE.getBSConfigResponse(); +		TradeOrderConfig config = new
> TradeOrderConfig();
> +		config.setEndpointURL(configResponse.getOPS().toString());
> +		config.setSecure(configResponse.getSec());
> +		return config;
> +	}
> +
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderConfig.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/bu
>siness_service/src/org/apache/stocktrader/services/TradeOrderConfig.java?rev
>=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderConfig.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderConfig.java Tue Apr 21 05:31:16 2009 @@ -0,0
> +1,37 @@
> +/*
> + * 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.apache.stocktrader.services;
> +
> +public class TradeOrderConfig {
> +	private String endpointURL;
> +	private boolean secure;
> +
> +	public String getEndpointURL() {
> +		return endpointURL;
> +	}
> +	public void setEndpointURL(String endpointURL) {
> +		this.endpointURL = endpointURL;
> +	}
> +	public boolean isSecure() {
> +		return secure;
> +	}
> +	public void setSecure(boolean secure) {
> +		this.secure = secure;
> +	}
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderServiceClient.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/bu
>siness_service/src/org/apache/stocktrader/services/TradeOrderServiceClient.j
>ava?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderServiceClient.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderServiceClient.java Tue Apr 21 05:31:16 2009
> @@ -0,0 +1,88 @@
> +/*
> + * 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.apache.stocktrader.services;
> +
> +import java.io.IOException;
> +import java.io.InputStream;
> +import java.util.Properties;
> +
> +import org.apache.axis2.AxisFault;
> +import org.apache.axis2.client.ServiceClient;
> +import org.apache.axis2.context.MessageContext;
> +import org.apache.axis2.description.AxisService;
> +import org.apache.axis2.transport.http.HTTPConstants;
> +import org.apache.neethi.Policy;
> +import org.apache.neethi.PolicyEngine;
> +import org.apache.stocktrader.CustomOrderBean;
> +import org.apache.stocktrader.util.StockTraderUtility;
> +
> +import traderorderhost.trade.OrderProcessorStub;
> +import traderorderhost.trade.SubmitOrder;
> +import traderorderhost.trade.SubmitOrderTransactedQueue;
> +
> +public class TradeOrderServiceClient extends ServiceClient {
> +
> +	private static TradeOrderServiceClient self = null;
> +	private Policy securityPolicy = null;
> +
> +	private TradeOrderServiceClient() throws IOException {
> +		super();
> +		// CHECKME .. there might be a better of doing this
> +		ClassLoader cl = MessageContext.getCurrentMessageContext()
> +				.getAxisService().getClassLoader();
> +		InputStream is = cl
> +				.getResourceAsStream(StockTraderUtility.TRADE_ORDER_SERVICE_SECURITY_F
>ILE); +		securityPolicy = PolicyEngine.getPolicy(is);
> +	}
> +
> +	public static final TradeOrderServiceClient getInstance()
> +			throws IOException {
> +		if (self == null) {
> +			self = new TradeOrderServiceClient();
> +		}
> +		return self;
> +	}
> +
> +	public void SubmitOrderTrasactedQueue(CustomOrderBean order)
> +			throws IOException {
> +		TradeOrderConfig config = geTradeOrderConfig();
> +		OrderProcessorStub stub = new OrderProcessorStub(config
> +				.getEndpointURL());
> +		if (config.isSecure()) {
> +			enableSecurity(stub);
> +		}
> +		ServiceClient serviceClient = stub._getServiceClient();
> +		serviceClient.getOptions().setProperty(HTTPConstants.CHUNKED, 
> Boolean.FALSE); +		SubmitOrder param = new SubmitOrder();
> +		param.setOrder(order);
> +		stub.submitOrder(param);
> +	}
> +
> +	private TradeOrderConfig geTradeOrderConfig() throws IOException {
> +		TradeConfigServiceClient client = TradeConfigServiceClient
> +				.getInstance();
> +		return client.getTradeOrderConfig();
> +	}
> +
> +	private void enableSecurity(OrderProcessorStub stub) throws AxisFault {
> +		ServiceClient serviceClient = stub._getServiceClient();
> +		AxisService axisService = serviceClient.getAxisService();
> +		axisService.getPolicySubject().attachPolicy(securityPolicy);
> +		serviceClient.engageModule("rampart");
> +	}
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderServiceClientPasswordCB.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/bu
>siness_service/src/org/apache/stocktrader/services/TradeOrderServiceClientPa
>sswordCB.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderServiceClientPasswordCB.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeOrderServiceClientPasswordCB.java Tue Apr 21
> 05:31:16 2009 @@ -0,0 +1,40 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements.  See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache License, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License.  You may obtain a copy of the License at
> + *
> + *      http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied. + * See the License for the specific language governing
> permissions and + * limitations under the License.
> + */
> +
> +package org.apache.stocktrader.services;
> +
> +import java.io.IOException;
> +
> +import javax.security.auth.callback.Callback;
> +import javax.security.auth.callback.CallbackHandler;
> +import javax.security.auth.callback.UnsupportedCallbackException;
> +
> +import org.apache.ws.security.WSPasswordCallback;
> +
> +public class TradeOrderServiceClientPasswordCB implements CallbackHandler
> { +	public void handle(Callback[] callbacks) throws IOException,
> +			UnsupportedCallbackException {
> +		for (int i = 0; i < callbacks.length; i++) {
> +			WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[i];
> +			String id = pwcb.getIdentifer();
> +			if ("bob".equals(id))
> +				pwcb.setPassword("password");
> +			else if ("bob.cer".equals(id))
> +				pwcb.setPassword("password");
> +		}
> +	}
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeServiceImpl.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/bu
>siness_service/src/org/apache/stocktrader/services/TradeServiceImpl.java?rev
>=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeServiceImpl.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TradeServiceImpl.java Tue Apr 21 05:31:16 2009 @@ -0,0
> +1,321 @@
> +/*
> + * 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.apache.stocktrader.services;
> +
> +import java.util.List;
> +
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.stocktrader.CustomAccountBean;
> +import org.apache.stocktrader.CustomAccountProfileBean;
> +import org.apache.stocktrader.CustomHoldingBean;
> +import org.apache.stocktrader.CustomMarketSummaryBean;
> +import org.apache.stocktrader.CustomOrderBean;
> +import org.apache.stocktrader.CustomQuoteBean;
> +import org.apache.stocktrader.dal.DAOException;
> +import org.tempuri.TradeServiceWcfSkeleton;
> +
> +import com.ibm.websphere.samples.trade.ArrayOfHoldingDataBean;
> +import com.ibm.websphere.samples.trade.ArrayOfOrderDataBean;
> +import com.ibm.websphere.samples.trade.Buy;
> +import com.ibm.websphere.samples.trade.BuyResponse;
> +import com.ibm.websphere.samples.trade.GetAccountData;
> +import com.ibm.websphere.samples.trade.GetAccountDataResponse;
> +import com.ibm.websphere.samples.trade.GetAccountProfileData;
> +import com.ibm.websphere.samples.trade.GetAccountProfileDataResponse;
> +import com.ibm.websphere.samples.trade.GetClosedOrders;
> +import com.ibm.websphere.samples.trade.GetClosedOrdersResponse;
> +import com.ibm.websphere.samples.trade.GetHolding;
> +import com.ibm.websphere.samples.trade.GetHoldingResponse;
> +import com.ibm.websphere.samples.trade.GetHoldings;
> +import com.ibm.websphere.samples.trade.GetHoldingsResponse;
> +import com.ibm.websphere.samples.trade.GetMarketSummary;
> +import com.ibm.websphere.samples.trade.GetMarketSummaryResponse;
> +import com.ibm.websphere.samples.trade.GetOrders;
> +import com.ibm.websphere.samples.trade.GetOrdersResponse;
> +import com.ibm.websphere.samples.trade.GetQuote;
> +import com.ibm.websphere.samples.trade.GetQuoteResponse;
> +import com.ibm.websphere.samples.trade.GetTopOrders;
> +import com.ibm.websphere.samples.trade.GetTopOrdersResponse;
> +import com.ibm.websphere.samples.trade.HoldingDataBean;
> +import com.ibm.websphere.samples.trade.IsOnline;
> +import com.ibm.websphere.samples.trade.Login;
> +import com.ibm.websphere.samples.trade.LoginResponse;
> +import com.ibm.websphere.samples.trade.Logout;
> +import com.ibm.websphere.samples.trade.LogoutResponse;
> +import com.ibm.websphere.samples.trade.OrderDataBean;
> +import com.ibm.websphere.samples.trade.Register;
> +import com.ibm.websphere.samples.trade.RegisterResponse;
> +import com.ibm.websphere.samples.trade.Sell;
> +import com.ibm.websphere.samples.trade.SellEnhanced;
> +import com.ibm.websphere.samples.trade.SellEnhancedResponse;
> +import com.ibm.websphere.samples.trade.SellResponse;
> +import com.ibm.websphere.samples.trade.UpdateAccountProfile;
> +import com.ibm.websphere.samples.trade.UpdateAccountProfileResponse;
> +
> +public class TradeServiceImpl extends TradeServiceWcfSkeleton {
> +	private static final Log logger =
> LogFactory.getLog(TradeServiceImpl.class); +
> +	private final TraderServiceManager mgr = new TraderServiceManager();
> +
> +	public BuyResponse buy(Buy buy) {
> +		CustomOrderBean order;
> +		try {
> +			order = mgr
> +					.buy(buy.getUserID(), buy.getSymbol(), buy.getQuantity());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		BuyResponse buyResponse = new BuyResponse();
> +		buyResponse.setBuyReturn(order);
> +		return buyResponse;
> +	}
> +
> +	public GetAccountDataResponse getAccountData(GetAccountData
> getAccountData) { +		CustomAccountBean accountData;
> +		try {
> +			accountData = mgr.getAccountData(getAccountData.getUserID());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetAccountDataResponse getAccountDataResponse = new
> GetAccountDataResponse();
> +		getAccountDataResponse.setGetAccountDataReturn(accountData);
> +		return getAccountDataResponse;
> +	}
> +
> +	public GetAccountProfileDataResponse getAccountProfileData(
> +			GetAccountProfileData getAccountProfileData) {
> +		CustomAccountProfileBean accountProfileData;
> +		try {
> +			accountProfileData = mgr
> +					.getAccountProfileData(getAccountProfileData.getUserID());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetAccountProfileDataResponse response = new
> GetAccountProfileDataResponse();
> +		response.setGetAccountProfileDataReturn(accountProfileData);
> +		return response;
> +	}
> +
> +	public GetClosedOrdersResponse getClosedOrders(
> +			GetClosedOrders getClosedOrders) {
> +		List<CustomOrderBean> closedOrders;
> +		try {
> +			closedOrders = mgr.getClosedOrders(getClosedOrders.getUserID());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetClosedOrdersResponse response = new GetClosedOrdersResponse();
> +		ArrayOfOrderDataBean arrayOfOrderBean = new ArrayOfOrderDataBean();
> +		arrayOfOrderBean.setOrderDataBean(toArray(closedOrders));
> +		response.setGetClosedOrdersReturn(arrayOfOrderBean);
> +		return response;
> +	}
> +
> +	public GetHoldingResponse getHolding(GetHolding getHolding) {
> +		CustomHoldingBean holding;
> +		try {
> +			holding = mgr.getHolding(getHolding.getUserID(), getHolding
> +					.getHoldingID());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetHoldingResponse response = new GetHoldingResponse();
> +		response.setGetHoldingReturn(holding);
> +		return response;
> +	}
> +
> +	public GetHoldingsResponse getHoldings(GetHoldings getHoldings) {
> +		List<CustomHoldingBean> holdingBeans;
> +		try {
> +			holdingBeans = mgr.getHoldings(getHoldings.getUserID());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetHoldingsResponse response = new GetHoldingsResponse();
> +		ArrayOfHoldingDataBean param = new ArrayOfHoldingDataBean();
> +		param.setHoldingDataBean(toArray(holdingBeans));
> +		response.setGetHoldingsReturn(param);
> +		return response;
> +	}
> +
> +	public GetMarketSummaryResponse getMarketSummary(
> +			GetMarketSummary getMarketSummary) {
> +		CustomMarketSummaryBean param;
> +		try {
> +			param = mgr.getMarketSummary();
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetMarketSummaryResponse response = new GetMarketSummaryResponse();
> +		response.setGetMarketSummaryReturn(param);
> +		return response;
> +	}
> +
> +	public GetOrdersResponse getOrders(GetOrders getOrders) {
> +		List<CustomOrderBean> orders;
> +		try {
> +			orders = mgr.getOrders(getOrders.getUserID());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetOrdersResponse response = new GetOrdersResponse();
> +		ArrayOfOrderDataBean param = new ArrayOfOrderDataBean();
> +		param.setOrderDataBean(toArray(orders));
> +		response.setGetOrdersReturn(param);
> +		return response;
> +	}
> +
> +	public GetQuoteResponse getQuote(GetQuote getQuote) {
> +		CustomQuoteBean param;
> +		try {
> +			param = mgr.getQuote(getQuote.getSymbol());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetQuoteResponse response = new GetQuoteResponse();
> +		response.setGetQuoteReturn(param);
> +		return response;
> +	}
> +
> +	public GetTopOrdersResponse getTopOrders(GetTopOrders getTopOrders) {
> +		List<CustomOrderBean> topOrders;
> +		try {
> +			topOrders = mgr.getTopOrders(getTopOrders.getUserID());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		GetTopOrdersResponse response = new GetTopOrdersResponse();
> +		ArrayOfOrderDataBean param = new ArrayOfOrderDataBean();
> +		param.setOrderDataBean(toArray(topOrders));
> +		response.setGetTopOrdersReturn(param);
> +		return response;
> +	}
> +
> +	public void isOnline(IsOnline isOnline) {
> +		if (logger.isDebugEnabled()) {
> +			logger.debug("TradeServiceImpl.isOnline()");
> +		}
> +	}
> +
> +	public LoginResponse login(Login login) {
> +		CustomAccountBean param;
> +		try {
> +			param = mgr.login(login.getUserID(), login.getPassword());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		LoginResponse response = new LoginResponse();
> +		response.setLoginReturn(param);
> +		return response;
> +	}
> +
> +	public LogoutResponse logout(Logout logout) {
> +		try {
> +			mgr.logout(logout.getUserID());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		LogoutResponse response = new LogoutResponse();
> +		return response;
> +	}
> +
> +	public RegisterResponse register(Register register) {
> +		CustomAccountBean param;
> +		try {
> +			param = mgr.register(register.getUserID(), register.getPassword(),
> +					register.getFullname(), register.getAddress(), register
> +							.getEmail(), register.getCreditcard(), register
> +							.getOpenBalance());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		RegisterResponse response = new RegisterResponse();
> +		response.setRegisterReturn(param);
> +		return response;
> +	}
> +
> +	public SellResponse sell(Sell sell) {
> +		CustomOrderBean param;
> +		try {
> +			param = mgr.sell(sell.getUserID(), sell.getHoldingID(), sell
> +					.getOrderProcessingMode());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		SellResponse response = new SellResponse();
> +		response.setSellReturn(param);
> +		return response;
> +	}
> +
> +	public SellEnhancedResponse sellEnhanced(SellEnhanced sellEnhanced) {
> +		CustomOrderBean param;
> +		try {
> +			param = mgr.sellEnhanced(sellEnhanced.getUserID(), sellEnhanced
> +					.getHoldingID(), sellEnhanced.getQuantity());
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +		SellEnhancedResponse response = new SellEnhancedResponse();
> +		response.setSellEnhancedReturn(param);
> +		return response;
> +	}
> +
> +	public UpdateAccountProfileResponse updateAccountProfile(
> +			UpdateAccountProfile updateAccountProfile) {
> +		CustomAccountProfileBean accountProfile = new CustomAccountProfileBean(
> +				updateAccountProfile.getProfileData());
> +		CustomAccountProfileBean param;
> +		try {
> +			param = mgr.updateAccountProfile(accountProfile);
> +		} catch (DAOException e) {
> +			logger.debug("", e);
> +			throw new RuntimeException(e);
> +		}
> +
> +		UpdateAccountProfileResponse response = new
> UpdateAccountProfileResponse();
> +		response.setUpdateAccountProfileReturn(param);
> +		return response;
> +	}
> +
> +	private OrderDataBean[] toArray(List<CustomOrderBean> orders) {
> +		OrderDataBean[] arrayOfOrders = new OrderDataBean[orders.size()];
> +		return (OrderDataBean[]) orders.toArray(arrayOfOrders);
> +	}
> +
> +	private HoldingDataBean[] toArray(List<CustomHoldingBean> holdings) {
> +		HoldingDataBean[] arrayOfHoldings = new
> HoldingDataBean[holdings.size()]; +		return (HoldingDataBean[])
> holdings.toArray(arrayOfHoldings);
> +	}
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TraderServiceManager.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/bu
>siness_service/src/org/apache/stocktrader/services/TraderServiceManager.java
>?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TraderServiceManager.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/business_service/src/org/apache
>/stocktrader/services/TraderServiceManager.java Tue Apr 21 05:31:16 2009 @@
> -0,0 +1,229 @@
> +/*
> + * 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.apache.stocktrader.services;
> +
> +import java.math.BigDecimal;
> +import java.util.Calendar;
> +
> +import java.util.List;
> +
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.stocktrader.CustomAccountBean;
> +import org.apache.stocktrader.CustomAccountProfileBean;
> +import org.apache.stocktrader.CustomHoldingBean;
> +import org.apache.stocktrader.CustomMarketSummaryBean;
> +import org.apache.stocktrader.CustomOrderBean;
> +import org.apache.stocktrader.CustomQuoteBean;
> +import org.apache.stocktrader.dal.CustomerDAO;
> +import org.apache.stocktrader.dal.DAOException;
> +import org.apache.stocktrader.dal.DAOFactory;
> +import org.apache.stocktrader.dal.MarketSummaryDAO;
> +import org.apache.stocktrader.dal.OrderDAO;
> +import org.apache.stocktrader.mssql.MSSQLOrderDAO;
> +import org.apache.stocktrader.util.StockTraderUtility;
> +
> +public class TraderServiceManager {
> +
> +	private static final Log logger = LogFactory
> +			.getLog(TraderServiceManager.class);
> +
> +	private DAOFactory factory = null;
> +
> +	public TraderServiceManager() {
> +		factory = DAOFactory.getFacotry(DAOFactory.MS_SQL_FACTORY);
> +	}
> +
> +	public CustomAccountBean login(String userId, String password)
> +			throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.login(userId, password);
> +	}
> +
> +	public void logout(String userId) throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		customerDAO.logoutUser(userId);
> +	}
> +
> +	public CustomAccountBean getAccountData(String userId) throws
> DAOException { +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.getCustomerByUserId(userId);
> +	}
> +
> +	public CustomAccountProfileBean getAccountProfileData(String userId)
> +			throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.getAccountProfileData(userId);
> +	}
> +
> +	public List<CustomOrderBean> getOrders(String userId) throws DAOException
> { +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.getOrders(userId, false,
> +				StockTraderUtility.MAX_QUERY_TOP_ORDERS,
> +				StockTraderUtility.MAX_QUERY_ORDERS);
> +	}
> +
> +	public List<CustomOrderBean> getTopOrders(String userId)
> +			throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.getOrders(userId, true,
> +				StockTraderUtility.MAX_QUERY_TOP_ORDERS,
> +				StockTraderUtility.MAX_QUERY_ORDERS);
> +	}
> +
> +	public List<CustomOrderBean> getClosedOrders(String userId)
> +			throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.getClosedOrders(userId);
> +	}
> +
> +	public CustomAccountBean register(String userId, String password,
> +			String fullName, String address, String email, String creditcard,
> +			BigDecimal openBalance) throws DAOException {
> +		throw new UnsupportedOperationException();
> +	}
> +
> +	public CustomAccountBean addNewRegisteredUser(String userId,
> +			String password, String fullName, String address, String email,
> +			String creditcard, BigDecimal openBalance) throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		CustomAccountProfileBean customerProfile = new CustomAccountProfileBean(
> +				userId, password, fullName, address, email, creditcard);
> +		customerDAO.insertAccountProfile(customerProfile);
> +		CustomAccountBean customer = new CustomAccountBean(0, userId, Calendar
> +				.getInstance(), openBalance, 0, openBalance, Calendar
> +				.getInstance(), 0);
> +		return customer;
> +	}
> +
> +	public CustomAccountProfileBean updateAccountProfile(
> +			CustomAccountProfileBean customAccountProfile) throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.update(customAccountProfile);
> +	}
> +
> +	public CustomMarketSummaryBean getMarketSummary() throws DAOException {
> +		MarketSummaryDAO marketSummaryDAO = factory.getMarketSummaryDAO();
> +		return marketSummaryDAO.getCustomMarketSummary();
> +	}
> +
> +	public CustomQuoteBean getQuote(String symbol) throws DAOException {
> +		MarketSummaryDAO marketSummaryDAO = factory.getMarketSummaryDAO();
> +		return marketSummaryDAO.getQuote(symbol);
> +	}
> +
> +	public CustomOrderBean buy(String userID, String symbol, double quantity)
> +			throws DAOException {
> +		return placeOrder(StockTraderUtility.ORDER_TYPE_BUY, userID, 0, symbol,
> +				quantity);
> +	}
> +
> +	public CustomOrderBean sell(String userID, int holdingID,
> +			int orderProcessingMode) throws DAOException {
> +		return placeOrder(StockTraderUtility.ORDER_TYPE_SELL, userID,
> +				holdingID, null, 0);
> +	}
> +
> +	public CustomOrderBean sellEnhanced(String userID, int holdingID,
> +			double quantity) throws DAOException {
> +		return placeOrder(StockTraderUtility.ORDER_TYPE_SELL_ENHANCED, userID,
> +				holdingID, null, quantity);
> +	}
> +
> +	public CustomOrderBean placeOrder(String orderType, String userID,
> +			int holdingID, String symbol, double quantity) throws DAOException {
> +		MSSQLOrderDAO orderDAO = (MSSQLOrderDAO) factory.getOrderDAO();
> +		CustomOrderBean order = null;
> +		CustomHoldingBean holding = new CustomHoldingBean();
> +		try {
> +
> +			orderDAO.beginTransaction();
> +			order = createOrder(orderType, userID, holdingID, symbol, quantity,
> +					holding);
> +
> +			TradeOrderServiceClient asynClient =
> TradeOrderServiceClient.getInstance();
> +			asynClient.SubmitOrderTrasactedQueue(order);
> +			orderDAO.commitTransaction();
> +			return order;
> +		} catch (Exception e) {
> +			try {
> +				orderDAO.rollbackTransaction();
> +			} catch (DAOException e2) {
> +				throw e2;
> +			}
> +			throw new RuntimeException(e);
> +		}
> +	}
> +
> +	private CustomOrderBean createOrder(String orderType, String userID,
> +			int holdingID, String symbol, double quantity,
> +			CustomHoldingBean holding) throws DAOException {
> +		CustomOrderBean order = null;
> +		OrderDAO orderDAO = factory.getOrderDAO();
> +
> +		if (StockTraderUtility.ORDER_TYPE_SELL.equals(orderType)) {
> +			// CHECKME holding is the argument
> +			holding = orderDAO.getHolding(holdingID);
> +			if (holding == null) {
> +				throw new DAOException("No holding entry found for HoldingID<"
> +						+ holdingID + ">");
> +			}
> +			order = orderDAO.createOrder(userID, holding.getQuoteID(),
> +					StockTraderUtility.ORDER_TYPE_SELL, holding.getQuantity(),
> +					holdingID);
> +
> +		} else if (StockTraderUtility.ORDER_TYPE_SELL_ENHANCED
> +				.equals(orderType)) {
> +			holding = orderDAO.getHolding(holdingID);
> +			if (holding == null) {
> +				throw new DAOException("No holding entry found for HoldingID<"
> +						+ holdingID + ">");
> +			}
> +			if (quantity > holding.getQuantity()) {
> +				order = orderDAO.createOrder(userID, holding.getQuoteID(),
> +						StockTraderUtility.ORDER_TYPE_SELL, holding
> +								.getQuantity(), holdingID);
> +			} else {
> +				order = orderDAO
> +						.createOrder(userID, holding.getQuoteID(),
> +								StockTraderUtility.ORDER_TYPE_SELL, quantity,
> +								holdingID);
> +			}
> +		} else if (StockTraderUtility.ORDER_TYPE_BUY.equals(orderType)) {
> +			order = orderDAO.createOrder(userID, symbol,
> +					StockTraderUtility.ORDER_TYPE_BUY, quantity, -1);
> +		} else {
> +			throw new IllegalArgumentException("Invalid orderType<" + orderType
> +					+ ">");
> +		}
> +		return order;
> +	}
> +
> +	public CustomHoldingBean getHolding(String userID, int holdingID)
> +			throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.getHolding(userID, holdingID);
> +	}
> +
> +	public List<CustomHoldingBean> getHoldings(String userID)
> +			throws DAOException {
> +		CustomerDAO customerDAO = factory.getCustomerDAO();
> +		return customerDAO.getHoldings(userID);
> +	}
> +
> +}
>
> Modified: incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml
> URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/pom.xml?rev=766980&r1=766979&r2=766980&view=diff
> ===========================================================================
>=== --- incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml
> (original) +++ incubator/stonehenge/trunk/stocktrader/wsas/common/pom.xml
> Tue Apr 21 05:31:16 2009 @@ -24,7 +24,7 @@
>  	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/maven-v4_0_0.xsd">
> <modelVersion>4.0.0</modelVersion>
>  	<artifactId>stocktrader-wsas</artifactId>
> -	<groupId>org.wso2.stocktrader.common</groupId>
> +	<groupId>org.apache.stocktrader.common</groupId>
>  	<name>WSAS Stock Trader Common</name>
>  	<version>SNAPSHOT</version>
>  	<properties>
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomAccountBean.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/CustomAccountBean.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomAccountBean.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomAccountBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomAccountProfileBean.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/CustomAccountProfileBean.java?rev=766980&vie
>w=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomAccountProfileBean.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomAccountProfileBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomHoldingBean.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/CustomHoldingBean.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomHoldingBean.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomHoldingBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomMarketSummaryBean.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/CustomMarketSummaryBean.java?rev=766980&view
>=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomMarketSummaryBean.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomMarketSummaryBean.java Tue Apr 21 05:31:16 2009 @@ -0,0 +1,59 @@
> +/*
> + * 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.apache.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<CustomQuoteBean> topGainers,
> +			List<CustomQuoteBean> topLosers) {
> +		setTSIA(tSIA);
> +		setOpenTSIA(openTSIA);
> +		setVolume(volume);
> +		setTopGainers(topGainers);
> +		setTopLosers(topLosers);
> +	}
> +
> +	private void setTopGainers(List<CustomQuoteBean> topGainers) {
> +		ArrayOfQuoteDataBean arrayOfQuoteDataBean = new ArrayOfQuoteDataBean();
> +		CustomQuoteBean[] qouteBeans = new CustomQuoteBean[topGainers.size()];
> +		qouteBeans = (CustomQuoteBean[]) topGainers.toArray(qouteBeans);
> +		arrayOfQuoteDataBean.setQuoteDataBean(qouteBeans);
> +		setTopGainers(arrayOfQuoteDataBean);
> +	}
> +
> +	private void setTopLosers(List<CustomQuoteBean> topLosers) {
> +		ArrayOfQuoteDataBean arrayOfQouteDataBean = new ArrayOfQuoteDataBean();
> +		CustomQuoteBean[] qouteBeans = new CustomQuoteBean[topLosers.size()];
> +		qouteBeans = (CustomQuoteBean[]) topLosers.toArray(qouteBeans);
> +		arrayOfQouteDataBean.setQuoteDataBean(qouteBeans);
> +		setTopLosers(arrayOfQouteDataBean);
> +	}
> +
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomOrderBean.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/CustomOrderBean.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomOrderBean.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomOrderBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomQuoteBean.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/CustomQuoteBean.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomQuoteBean.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/CustomQuoteBean.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/HoldingBean.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/HoldingBean.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/HoldingBean.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/HoldingBean.java Tue Apr 21 05:31:16 2009 @@ -0,0 +1,105 @@
> +/*
> + * 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.apache.stocktrader;
> +
> +import java.math.BigDecimal;
> +import java.util.Calendar;
> +
> +/**
> + * This class is to be used as the data model for holding information.
> + */
> +public class HoldingBean {
> +
> +	private int accountId;
> +	private int holdingId;
> +	private double quantity;
> +	private BigDecimal purchasePrice;
> +	private Calendar purchaseDate;
> +	private String quoteId;
> +
> +	public HoldingBean() {
> +	}
> +
> +	/**
> +	 * 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 HoldingBean(int accountId, int holdingId, double quantity,
> +			BigDecimal purchasePrice, Calendar purchaseDate, String quoteId) {
> +		this.accountId = accountId;
> +		this.holdingId = holdingId;
> +		this.quantity = quantity;
> +		this.purchasePrice = purchasePrice;
> +		this.purchaseDate = purchaseDate;
> +		this.quoteId = quoteId;
> +	}
> +
> +	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;
> +	}
> +
> +	public double getQuantity() {
> +		return quantity;
> +	}
> +
> +	public void setQuantity(double quantity) {
> +		this.quantity = quantity;
> +	}
> +
> +	public BigDecimal getPurchasePrice() {
> +		return purchasePrice;
> +	}
> +
> +	public void setPurchasePrice(BigDecimal purchasePrice) {
> +		this.purchasePrice = purchasePrice;
> +	}
> +
> +	public Calendar getPurchaseDate() {
> +		return purchaseDate;
> +	}
> +
> +	public void setPurchaseDate(Calendar purchaseDate) {
> +		this.purchaseDate = purchaseDate;
> +	}
> +
> +	public String getQuoteId() {
> +		return quoteId;
> +	}
> +
> +	public void setQuoteId(String quoteId) {
> +		this.quoteId = quoteId;
> +	}
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/QuoteBean.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/QuoteBean.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/QuoteBean.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/QuoteBean.java Tue Apr 21 05:31:16 2009 @@ -0,0 +1,127 @@
> +/*
> + * 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.apache.stocktrader;
> +
> +import java.math.BigDecimal;
> +
> +/**
> + * This class to be used as the data model for quote information.
> + */
> +public class QuoteBean {
> +
> +	private String symbol;
> +	private String companyName;
> +	private double volume;
> +	private BigDecimal price;
> +	private BigDecimal open;
> +	private BigDecimal low;
> +	private BigDecimal high;
> +	private double change;
> +
> +	public QuoteBean() {
> +	}
> +
> +	/**
> +	 * Constructs an instance for quote information.
> +	 *
> +	 * @param symbol
> +	 * @param companyName
> +	 * @param volume
> +	 * @param price
> +	 * @param open
> +	 * @param low
> +	 * @param high
> +	 * @param change
> +	 */
> +	public QuoteBean(String symbol, String companyName, double volume,
> +			BigDecimal price, BigDecimal open, BigDecimal low, BigDecimal high,
> +			double change) {
> +		this.symbol = symbol;
> +		this.companyName = companyName;
> +		this.volume = volume;
> +		this.price = price;
> +		this.open = open;
> +		this.low = low;
> +		this.high = high;
> +		this.change = change;
> +	}
> +
> +	public String getSymbol() {
> +		return symbol;
> +	}
> +
> +	public void setSymbol(String symbol) {
> +		this.symbol = symbol;
> +	}
> +
> +	public String getCompanyName() {
> +		return companyName;
> +	}
> +
> +	public void setCompanyName(String companyName) {
> +		this.companyName = companyName;
> +	}
> +
> +	public double getVolume() {
> +		return volume;
> +	}
> +
> +	public void setVolume(double volume) {
> +		this.volume = volume;
> +	}
> +
> +	public BigDecimal getPrice() {
> +		return price;
> +	}
> +
> +	public void setPrice(BigDecimal price) {
> +		this.price = price;
> +	}
> +
> +	public BigDecimal getOpen() {
> +		return open;
> +	}
> +
> +	public void setOpen(BigDecimal open) {
> +		this.open = open;
> +	}
> +
> +	public BigDecimal getLow() {
> +		return low;
> +	}
> +
> +	public void setLow(BigDecimal low) {
> +		this.low = low;
> +	}
> +
> +	public BigDecimal getHigh() {
> +		return high;
> +	}
> +
> +	public void setHigh(BigDecimal high) {
> +		this.high = high;
> +	}
> +
> +	public double getChange() {
> +		return change;
> +	}
> +
> +	public void setChange(double change) {
> +		this.change = change;
> +	}
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/CustomerDAO.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/dal/CustomerDAO.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/CustomerDAO.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/CustomerDAO.java Tue Apr 21 05:31:16 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.apache.stocktrader.dal;
> +
> +import java.math.BigDecimal;
> +import java.util.List;
> +
> +import org.apache.stocktrader.CustomAccountBean;
> +import org.apache.stocktrader.CustomAccountProfileBean;
> +import org.apache.stocktrader.CustomHoldingBean;
> +import org.apache.stocktrader.CustomOrderBean;
> +
> +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<CustomOrderBean> getOrders(String userId, boolean top,
> +			int maxTop, int maxDefault) throws DAOException;
> +
> +	public List<CustomOrderBean> 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<CustomHoldingBean> getHoldings(String userID)
> +			throws DAOException;
> +
> +}
>
> Added:
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/DAOException.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/dal/DAOException.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/DAOException.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/DAOException.java Tue Apr 21 05:31:16 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.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/DAOFactory.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/dal/DAOFactory.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/DAOFactory.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/DAOFactory.java Tue Apr 21 05:31:16 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.apache.stocktrader.dal;
> +
> +import org.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/MarketSummaryDAO.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/dal/MarketSummaryDAO.java?rev=766980&view=au
>to
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/MarketSummaryDAO.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/MarketSummaryDAO.java Tue Apr 21 05:31:16 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.apache.stocktrader.dal;
> +
> +import org.apache.stocktrader.CustomMarketSummaryBean;
> +import org.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/OrderDAO.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/dal/OrderDAO.java?rev=766980&view=auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/OrderDAO.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/dal/OrderDAO.java Tue Apr 21 05:31:16 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.apache.stocktrader.dal;
> +
> +import java.math.BigDecimal;
> +
> +import org.apache.stocktrader.CustomHoldingBean;
> +import org.apache.stocktrader.CustomOrderBean;
> +import org.apache.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/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/AbstractMSSQLDAO.java URL:
> http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/wsas/co
>mmon/src/org/apache/stocktrader/mssql/AbstractMSSQLDAO.java?rev=766980&view=
>auto
> ===========================================================================
>=== ---
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/AbstractMSSQLDAO.java (added) +++
> incubator/stonehenge/trunk/stocktrader/wsas/common/src/org/apache/stocktrad
>er/mssql/AbstractMSSQLDAO.java Tue Apr 21 05:31:16 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.apache.stocktrader.mssql;
> +
> +import java.sql.Connection;
> +import java.sql.SQLException;
> +
> +import org.apache.commons.logging.Log;
> +import org.apache.commons.logging.LogFactory;
> +import org.apache.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);
> +		}
> +	}
> +}

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog