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 ch...@apache.org on 2010/06/29 06:33:57 UTC
svn commit: r958838 [2/42] - in /incubator/stonehenge/trunk/stocktrader:
dotnet/ dotnet/setup_utilities/Util/ metro/ metro/active_sts/
metro/active_sts/etc/
metro/active_sts/src/org/apache/stonehenge/stocktrader/sts/
metro/business_service/ metro/busin...
Modified: incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeOrderServiceClient.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeOrderServiceClient.java?rev=958838&r1=958837&r2=958838&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeOrderServiceClient.java (original)
+++ incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeOrderServiceClient.java Tue Jun 29 06:33:54 2010
@@ -1,84 +1,84 @@
-/*
- * 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.stonehenge.stocktrader.services;
-
-import org.apache.stonehenge.stocktrader.BeanFactory;
-import org.apache.stonehenge.stocktrader.CustomOrderBean;
-import org.tempuri.OrderProcessor;
-import org.tempuri.OrderProcessorService;
-import traderorderhost.trade.SubmitOrder;
-
-import javax.xml.ws.BindingProvider;
-import java.io.IOException;
-import java.util.Map;
-
-import com.sun.xml.wss.XWSSConstants;
-
-public class TradeOrderServiceClient {
- private static TradeOrderServiceClient self = null;
- private final BeanFactory factory = new BeanFactory();
-
- private TradeOrderServiceClient() throws IOException {
- }
-
- public static final TradeOrderServiceClient getInstance()
- throws IOException {
- if (self == null) {
- self = new TradeOrderServiceClient();
- }
- return self;
- }
-
- public void SubmitOrder(CustomOrderBean order) throws IOException {
- OrderProcessor processor = new OrderProcessor();
- OrderProcessorService service = getOrderProcessorService(processor);
-
- SubmitOrder param = new SubmitOrder();
- param.setOrder(factory.toOrder(order));
- service.submitOrder(param);
- }
-
- private OrderProcessorService getOrderProcessorService(OrderProcessor processor) throws IOException {
- TradeOrderConfig config = TradeConfigServiceClient.getInstance().getTradeOrderConfig();
- OrderProcessorService service = null;
- if (config.isSecure()) {
- if (config.isMessageLevelSecurity()) {
- service = processor.getCustomBindingOrderProcessorService();
- } else if (config.isUsernameTokenOverTLS()) {
- service = processor.getSecureConversationBindingOrderProcessorService();
- }
- } else {
- service = processor.getBasicHttpBindingOrderProcessorService();
- }
-
- Map<String, Object> requestContext = ((BindingProvider) service).getRequestContext();
-
- requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, config.getEndpointURL());
- requestContext.put(XWSSConstants.USERNAME_PROPERTY, "uid:0");
- requestContext.put(XWSSConstants.PASSWORD_PROPERTY, "xxx");
-
- return service;
- }
-
-// public static void main(String[] args) throws Exception {
-// TradeOrderServiceClient asynClient = TradeOrderServiceClient.getInstance();
-// CustomOrderBean order = new CustomOrderBean(2, 2);
-// order.setQuantity(235D);
-// asynClient.SubmitOrder(order);
-// }
+/*
+ * 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.stonehenge.stocktrader.services;
+
+import org.apache.stonehenge.stocktrader.BeanFactory;
+import org.apache.stonehenge.stocktrader.CustomOrderBean;
+import org.tempuri.OrderProcessor;
+import org.tempuri.OrderProcessorService;
+import traderorderhost.trade.SubmitOrder;
+
+import javax.xml.ws.BindingProvider;
+import java.io.IOException;
+import java.util.Map;
+
+import com.sun.xml.wss.XWSSConstants;
+
+public class TradeOrderServiceClient {
+ private static TradeOrderServiceClient self = null;
+ private final BeanFactory factory = new BeanFactory();
+
+ private TradeOrderServiceClient() throws IOException {
+ }
+
+ public static final TradeOrderServiceClient getInstance()
+ throws IOException {
+ if (self == null) {
+ self = new TradeOrderServiceClient();
+ }
+ return self;
+ }
+
+ public void SubmitOrder(CustomOrderBean order) throws IOException {
+ OrderProcessor processor = new OrderProcessor();
+ OrderProcessorService service = getOrderProcessorService(processor);
+
+ SubmitOrder param = new SubmitOrder();
+ param.setOrder(factory.toOrder(order));
+ service.submitOrder(param);
+ }
+
+ private OrderProcessorService getOrderProcessorService(OrderProcessor processor) throws IOException {
+ TradeOrderConfig config = TradeConfigServiceClient.getInstance().getTradeOrderConfig();
+ OrderProcessorService service = null;
+ if (config.isSecure()) {
+ if (config.isMessageLevelSecurity()) {
+ service = processor.getCustomBindingOrderProcessorService();
+ } else if (config.isUsernameTokenOverTLS()) {
+ service = processor.getSecureConversationBindingOrderProcessorService();
+ }
+ } else {
+ service = processor.getBasicHttpBindingOrderProcessorService();
+ }
+
+ Map<String, Object> requestContext = ((BindingProvider) service).getRequestContext();
+
+ requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, config.getEndpointURL());
+ requestContext.put(XWSSConstants.USERNAME_PROPERTY, "uid:0");
+ requestContext.put(XWSSConstants.PASSWORD_PROPERTY, "xxx");
+
+ return service;
+ }
+
+// public static void main(String[] args) throws Exception {
+// TradeOrderServiceClient asynClient = TradeOrderServiceClient.getInstance();
+// CustomOrderBean order = new CustomOrderBean(2, 2);
+// order.setQuantity(235D);
+// asynClient.SubmitOrder(order);
+// }
}
\ No newline at end of file
Propchange: incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeOrderServiceClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeServiceImpl.java?rev=958838&r1=958837&r2=958838&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeServiceImpl.java (original)
+++ incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeServiceImpl.java Tue Jun 29 06:33:54 2010
@@ -1,317 +1,317 @@
-/*
- * 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.stonehenge.stocktrader.services;
-
-import org.tempuri.ITradeServices;
-import org.apache.stonehenge.stocktrader.*;
-import org.apache.stonehenge.stocktrader.dal.DAOException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import com.ibm.websphere.samples.trade.*;
-
-import javax.jws.WebParam;
-import javax.jws.WebService;
-import java.util.List;
-
-@WebService(endpointInterface = "org.tempuri.ITradeServices")
-public class TradeServiceImpl implements ITradeServices {
- private static final Log logger = LogFactory.getLog(TradeServiceImpl.class);
-
- private final TraderServiceManager mgr = new TraderServiceManager();
- private final BeanFactory factory = new BeanFactory();
-
- public EmptyMethodActionResponse emptyMethodAction(
- @WebParam(name = "emptyMethodAction", targetNamespace = "http://trade.samples.websphere.ibm.com",
- partName = "parameters") EmptyMethodAction emptyMethodAction) {
- throw new UnsupportedOperationException("emptyMethodAction unimplemented");
- }
-
- public void isOnline(
- @WebParam(name = "isOnline", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") IsOnline isOnline) {
- if (logger.isDebugEnabled()) {
- logger.debug("TradeServiceImpl.isOnline()");
- }
- }
-
- public LoginResponse login(
- @WebParam(name = "login", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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(factory.toAccount(param));
- return response;
- }
-
- public GetOrdersResponse getOrders(
- @WebParam(name = "getOrders", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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();
- // FIXED: used array for metro generated code
- param.getOrderDataBean().addAll(factory.toOrderList(orders));
-// param.setOrderDataBean(toArray(orders));
- response.setGetOrdersReturn(param);
- return response;
- }
-
- public GetAccountDataResponse getAccountData(
- @WebParam(name = "getAccountData", targetNamespace = "http://trade.samples.websphere.ibm.com",
- partName = "parameters") 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(factory.toAccount(accountData));
- return getAccountDataResponse;
- }
-
- public GetAccountProfileDataResponse getAccountProfileData(
- @WebParam(name = "getAccountProfileData", targetNamespace = "http://trade.samples.websphere.ibm.com",
- partName = "parameters") 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(factory.toAccountProfile(accountProfileData));
-
- return response;
- }
-
- public UpdateAccountProfileResponse updateAccountProfile(
- @WebParam(name = "updateAccountProfile", targetNamespace = "http://trade.samples.websphere.ibm.com",
- partName = "parameters") UpdateAccountProfile updateAccountProfile) {
- CustomAccountProfileBean accountProfile = factory.toCustomAccountProfileBean(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(factory.toAccountProfile(param));
- return response;
- }
-
- public LogoutResponse logout(
- @WebParam(name = "logout", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") Logout logout) {
- try {
- mgr.logout(logout.getUserID());
- } catch (DAOException e) {
- logger.debug("", e);
- throw new RuntimeException(e);
- }
- LogoutResponse response = new LogoutResponse();
- return response;
- }
-
- public BuyResponse buy(
- @WebParam(name = "buy", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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(factory.toOrder(order));
- return buyResponse;
- }
-
- public SellResponse sell(
- @WebParam(name = "sell", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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(factory.toOrder(param));
- return response;
- }
-
- public GetHoldingsResponse getHoldings(
- @WebParam(name = "getHoldings", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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();
-
- // FIXED: used array for metro generated code
- param.getHoldingDataBean().addAll(factory.toHoldingDataList(holdingBeans));
-// param.setHoldingDataBean(toArray(holdingBeans));
- response.setGetHoldingsReturn(param);
- return response;
- }
-
- public RegisterResponse register(
- @WebParam(name = "register", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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(factory.toAccount(param));
- return response;
- }
-
- public GetClosedOrdersResponse getClosedOrders(
- @WebParam(name = "getClosedOrders", targetNamespace = "http://trade.samples.websphere.ibm.com",
- partName = "parameters") 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();
- // FIXED: used array for metro generated code
- arrayOfOrderBean.getOrderDataBean().addAll(factory.toOrderList(closedOrders));
-// arrayOfOrderBean.setOrderDataBean(toArray(closedOrders));
- response.setGetClosedOrdersReturn(arrayOfOrderBean);
- return response;
- }
-
- public GetMarketSummaryResponse getMarketSummary(
- @WebParam(name = "getMarketSummary", targetNamespace = "http://trade.samples.websphere.ibm.com",
- partName = "parameters") GetMarketSummary getMarketSummary) {
- CustomMarketSummaryBean param;
- try {
- param = mgr.getMarketSummary();
- } catch (DAOException e) {
- logger.debug("", e);
- throw new RuntimeException(e);
- }
- GetMarketSummaryResponse response = new GetMarketSummaryResponse();
- response.setGetMarketSummaryReturn(factory.toMarketSummaryData(param));
- return response;
- }
-
- public GetQuoteResponse getQuote(
- @WebParam(name = "getQuote", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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(factory.toQuote(param));
- return response;
- }
-
- public GetHoldingResponse getHolding(
- @WebParam(name = "getHolding", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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(factory.toHoldingData(holding));
- return response;
- }
-
- public GetTopOrdersResponse getTopOrders(
- @WebParam(name = "getTopOrders", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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();
- // FIXED: used array for metro generated code
- param.getOrderDataBean().addAll(factory.toOrderList(topOrders));
-// param.setOrderDataBean(toArray(topOrders));
- response.setGetTopOrdersReturn(param);
- return response;
- }
-
- public SellEnhancedResponse sellEnhanced(
- @WebParam(name = "sellEnhanced", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
- "parameters") 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(factory.toOrder(param));
- return response;
- }
-}
+/*
+ * 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.stonehenge.stocktrader.services;
+
+import org.tempuri.ITradeServices;
+import org.apache.stonehenge.stocktrader.*;
+import org.apache.stonehenge.stocktrader.dal.DAOException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import com.ibm.websphere.samples.trade.*;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import java.util.List;
+
+@WebService(endpointInterface = "org.tempuri.ITradeServices")
+public class TradeServiceImpl implements ITradeServices {
+ private static final Log logger = LogFactory.getLog(TradeServiceImpl.class);
+
+ private final TraderServiceManager mgr = new TraderServiceManager();
+ private final BeanFactory factory = new BeanFactory();
+
+ public EmptyMethodActionResponse emptyMethodAction(
+ @WebParam(name = "emptyMethodAction", targetNamespace = "http://trade.samples.websphere.ibm.com",
+ partName = "parameters") EmptyMethodAction emptyMethodAction) {
+ throw new UnsupportedOperationException("emptyMethodAction unimplemented");
+ }
+
+ public void isOnline(
+ @WebParam(name = "isOnline", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") IsOnline isOnline) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("TradeServiceImpl.isOnline()");
+ }
+ }
+
+ public LoginResponse login(
+ @WebParam(name = "login", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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(factory.toAccount(param));
+ return response;
+ }
+
+ public GetOrdersResponse getOrders(
+ @WebParam(name = "getOrders", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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();
+ // FIXED: used array for metro generated code
+ param.getOrderDataBean().addAll(factory.toOrderList(orders));
+// param.setOrderDataBean(toArray(orders));
+ response.setGetOrdersReturn(param);
+ return response;
+ }
+
+ public GetAccountDataResponse getAccountData(
+ @WebParam(name = "getAccountData", targetNamespace = "http://trade.samples.websphere.ibm.com",
+ partName = "parameters") 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(factory.toAccount(accountData));
+ return getAccountDataResponse;
+ }
+
+ public GetAccountProfileDataResponse getAccountProfileData(
+ @WebParam(name = "getAccountProfileData", targetNamespace = "http://trade.samples.websphere.ibm.com",
+ partName = "parameters") 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(factory.toAccountProfile(accountProfileData));
+
+ return response;
+ }
+
+ public UpdateAccountProfileResponse updateAccountProfile(
+ @WebParam(name = "updateAccountProfile", targetNamespace = "http://trade.samples.websphere.ibm.com",
+ partName = "parameters") UpdateAccountProfile updateAccountProfile) {
+ CustomAccountProfileBean accountProfile = factory.toCustomAccountProfileBean(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(factory.toAccountProfile(param));
+ return response;
+ }
+
+ public LogoutResponse logout(
+ @WebParam(name = "logout", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") Logout logout) {
+ try {
+ mgr.logout(logout.getUserID());
+ } catch (DAOException e) {
+ logger.debug("", e);
+ throw new RuntimeException(e);
+ }
+ LogoutResponse response = new LogoutResponse();
+ return response;
+ }
+
+ public BuyResponse buy(
+ @WebParam(name = "buy", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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(factory.toOrder(order));
+ return buyResponse;
+ }
+
+ public SellResponse sell(
+ @WebParam(name = "sell", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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(factory.toOrder(param));
+ return response;
+ }
+
+ public GetHoldingsResponse getHoldings(
+ @WebParam(name = "getHoldings", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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();
+
+ // FIXED: used array for metro generated code
+ param.getHoldingDataBean().addAll(factory.toHoldingDataList(holdingBeans));
+// param.setHoldingDataBean(toArray(holdingBeans));
+ response.setGetHoldingsReturn(param);
+ return response;
+ }
+
+ public RegisterResponse register(
+ @WebParam(name = "register", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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(factory.toAccount(param));
+ return response;
+ }
+
+ public GetClosedOrdersResponse getClosedOrders(
+ @WebParam(name = "getClosedOrders", targetNamespace = "http://trade.samples.websphere.ibm.com",
+ partName = "parameters") 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();
+ // FIXED: used array for metro generated code
+ arrayOfOrderBean.getOrderDataBean().addAll(factory.toOrderList(closedOrders));
+// arrayOfOrderBean.setOrderDataBean(toArray(closedOrders));
+ response.setGetClosedOrdersReturn(arrayOfOrderBean);
+ return response;
+ }
+
+ public GetMarketSummaryResponse getMarketSummary(
+ @WebParam(name = "getMarketSummary", targetNamespace = "http://trade.samples.websphere.ibm.com",
+ partName = "parameters") GetMarketSummary getMarketSummary) {
+ CustomMarketSummaryBean param;
+ try {
+ param = mgr.getMarketSummary();
+ } catch (DAOException e) {
+ logger.debug("", e);
+ throw new RuntimeException(e);
+ }
+ GetMarketSummaryResponse response = new GetMarketSummaryResponse();
+ response.setGetMarketSummaryReturn(factory.toMarketSummaryData(param));
+ return response;
+ }
+
+ public GetQuoteResponse getQuote(
+ @WebParam(name = "getQuote", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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(factory.toQuote(param));
+ return response;
+ }
+
+ public GetHoldingResponse getHolding(
+ @WebParam(name = "getHolding", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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(factory.toHoldingData(holding));
+ return response;
+ }
+
+ public GetTopOrdersResponse getTopOrders(
+ @WebParam(name = "getTopOrders", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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();
+ // FIXED: used array for metro generated code
+ param.getOrderDataBean().addAll(factory.toOrderList(topOrders));
+// param.setOrderDataBean(toArray(topOrders));
+ response.setGetTopOrdersReturn(param);
+ return response;
+ }
+
+ public SellEnhancedResponse sellEnhanced(
+ @WebParam(name = "sellEnhanced", targetNamespace = "http://trade.samples.websphere.ibm.com", partName =
+ "parameters") 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(factory.toOrder(param));
+ return response;
+ }
+}
Propchange: incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TradeServiceImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TraderServiceManager.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TraderServiceManager.java?rev=958838&r1=958837&r2=958838&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TraderServiceManager.java (original)
+++ incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TraderServiceManager.java Tue Jun 29 06:33:54 2010
@@ -1,242 +1,242 @@
-/*
- * 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.stonehenge.stocktrader.services;
-
-import java.math.BigDecimal;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.stonehenge.stocktrader.CustomAccountBean;
-import org.apache.stonehenge.stocktrader.CustomAccountProfileBean;
-import org.apache.stonehenge.stocktrader.CustomHoldingBean;
-import org.apache.stonehenge.stocktrader.CustomMarketSummaryBean;
-import org.apache.stonehenge.stocktrader.CustomOrderBean;
-import org.apache.stonehenge.stocktrader.CustomQuoteBean;
-import org.apache.stonehenge.stocktrader.dal.CustomerDAO;
-import org.apache.stonehenge.stocktrader.dal.DAOException;
-import org.apache.stonehenge.stocktrader.dal.DAOFactory;
-import org.apache.stonehenge.stocktrader.dal.MarketSummaryDAO;
-import org.apache.stonehenge.stocktrader.dal.OrderDAO;
-import org.apache.stonehenge.stocktrader.util.StockTraderUtility;
-
-public class TraderServiceManager {
-
- static {
- //WORKAROUND. TO BE REMOVED.
- javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
- new javax.net.ssl.HostnameVerifier(){
- public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
- return true;
- }});
-
- }
-
- private static final Log logger = LogFactory
- .getLog(TraderServiceManager.class);
-
- private DAOFactory factory = null;
-
- public TraderServiceManager() {
- factory = DAOFactory.getFacotry();
- }
-
- 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 {
-
-
- System.setProperty("java.net.debug", "ssl,handshake");
-
- OrderDAO orderDAO = 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.SubmitOrder(order);
- orderDAO.commitTransaction();
- return order;
- } catch (Exception e) {
- try {
- orderDAO.rollbackTransaction();
- } catch (DAOException e2) {
- throw e2;
- }
- logger.error(e);
- 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);
- }
-
-}
+/*
+ * 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.stonehenge.stocktrader.services;
+
+import java.math.BigDecimal;
+
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.stonehenge.stocktrader.CustomAccountBean;
+import org.apache.stonehenge.stocktrader.CustomAccountProfileBean;
+import org.apache.stonehenge.stocktrader.CustomHoldingBean;
+import org.apache.stonehenge.stocktrader.CustomMarketSummaryBean;
+import org.apache.stonehenge.stocktrader.CustomOrderBean;
+import org.apache.stonehenge.stocktrader.CustomQuoteBean;
+import org.apache.stonehenge.stocktrader.dal.CustomerDAO;
+import org.apache.stonehenge.stocktrader.dal.DAOException;
+import org.apache.stonehenge.stocktrader.dal.DAOFactory;
+import org.apache.stonehenge.stocktrader.dal.MarketSummaryDAO;
+import org.apache.stonehenge.stocktrader.dal.OrderDAO;
+import org.apache.stonehenge.stocktrader.util.StockTraderUtility;
+
+public class TraderServiceManager {
+
+ static {
+ //WORKAROUND. TO BE REMOVED.
+ javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
+ new javax.net.ssl.HostnameVerifier(){
+ public boolean verify(String hostname, javax.net.ssl.SSLSession sslSession) {
+ return true;
+ }});
+
+ }
+
+ private static final Log logger = LogFactory
+ .getLog(TraderServiceManager.class);
+
+ private DAOFactory factory = null;
+
+ public TraderServiceManager() {
+ factory = DAOFactory.getFacotry();
+ }
+
+ 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 {
+
+
+ System.setProperty("java.net.debug", "ssl,handshake");
+
+ OrderDAO orderDAO = 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.SubmitOrder(order);
+ orderDAO.commitTransaction();
+ return order;
+ } catch (Exception e) {
+ try {
+ orderDAO.rollbackTransaction();
+ } catch (DAOException e2) {
+ throw e2;
+ }
+ logger.error(e);
+ 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);
+ }
+
+}
Propchange: incubator/stonehenge/trunk/stocktrader/metro/business_service/src/org/apache/stonehenge/stocktrader/services/TraderServiceManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/stonehenge/trunk/stocktrader/metro/business_service/src/wsit-client.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/business_service/src/wsit-client.xml?rev=958838&r1=958837&r2=958838&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/business_service/src/wsit-client.xml (original)
+++ incubator/stonehenge/trunk/stocktrader/metro/business_service/src/wsit-client.xml Tue Jun 29 06:33:54 2010
@@ -1,92 +1,92 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you under the Apache License, Version 2.0 (the
- ~ "License"); you may not use this file except in compliance
- ~ with the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing,
- ~ software distributed under the License is distributed on an
- ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- ~ KIND, either express or implied. See the License for the
- ~ specific language governing permissions and limitations
- ~ under the License.
--->
-<wsdl:definitions name="OrderProcessor" targetNamespace="http://tempuri.org/"
- xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"
- xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
- xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/"
- xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
- xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://Trade.TraderOrderHost"
- xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
- xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
- xmlns:wsa10="http://www.w3.org/2005/08/addressing"
- xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
-
- <wsp:Policy wsu:Id="ClientKeystorePolicy"
- xmlns:sc="http://schemas.sun.com/2006/03/wss/client"
- xmlns:wspp="http://java.sun.com/xml/ns/wsit/policy"
- xmlns:scc="http://schemas.sun.com/ws/2006/05/sc/client">
- <wsp:ExactlyOne>
- <wsp:All>
- <sunsp:DisableInclusivePrefixList xmlns:sunsp="http://schemas.sun.com/2006/03/wss/client"></sunsp:DisableInclusivePrefixList>
- <sc:KeyStore wspp:visibility="private" location="stonehenge-keystore.jks"
- type="JKS" alias="mykey" storepass="changeit"></sc:KeyStore>
- <sc:TrustStore wspp:visibility="private" location="stonehenge-truststore.jks"
- type="JKS" storepass="changeit" peeralias="mykey"></sc:TrustStore>
- </wsp:All>
- </wsp:ExactlyOne>
- </wsp:Policy>
-
- <wsdl:import namespace="http://Trade.TraderOrderHost" location="wsdl0.wsdl"/>
-
- <wsdl:binding name="BasicHttpBinding_OrderProcessorService" type="i0:OrderProcessorService">
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="SubmitOrder">
- <soap:operation soapAction="SubmitOrder" style="document"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- </wsdl:operation>
-
- </wsdl:binding>
-
- <wsdl:binding name="CustomBinding_OrderProcessorService" type="i0:OrderProcessorService">
- <wsp:PolicyReference URI="#ClientKeystorePolicy"/>
- <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
- <wsdl:operation name="SubmitOrder">
- <soap:operation soapAction="SubmitOrder" style="document"/>
- <wsdl:input>
- <soap:body use="literal"/>
- </wsdl:input>
- </wsdl:operation>
- </wsdl:binding>
- <wsdl:service name="OrderProcessor">
- <wsdl:port name="BasicHttpBinding_OrderProcessorService" binding="tns:BasicHttpBinding_OrderProcessorService">
- <soap:address location="http://stocktrader:8000/tradeorderprocessor"/>
- </wsdl:port>
- <wsdl:port name="CustomBinding_OrderProcessorService" binding="tns:CustomBinding_OrderProcessorService">
- <soap:address location="http://stocktrader:8000/tradeorderprocessor/sec"/>
- <wsa10:EndpointReference>
- <wsa10:Address>http://stocktrader:8000/tradeorderprocessor/sec</wsa10:Address>
- <!--<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
- <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
- <X509Data>
- <X509Certificate>
- MIIB8DCCAVmgAwIBAgIQ1ELWkagtIaZA+rGlQ0DB/DANBgkqhkiG9w0BAQQFADASMRAwDgYDVQQDEwdPUFMuQ29tMB4XDTA4MDUyMTA0NDUwMVoXDTM5MTIzMTIzNTk1OVowEjEQMA4GA1UEAxMHT1BTLkNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxwk9moHNb3pwAFdolsVrNRCypa9MAH9NOblGJRW6av93sC5oubfjbzfIgURycVgOYoI/6G3AZijENC//tR8CiNuwfc338j4gGJCYQMKF80f0v+wsOChbWA/jSMmW0XeZ2mtn28kUzZwBN+auK+iUurYmUfZlNCIzLrM49KKqLRMCAwEAAaNHMEUwQwYDVR0BBDwwOoAQGGhusN6c4j/7WSnvieRMbKEUMBIxEDAOBgNVBAMTB09QUy5Db22CENRC1pGoLSGmQPqxpUNAwfwwDQYJKoZIhvcNAQEEBQADgYEAZ8xVxioCvG8t8iCx5Xy7JgUyGVnTgxVhP3+uMGSca0u1wqnfoPethXkykPkCP5ZEYSS5SoBLdCKhn1HqICdTBkR2m0ebo50CoXT1lAy+5MELdzlR8SH9KV6nokwCPAW3RURk1huaDi3FO1oFDVm6146rAByZrG/PjDe3w+MUaHg=
- </X509Certificate>
- </X509Data>
- </KeyInfo>
- </Identity>-->
- </wsa10:EndpointReference>
- </wsdl:port>
- </wsdl:service>
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+-->
+<wsdl:definitions name="OrderProcessor" targetNamespace="http://tempuri.org/"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+ xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://tempuri.org/"
+ xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://Trade.TraderOrderHost"
+ xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
+ xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
+ xmlns:wsa10="http://www.w3.org/2005/08/addressing"
+ xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
+
+ <wsp:Policy wsu:Id="ClientKeystorePolicy"
+ xmlns:sc="http://schemas.sun.com/2006/03/wss/client"
+ xmlns:wspp="http://java.sun.com/xml/ns/wsit/policy"
+ xmlns:scc="http://schemas.sun.com/ws/2006/05/sc/client">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sunsp:DisableInclusivePrefixList xmlns:sunsp="http://schemas.sun.com/2006/03/wss/client"></sunsp:DisableInclusivePrefixList>
+ <sc:KeyStore wspp:visibility="private" location="stonehenge-keystore.jks"
+ type="JKS" alias="mykey" storepass="changeit"></sc:KeyStore>
+ <sc:TrustStore wspp:visibility="private" location="stonehenge-truststore.jks"
+ type="JKS" storepass="changeit" peeralias="mykey"></sc:TrustStore>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+ <wsdl:import namespace="http://Trade.TraderOrderHost" location="wsdl0.wsdl"/>
+
+ <wsdl:binding name="BasicHttpBinding_OrderProcessorService" type="i0:OrderProcessorService">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="SubmitOrder">
+ <soap:operation soapAction="SubmitOrder" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+
+ </wsdl:binding>
+
+ <wsdl:binding name="CustomBinding_OrderProcessorService" type="i0:OrderProcessorService">
+ <wsp:PolicyReference URI="#ClientKeystorePolicy"/>
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="SubmitOrder">
+ <soap:operation soapAction="SubmitOrder" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="OrderProcessor">
+ <wsdl:port name="BasicHttpBinding_OrderProcessorService" binding="tns:BasicHttpBinding_OrderProcessorService">
+ <soap:address location="http://stocktrader:8000/tradeorderprocessor"/>
+ </wsdl:port>
+ <wsdl:port name="CustomBinding_OrderProcessorService" binding="tns:CustomBinding_OrderProcessorService">
+ <soap:address location="http://stocktrader:8000/tradeorderprocessor/sec"/>
+ <wsa10:EndpointReference>
+ <wsa10:Address>http://stocktrader:8000/tradeorderprocessor/sec</wsa10:Address>
+ <!--<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
+ <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
+ <X509Data>
+ <X509Certificate>
+ MIIB8DCCAVmgAwIBAgIQ1ELWkagtIaZA+rGlQ0DB/DANBgkqhkiG9w0BAQQFADASMRAwDgYDVQQDEwdPUFMuQ29tMB4XDTA4MDUyMTA0NDUwMVoXDTM5MTIzMTIzNTk1OVowEjEQMA4GA1UEAxMHT1BTLkNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxwk9moHNb3pwAFdolsVrNRCypa9MAH9NOblGJRW6av93sC5oubfjbzfIgURycVgOYoI/6G3AZijENC//tR8CiNuwfc338j4gGJCYQMKF80f0v+wsOChbWA/jSMmW0XeZ2mtn28kUzZwBN+auK+iUurYmUfZlNCIzLrM49KKqLRMCAwEAAaNHMEUwQwYDVR0BBDwwOoAQGGhusN6c4j/7WSnvieRMbKEUMBIxEDAOBgNVBAMTB09QUy5Db22CENRC1pGoLSGmQPqxpUNAwfwwDQYJKoZIhvcNAQEEBQADgYEAZ8xVxioCvG8t8iCx5Xy7JgUyGVnTgxVhP3+uMGSca0u1wqnfoPethXkykPkCP5ZEYSS5SoBLdCKhn1HqICdTBkR2m0ebo50CoXT1lAy+5MELdzlR8SH9KV6nokwCPAW3RURk1huaDi3FO1oFDVm6146rAByZrG/PjDe3w+MUaHg=
+ </X509Certificate>
+ </X509Data>
+ </KeyInfo>
+ </Identity>-->
+ </wsa10:EndpointReference>
+ </wsdl:port>
+ </wsdl:service>
</wsdl:definitions>
\ No newline at end of file
Propchange: incubator/stonehenge/trunk/stocktrader/metro/business_service/src/wsit-client.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountBean.java?rev=958838&r1=958837&r2=958838&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountBean.java (original)
+++ incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountBean.java Tue Jun 29 06:33:54 2010
@@ -1,124 +1,124 @@
-/*
- * 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.stonehenge.stocktrader;
-
-import java.math.BigDecimal;
-import java.util.Calendar;
-
-public class CustomAccountBean {
- private static final long serialVersionUID = -6368651996080304426L;
-
- protected String userID;
- protected Integer accountID;
- protected Integer loginCount;
- protected Integer logoutCount;
- protected Calendar lastLogin;
- protected Calendar creationDate;
- protected BigDecimal balance;
- protected BigDecimal openBalance;
- protected String profileID;
-
- public CustomAccountBean() {
- }
-
- 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;
- }
-
- public Integer getAccountID() {
- return accountID;
- }
-
- public void setAccountID(Integer accountID) {
- this.accountID = accountID;
- }
-
- public Integer getLoginCount() {
- return loginCount;
- }
-
- public void setLoginCount(Integer loginCount) {
- this.loginCount = loginCount;
- }
-
- public Integer getLogoutCount() {
- return logoutCount;
- }
-
- public void setLogoutCount(Integer logoutCount) {
- this.logoutCount = logoutCount;
- }
-
- public Calendar getLastLogin() {
- return lastLogin;
- }
-
- public void setLastLogin(Calendar lastLogin) {
- this.lastLogin = lastLogin;
- }
-
- public Calendar getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(Calendar creationDate) {
- this.creationDate = creationDate;
- }
-
- public BigDecimal getBalance() {
- return balance;
- }
-
- public void setBalance(BigDecimal balance) {
- this.balance = balance;
- }
-
- public BigDecimal getOpenBalance() {
- return openBalance;
- }
-
- public void setOpenBalance(BigDecimal openBalance) {
- this.openBalance = openBalance;
- }
-
- public String getProfileID() {
- return profileID;
- }
-
- public void setProfileID(String profileID) {
- this.profileID = profileID;
- }
-}
+/*
+ * 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.stonehenge.stocktrader;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+public class CustomAccountBean {
+ private static final long serialVersionUID = -6368651996080304426L;
+
+ protected String userID;
+ protected Integer accountID;
+ protected Integer loginCount;
+ protected Integer logoutCount;
+ protected Calendar lastLogin;
+ protected Calendar creationDate;
+ protected BigDecimal balance;
+ protected BigDecimal openBalance;
+ protected String profileID;
+
+ public CustomAccountBean() {
+ }
+
+ 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;
+ }
+
+ public Integer getAccountID() {
+ return accountID;
+ }
+
+ public void setAccountID(Integer accountID) {
+ this.accountID = accountID;
+ }
+
+ public Integer getLoginCount() {
+ return loginCount;
+ }
+
+ public void setLoginCount(Integer loginCount) {
+ this.loginCount = loginCount;
+ }
+
+ public Integer getLogoutCount() {
+ return logoutCount;
+ }
+
+ public void setLogoutCount(Integer logoutCount) {
+ this.logoutCount = logoutCount;
+ }
+
+ public Calendar getLastLogin() {
+ return lastLogin;
+ }
+
+ public void setLastLogin(Calendar lastLogin) {
+ this.lastLogin = lastLogin;
+ }
+
+ public Calendar getCreationDate() {
+ return creationDate;
+ }
+
+ public void setCreationDate(Calendar creationDate) {
+ this.creationDate = creationDate;
+ }
+
+ public BigDecimal getBalance() {
+ return balance;
+ }
+
+ public void setBalance(BigDecimal balance) {
+ this.balance = balance;
+ }
+
+ public BigDecimal getOpenBalance() {
+ return openBalance;
+ }
+
+ public void setOpenBalance(BigDecimal openBalance) {
+ this.openBalance = openBalance;
+ }
+
+ public String getProfileID() {
+ return profileID;
+ }
+
+ public void setProfileID(String profileID) {
+ this.profileID = profileID;
+ }
+}
Propchange: incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountProfileBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountProfileBean.java?rev=958838&r1=958837&r2=958838&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountProfileBean.java (original)
+++ incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountProfileBean.java Tue Jun 29 06:33:54 2010
@@ -1,91 +1,91 @@
-/*
- * 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.stonehenge.stocktrader;
-
-public class CustomAccountProfileBean {
-
- private static final long serialVersionUID = 1485167358537563576L;
-
- protected String userID;
- protected String password;
- protected String fullName;
- protected String address;
- protected String email;
- protected String creditCard;
-
- public CustomAccountProfileBean() {
- }
-
- 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);
- }
-
- public String getUserID() {
- return userID;
- }
-
- public void setUserID(String userID) {
- this.userID = userID;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getFullName() {
- return fullName;
- }
-
- public void setFullName(String fullName) {
- this.fullName = fullName;
- }
-
- public String getAddress() {
- return address;
- }
-
- public void setAddress(String address) {
- this.address = address;
- }
-
- public String getEmail() {
- return email;
- }
-
- public void setEmail(String email) {
- this.email = email;
- }
-
- public String getCreditCard() {
- return creditCard;
- }
-
- public void setCreditCard(String creditCard) {
- this.creditCard = creditCard;
- }
-}
+/*
+ * 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.stonehenge.stocktrader;
+
+public class CustomAccountProfileBean {
+
+ private static final long serialVersionUID = 1485167358537563576L;
+
+ protected String userID;
+ protected String password;
+ protected String fullName;
+ protected String address;
+ protected String email;
+ protected String creditCard;
+
+ public CustomAccountProfileBean() {
+ }
+
+ 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);
+ }
+
+ public String getUserID() {
+ return userID;
+ }
+
+ public void setUserID(String userID) {
+ this.userID = userID;
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public String getFullName() {
+ return fullName;
+ }
+
+ public void setFullName(String fullName) {
+ this.fullName = fullName;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getCreditCard() {
+ return creditCard;
+ }
+
+ public void setCreditCard(String creditCard) {
+ this.creditCard = creditCard;
+ }
+}
Propchange: incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomAccountProfileBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomHoldingBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomHoldingBean.java?rev=958838&r1=958837&r2=958838&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomHoldingBean.java (original)
+++ incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomHoldingBean.java Tue Jun 29 06:33:54 2010
@@ -1,124 +1,124 @@
-/*
- * 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.stonehenge.stocktrader;
-
-import java.math.BigDecimal;
-import java.util.Calendar;
-
-/**
- * This class is to be used as the data model for holding information.
- */
-public class CustomHoldingBean {
-
- private static final long serialVersionUID = 3294871357941879094L;
-
- private int accountID;
- protected Integer holdingID;
- protected Double quantity;
- protected BigDecimal purchasePrice;
- protected Calendar purchaseDate;
- protected String quoteID;
-
- 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;
- }
-
- public Integer getHoldingID() {
- return holdingID;
- }
-
- public void setHoldingID(Integer 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;
- }
-}
+/*
+ * 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.stonehenge.stocktrader;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+/**
+ * This class is to be used as the data model for holding information.
+ */
+public class CustomHoldingBean {
+
+ private static final long serialVersionUID = 3294871357941879094L;
+
+ private int accountID;
+ protected Integer holdingID;
+ protected Double quantity;
+ protected BigDecimal purchasePrice;
+ protected Calendar purchaseDate;
+ protected String quoteID;
+
+ 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;
+ }
+
+ public Integer getHoldingID() {
+ return holdingID;
+ }
+
+ public void setHoldingID(Integer 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;
+ }
+}
Propchange: incubator/stonehenge/trunk/stocktrader/metro/common/src/org/apache/stonehenge/stocktrader/CustomHoldingBean.java
------------------------------------------------------------------------------
svn:eol-style = native