incubator-stonehenge-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From drew...@apache.org
Subject svn commit: r781666 [5/6] - in /incubator/stonehenge/contrib/stocktrader/metro: ./ business_service/ business_service/config/ business_service/etc/ business_service/etc/order_processor/ business_service/lib/ business_service/lib/commons/ business_servi...
Date Thu, 04 Jun 2009 07:04:27 GMT
Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/custom-sei.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/custom-sei.xml?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/custom-sei.xml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/custom-sei.xml Thu Jun  4 07:04:21 2009
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License").  You
+ may not use this file except in compliance with the License. You can obtain
+ a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ Sun designates this particular file as subject to the "Classpath" exception
+ as provided by Sun in the GPL Version 2 section of the License file that
+ accompanied this code.  If applicable, add the following below the License
+ Header, with the fields enclosed by brackets [] replaced by your own
+ identifying information: "Portions Copyrighted [year]
+ [name of copyright owner]"
+
+ Contributor(s):
+
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license."  If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above.  However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+
+<bindings
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+        wsdlLocation="OrderProcessor.wsdl"
+        xmlns="http://java.sun.com/xml/ns/jaxws">
+    <enableWrapperStyle>false</enableWrapperStyle>
+
+</bindings>

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/server-keystore.jks
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/server-keystore.jks?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/server-keystore.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/server-truststore.jks
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/server-truststore.jks?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/server-truststore.jks
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/sun-jaxws.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/sun-jaxws.xml?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/sun-jaxws.xml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/sun-jaxws.xml Thu Jun  4 07:04:21 2009
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+
+ Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License").  You
+ may not use this file except in compliance with the License. You can obtain
+ a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
+ language governing permissions and limitations under the License.
+
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ Sun designates this particular file as subject to the "Classpath" exception
+ as provided by Sun in the GPL Version 2 section of the License file that
+ accompanied this code.  If applicable, add the following below the License
+ Header, with the fields enclosed by brackets [] replaced by your own
+ identifying information: "Portions Copyrighted [year]
+ [name of copyright owner]"
+
+ Contributor(s):
+
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license."  If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above.  However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+
+<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
+    <endpoint 
+        name="OrderProcessorSec"
+        interface="org.tempuri.OrderProcessorService"
+        implementation="org.wso2.stocktrader.service.OrderProcessorImpl"
+        wsdl="OrderProcessor.wsdl"
+        service="{http://tempuri.org/}OrderProcessor"
+        port="{http://tempuri.org/}CustomBinding_OrderProcessorService"
+        url-pattern="/OrderProcessorSec"
+        binding="http://www.w3.org/2003/05/soap/bindings/HTTP/" />
+
+    <endpoint
+        name="OrderProcessor"
+        interface="org.tempuri.OrderProcessorService"
+        implementation="org.wso2.stocktrader.service.OrderProcessorImpl"
+        wsdl="OrderProcessor.wsdl"
+        service="{http://tempuri.org/}OrderProcessor"
+        port="{http://tempuri.org/}BasicHttpBinding_OrderProcessorService"
+        url-pattern="/OrderProcessor"/>
+
+</endpoints>

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/web.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/web.xml?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/web.xml (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/web.xml Thu Jun  4 07:04:21 2009
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ 
+ Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ 
+ The contents of this file are subject to the terms of either the GNU
+ General Public License Version 2 only ("GPL") or the Common Development
+ and Distribution License("CDDL") (collectively, the "License").  You
+ may not use this file except in compliance with the License. You can obtain
+ a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
+ language governing permissions and limitations under the License.
+ 
+ When distributing the software, include this License Header Notice in each
+ file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ Sun designates this particular file as subject to the "Classpath" exception
+ as provided by Sun in the GPL Version 2 section of the License file that
+ accompanied this code.  If applicable, add the following below the License
+ Header, with the fields enclosed by brackets [] replaced by your own
+ identifying information: "Portions Copyrighted [year]
+ [name of copyright owner]"
+ 
+ Contributor(s):
+ 
+ If you wish your version of this file to be governed by only the CDDL or
+ only the GPL Version 2, indicate your decision by adding "[Contributor]
+ elects to include this software in this distribution under the [CDDL or GPL
+ Version 2] license."  If you don't indicate a single choice of license, a
+ recipient has the option to distribute your version of this file under
+ either the CDDL, the GPL Version 2 or to extend the choice of license to
+ its licensees as provided above.  However, if you add GPL Version 2 code
+ and therefore, elected the GPL Version 2 license, then the option applies
+ only if the new code is made subject to such option by the copyright
+ holder.
+-->
+
+<web-app version="2.4" mlns="http://java.sun.com/xml/ns/j2ee">
+  <display-name>wsit-jaxws-fromwsdl</display-name>
+  <description>wsit-jaxws-fromwsdl</description>
+  <listener>
+    <listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class>
+  </listener>
+  <servlet>
+    <servlet-name>stocktrader</servlet-name>
+    <display-name>stocktrader</display-name>
+    <description>stocktrader endpoint</description>
+    <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+  <servlet-mapping>
+    <servlet-name>stocktrader</servlet-name>
+    <url-pattern>/OrderProcessor</url-pattern>
+  </servlet-mapping>
+  <servlet-mapping>
+    <servlet-name>stocktrader</servlet-name>
+    <url-pattern>/OrderProcessorSec</url-pattern>
+  </servlet-mapping>
+  <session-config>
+    <session-timeout>60</session-timeout>
+  </session-config>
+</web-app>

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/wsdl0.wsdl
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/wsdl0.wsdl?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/wsdl0.wsdl (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/wsdl0.wsdl Thu Jun  4 07:04:21 2009
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<wsdl:definitions targetNamespace="http://Trade.TraderOrderHost" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+                  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://Trade.TraderOrderHost"
+                  xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+                  xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+                  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:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
+                  xmlns:wsa10="http://www.w3.org/2005/08/addressing"
+                  xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">
+    <wsdl:types>
+        <xsd:schema targetNamespace="http://Trade.TraderOrderHost/Imports">
+            <xsd:import schemaLocation="xsd0.xsd"
+                        namespace="http://Trade.TraderOrderHost"/>
+            <xsd:import schemaLocation="xsd1.xsd"
+                        namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
+            <xsd:import schemaLocation="xsd2.xsd"
+                        namespace="http://trade.samples.websphere.ibm.com"/>
+        </xsd:schema>
+    </wsdl:types>
+    <wsdl:message name="OrderProcessorService_SubmitOrder_InputMessage">
+        <wsdl:part name="parameters" element="tns:SubmitOrder"/>
+    </wsdl:message>
+    <wsdl:message name="OrderProcessorService_isOnline_InputMessage">
+        <wsdl:part name="parameters" element="tns:isOnline"/>
+    </wsdl:message>
+    <wsdl:portType name="OrderProcessorService">
+        <wsdl:operation name="SubmitOrder">
+            <wsdl:input wsaw:Action="SubmitOrder" message="tns:OrderProcessorService_SubmitOrder_InputMessage"/>
+        </wsdl:operation>
+        <wsdl:operation name="isOnline">
+            <wsdl:input wsaw:Action="isOnline" message="tns:OrderProcessorService_isOnline_InputMessage"/>
+        </wsdl:operation>
+    </wsdl:portType>
+</wsdl:definitions>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd0.xsd
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd0.xsd?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd0.xsd (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd0.xsd Thu Jun  4 07:04:21 2009
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema elementFormDefault="qualified" targetNamespace="http://Trade.TraderOrderHost"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://Trade.TraderOrderHost">
+    <xs:import schemaLocation="xsd2.xsd"
+               namespace="http://trade.samples.websphere.ibm.com"/>
+    <xs:element name="SubmitOrder">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element minOccurs="0" name="order" nillable="true" type="q1:OrderDataBean"
+                            xmlns:q1="http://trade.samples.websphere.ibm.com"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="isOnline">
+        <xs:complexType>
+            <xs:sequence/>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd1.xsd
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd1.xsd?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd1.xsd (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd1.xsd Thu Jun  4 07:04:21 2009
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema attributeFormDefault="qualified" elementFormDefault="qualified"
+           targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/">
+    <xs:element name="anyType" nillable="true" type="xs:anyType"/>
+    <xs:element name="anyURI" nillable="true" type="xs:anyURI"/>
+    <xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/>
+    <xs:element name="boolean" nillable="true" type="xs:boolean"/>
+    <xs:element name="byte" nillable="true" type="xs:byte"/>
+    <xs:element name="dateTime" nillable="true" type="xs:dateTime"/>
+    <xs:element name="decimal" nillable="true" type="xs:decimal"/>
+    <xs:element name="double" nillable="true" type="xs:double"/>
+    <xs:element name="float" nillable="true" type="xs:float"/>
+    <xs:element name="int" nillable="true" type="xs:int"/>
+    <xs:element name="long" nillable="true" type="xs:long"/>
+    <xs:element name="QName" nillable="true" type="xs:QName"/>
+    <xs:element name="short" nillable="true" type="xs:short"/>
+    <xs:element name="string" nillable="true" type="xs:string"/>
+    <xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/>
+    <xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/>
+    <xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/>
+    <xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/>
+    <xs:element name="char" nillable="true" type="tns:char"/>
+    <xs:simpleType name="char">
+        <xs:restriction base="xs:int"/>
+    </xs:simpleType>
+    <xs:element name="duration" nillable="true" type="tns:duration"/>
+    <xs:simpleType name="duration">
+        <xs:restriction base="xs:duration">
+            <xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/>
+            <xs:minInclusive value="-P10675199DT2H48M5.4775808S"/>
+            <xs:maxInclusive value="P10675199DT2H48M5.4775807S"/>
+        </xs:restriction>
+    </xs:simpleType>
+    <xs:element name="guid" nillable="true" type="tns:guid"/>
+    <xs:simpleType name="guid">
+        <xs:restriction base="xs:string">
+            <xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/>
+        </xs:restriction>
+    </xs:simpleType>
+    <xs:attribute name="FactoryType" type="xs:QName"/>
+    <xs:attribute name="Id" type="xs:ID"/>
+    <xs:attribute name="Ref" type="xs:IDREF"/>
+</xs:schema>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd2.xsd
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd2.xsd?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd2.xsd (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/etc/xsd2.xsd Thu Jun  4 07:04:21 2009
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema elementFormDefault="qualified" targetNamespace="http://trade.samples.websphere.ibm.com"
+           xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://trade.samples.websphere.ibm.com">
+    <xs:complexType name="OrderDataBean">
+        <xs:sequence>
+            <xs:element minOccurs="0" name="orderID" type="xs:int"/>
+            <xs:element minOccurs="0" name="orderType" nillable="true" type="xs:string"/>
+            <xs:element minOccurs="0" name="orderStatus" nillable="true" type="xs:string"/>
+            <xs:element minOccurs="0" name="openDate" type="xs:dateTime"/>
+            <xs:element minOccurs="0" name="completionDate" type="xs:dateTime"/>
+            <xs:element minOccurs="0" name="quantity" type="xs:double"/>
+            <xs:element minOccurs="0" name="price" type="xs:decimal"/>
+            <xs:element minOccurs="0" name="orderFee" type="xs:decimal"/>
+            <xs:element minOccurs="0" name="symbol" nillable="true" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:element name="OrderDataBean" nillable="true" type="tns:OrderDataBean"/>
+</xs:schema>
\ No newline at end of file

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/commons/commons-logging-1.1.1.jar
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/commons/commons-logging-1.1.1.jar?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/commons/commons-logging-1.1.1.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/log4j/log4j-1.2.15.jar
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/log4j/log4j-1.2.15.jar?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/log4j/log4j-1.2.15.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-api.jar
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-api.jar?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-api.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-extra-api.jar
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-extra-api.jar?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-extra-api.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-extra.jar
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-extra.jar?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-extra.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-rt.jar
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-rt.jar?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-rt.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-tools.jar
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-tools.jar?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/metro/webservices-tools.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/mssql/jtds-1.2.2.jar
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/mssql/jtds-1.2.2.jar?rev=781666&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/metro/order_processor/lib/mssql/jtds-1.2.2.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomHoldingBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomHoldingBean.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomHoldingBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomHoldingBean.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+/**
+ * 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;
+    private int holdingID;
+    private double quantity;
+    private BigDecimal purchasePrice;
+    private Calendar purchaseDate;
+    private 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 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/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomOrderBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomOrderBean.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomOrderBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomOrderBean.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+import com.ibm.websphere.samples.trade.OrderDataBean;
+
+/**
+ * This class is to be used as the data model for order information.
+ */
+public class CustomOrderBean extends OrderDataBean {
+
+	private static final long serialVersionUID = 5294153874232419015L;
+
+	int accountId;
+	int holdingId;
+
+	public CustomOrderBean(OrderDataBean orderDataBean) {
+		setCompletionDate(orderDataBean.getCompletionDate());
+		setOpenDate(orderDataBean.getOpenDate());
+		setOrderFee(orderDataBean.getOrderFee());
+		setOrderID(orderDataBean.getOrderID());
+		setOrderStatus(orderDataBean.getOrderStatus());
+		setOrderType(orderDataBean.getOrderType());
+		setPrice(orderDataBean.getPrice());
+		setQuantity(orderDataBean.getQuantity());
+		setSymbol(orderDataBean.getSymbol());
+	}
+
+	public CustomOrderBean(int orderId, String orderType, String orderStatus,
+			Calendar openDate, Calendar completionDate, double quantity,
+			BigDecimal price, BigDecimal orderFee, String symbol) {
+		setOrderID(orderId);
+		setOrderType(orderType);
+		setOrderStatus(orderStatus);
+		setOpenDate(openDate);
+		setCompletionDate(completionDate);
+		setQuantity(quantity);
+		setPrice(price);
+		setOrderFee(orderFee);
+		setSymbol(symbol);
+	}
+
+	/**
+	 * Constructs data instance for order information.
+	 * 
+	 * @param accountId
+	 *            the account ID of the buyer or seller
+	 * @param holdingId
+	 *            the ID of corresponding holding of the order
+	 */
+	public CustomOrderBean(int accountId, int holdingId) {
+		this.accountId = accountId;
+		this.holdingId = holdingId;
+	}
+
+	public int getAccountId() {
+		return accountId;
+	}
+
+	public void setAccountId(int accountId) {
+		this.accountId = accountId;
+	}
+
+	public int getHoldingId() {
+		return holdingId;
+	}
+
+	public void setHoldingId(int holdingId) {
+		this.holdingId = holdingId;
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomQuoteBean.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomQuoteBean.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomQuoteBean.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/CustomQuoteBean.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader;
+
+import java.math.BigDecimal;
+
+/**
+ * This class to be used as the data model for quote information.
+ */
+public class CustomQuoteBean {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 7129349720689180586L;
+
+    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 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;
+    }
+
+    public CustomQuoteBean() {
+	}
+
+	/**
+	 * Constructs an instance for quote information.
+	 * 
+	 * @param symbol
+	 * @param companyName
+	 * @param volume
+	 * @param price
+	 * @param open
+	 * @param low
+	 * @param high
+	 * @param change
+	 */
+	public CustomQuoteBean(String symbol, String companyName, double volume,
+			BigDecimal price, BigDecimal open, BigDecimal low, BigDecimal high,
+			double change) {
+		setSymbol(symbol);
+		setCompanyName(companyName);
+		setVolume(volume);
+		setPrice(price);
+		setOpen(open);
+		setLow(low);
+		setHigh(high);
+		setChange(change);
+	}
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/CustomerDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/CustomerDAO.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/CustomerDAO.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/CustomerDAO.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.dal;
+
+import java.math.BigDecimal;
+import org.wso2.stocktrader.CustomHoldingBean;
+
+public interface CustomerDAO {
+
+	public CustomHoldingBean getHoldingForUpdate(int orderId)
+			throws DAOException;
+
+    public void updateAccountBalance(int accountId, BigDecimal total)
+			throws DAOException;
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/DAOException.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/DAOException.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/DAOException.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/DAOException.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.dal;
+
+public class DAOException extends Exception {
+
+	private static final long serialVersionUID = -3206469251941804179L;
+
+	public DAOException(String message) {
+		super(message);
+	}
+
+	public DAOException(String message, Throwable throwable) {
+		super(message, throwable);
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/DAOFactory.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/DAOFactory.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/DAOFactory.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/DAOFactory.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.dal;
+
+import org.wso2.stocktrader.mssql.MSSQLDAOFactory;
+
+public abstract class DAOFactory {
+	public static final int MS_SQL_FACTORY = 1;
+
+	public abstract CustomerDAO getCustomerDAO() throws DAOException;
+	public abstract MarketSummaryDAO getMarketSummaryDAO() throws DAOException;
+	public abstract OrderDAO getOrderDAO() throws DAOException;
+
+	public static DAOFactory getFacotry(int type) {
+		switch (type) {
+		case MS_SQL_FACTORY:
+			DAOFactory factory = MSSQLDAOFactory.getInstance();
+			return factory;
+		default:
+			throw new IllegalArgumentException("Unknown Database type " + type);
+		}
+	}
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/MarketSummaryDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/MarketSummaryDAO.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/MarketSummaryDAO.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/MarketSummaryDAO.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.dal;
+
+import org.wso2.stocktrader.CustomQuoteBean;
+
+public interface MarketSummaryDAO {
+
+    public CustomQuoteBean getQuoteForUpdate(String symbol) throws DAOException;
+
+    public void updateStockPriceVolume(double quantity, CustomQuoteBean quote)
+            throws DAOException;
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/OrderDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/OrderDAO.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/OrderDAO.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/dal/OrderDAO.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.dal;
+
+import java.math.BigDecimal;
+
+import org.wso2.stocktrader.CustomHoldingBean;
+import org.wso2.stocktrader.CustomOrderBean;
+import org.wso2.stocktrader.CustomQuoteBean;
+
+public interface OrderDAO {
+
+	public CustomQuoteBean getQuoteForUpdate(String symbol) throws DAOException;
+
+	public int createHolding(CustomOrderBean order) throws DAOException;
+
+	public void updateHolding(int holdingId, double quantity)
+			throws DAOException;
+
+	public void deleteHolding(int holdingId) throws DAOException;
+
+	public CustomHoldingBean getHoldingForUpdate(int orderId)
+			throws DAOException;
+
+	public void updateAccountBalance(int accountId, BigDecimal total)
+			throws DAOException;
+
+	public void updateOrder(CustomOrderBean order) throws DAOException;
+
+	public void updateStockPriceVolume(double quantity, CustomQuoteBean quote)
+			throws DAOException;
+
+	public void closeOrder(CustomOrderBean order) throws DAOException;
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/AbstractMSSQLDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/AbstractMSSQLDAO.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/AbstractMSSQLDAO.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/AbstractMSSQLDAO.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.mssql;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.stocktrader.dal.DAOException;
+
+public class AbstractMSSQLDAO {
+
+	private static final Log logger = LogFactory.getLog(AbstractMSSQLDAO.class);
+
+	protected Connection sqlConnection;
+
+	private int previousTransactionIsolation;
+
+	public AbstractMSSQLDAO(Connection sqlConnection) throws DAOException {
+		this.sqlConnection = sqlConnection;
+	}
+
+	public void beginTransaction() throws DAOException {
+		logger.debug("AbstractMSSQLDAO.beginTransaction()");
+		try {
+			sqlConnection.setAutoCommit(false);
+			previousTransactionIsolation = sqlConnection
+					.getTransactionIsolation();
+			sqlConnection
+					.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
+		} catch (SQLException e) {
+			e.printStackTrace();
+			logger.debug("", e);
+			throw new DAOException(
+					"Exception was thrown during the start of transaction", e);
+		}
+	}
+
+	public void commitTransaction() throws DAOException {
+		logger.debug("AbstractMSSQLDAO.commitTransaction()");
+		try {
+			sqlConnection.commit();
+			sqlConnection.setAutoCommit(true);
+			sqlConnection.setTransactionIsolation(previousTransactionIsolation);
+		} catch (SQLException e) {
+			throw new DAOException(
+					"Exception is thrown during the commit of transaction", e);
+		}
+	}
+
+	public void rollbackTransaction() throws DAOException {
+		logger.debug("AbstractMSSQLDAO.rollbackTransaction()");
+		try {
+			sqlConnection.rollback();
+			sqlConnection.setAutoCommit(true);
+			sqlConnection.setTransactionIsolation(previousTransactionIsolation);
+		} catch (SQLException e) {
+			throw new DAOException(
+					"Exception is thrown during the rollback of transaction", e);
+
+		}
+	}
+
+	public void close() throws DAOException {
+		try {
+			sqlConnection.close();
+		} catch (SQLException e) {
+			throw new DAOException("", e);
+		}
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLCustomerDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLCustomerDAO.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLCustomerDAO.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLCustomerDAO.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.mssql;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.stocktrader.CustomHoldingBean;
+import org.wso2.stocktrader.dal.CustomerDAO;
+import org.wso2.stocktrader.dal.DAOException;
+import org.wso2.stocktrader.util.StockTraderUtility;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public class MSSQLCustomerDAO extends AbstractMSSQLDAO implements CustomerDAO {
+    private static final Log logger = LogFactory.getLog(MSSQLCustomerDAO.class);
+
+    private static final String SQL_DEBIT_ACCOUNT = "UPDATE dbo.ACCOUNT WITH (ROWLOCK) SET BALANCE=(BALANCE-?) WHERE ACCOUNTID=?";
+    private static final String SQL_SELECT_HOLDING_LOCK = "Set NOCOUNT ON; SELECT dbo.HOLDING.ACCOUNT_ACCOUNTID, HOLDING.HOLDINGID, HOLDING.QUANTITY, HOLDING.PURCHASEPRICE, HOLDING.PURCHASEDATE, HOLDING.QUOTE_SYMBOL FROM dbo.HOLDING WITH (ROWLOCK) INNER JOIN ORDERS ON HOLDING.HOLDINGID = ORDERS.HOLDING_HOLDINGID WHERE (ORDERS.ORDERID = ?)";
+
+    public MSSQLCustomerDAO(Connection sqlConnection) throws DAOException {
+        super(sqlConnection);
+    }
+
+    public CustomHoldingBean getHoldingForUpdate(int orderId)
+            throws DAOException {
+        if (logger.isDebugEnabled()) {
+            logger
+                    .debug("MSSQLCustomerDAO.getHoldingForUpdate(int)\nOrder ID :"
+                            + orderId);
+        }
+
+        CustomHoldingBean holding = null;
+        PreparedStatement selectHoldingLockStat = null;
+        try {
+            selectHoldingLockStat = sqlConnection
+                    .prepareStatement(SQL_SELECT_HOLDING_LOCK);
+            selectHoldingLockStat.setInt(1, orderId);
+            ResultSet rs = selectHoldingLockStat.executeQuery();
+            if (rs.next()) {
+                try {
+                    holding = new CustomHoldingBean(
+                            rs.getInt(1),
+                            rs.getInt(2),
+                            rs.getDouble(3),
+                            rs.getBigDecimal(4),
+                            StockTraderUtility.convertToCalendar(rs.getDate(5)),
+                            rs.getString(6));
+                    return holding;
+                } finally {
+                    try {
+                        rs.close();
+                    } catch (SQLException e) {
+                        logger.debug("", e);
+                    }
+                }
+            }
+        } catch (SQLException e) {
+            throw new DAOException(
+                    "Exception is thrown when selecting the holding entry for order ID :"
+                            + orderId, e);
+        } finally {
+            if (selectHoldingLockStat != null) {
+                try {
+                    selectHoldingLockStat.close();
+                } catch (SQLException e) {
+                    logger.debug("", e);
+                }
+            }
+        }
+        return holding;
+    }
+
+    public void updateAccountBalance(int accountId, BigDecimal total)
+            throws DAOException {
+        if (logger.isDebugEnabled()) {
+            logger
+                    .debug("MSSQLCustomerDAO.updateAccoutBalance(int,BigDecimal)\n Account ID :"
+                            + accountId + "\nTotal :" + total);
+        }
+        PreparedStatement debitAccountStat = null;
+        try {
+            debitAccountStat = sqlConnection
+                    .prepareStatement(SQL_DEBIT_ACCOUNT);
+            debitAccountStat.setBigDecimal(1, total);
+            debitAccountStat.setInt(2, accountId);
+            debitAccountStat.executeUpdate();
+
+        } catch (SQLException e) {
+            throw new DAOException(
+                    "Excpetion is thrown when updating the account balance for accountID :"
+                            + accountId + " total :" + total, e);
+        } finally {
+            if (debitAccountStat != null) {
+                try {
+                    debitAccountStat.close();
+                } catch (SQLException e) {
+                    logger.debug("", e);
+                }
+            }
+        }
+    }
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLDAOFactory.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLDAOFactory.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLDAOFactory.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLDAOFactory.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,181 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.mssql;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.stocktrader.dal.CustomerDAO;
+import org.wso2.stocktrader.dal.DAOException;
+import org.wso2.stocktrader.dal.DAOFactory;
+import org.wso2.stocktrader.dal.MarketSummaryDAO;
+import org.wso2.stocktrader.dal.OrderDAO;
+import org.wso2.stocktrader.util.StockTraderUtility;
+
+public class MSSQLDAOFactory extends DAOFactory {
+	public static final String PROP_MSSQL_DB_HOST = "org.wso2.stocktrader.mssql.MSSQLDAOFactory.host";
+	public static final String PROP_MSSQL_DB_PORT = "org.wso2.stocktrader.mssql.MSSQLDAOFactory.port";
+	public static final String PROP_MSSQL_DB_NAME = "org.wso2.stocktrader.mssql.MSSQLDAOFactory.db";
+	public static final String PROP_MSSQL_DB_USER = "org.wso2.stocktrader.mssql.MSSQLDAOFactory.user";
+	public static final String PROP_MSSQL_PASSWORD = "org.wso2.stocktrader.mssql.MSSQLDAOFactory.password";
+
+	private static Log logger = LogFactory.getLog(MSSQLDAOFactory.class);
+	private static MSSQLDAOFactory self = null;
+
+	private Properties prop = null;
+	private Connection sqlConnection = null;
+
+	private String connection = null;
+
+	static {
+		try {
+			Class.forName("net.sourceforge.jtds.jdbc.Driver");
+		} catch (ClassNotFoundException e) {
+			logger.warn("Unable to load DBDrive class", e);
+		}
+	}
+
+	public static DAOFactory getInstance() {
+		if (self == null) {
+			self = new MSSQLDAOFactory();
+		}
+		return self;
+	}
+
+	private MSSQLDAOFactory() {
+	}
+
+	public OrderDAO getOrderDAO() throws DAOException {
+		logger.debug("MSSQLDAOFactory.getOrderDAO");
+		try {
+			OrderDAO orderDAO = new MSSQLOrderDAO(getConnection());
+			return orderDAO;
+		} catch (SQLException e) {
+			logger.debug("", e);
+			throw new DAOException(
+					"Exception was thrown when instantiating MSSQLOrderDAO object",
+					e);
+		}
+	}
+
+	public CustomerDAO getCustomerDAO() throws DAOException {
+		logger.debug("MSSQLDAOFactory.getOrderDAO");
+		try {
+			CustomerDAO customerDAO = new MSSQLCustomerDAO(getConnection());
+			return customerDAO;
+		} catch (SQLException e) {
+			logger.debug("", e);
+			throw new DAOException(
+					"Exception was thrown when instantiating a MSSQLCustomerDAO",
+					e);
+		}
+	}
+
+	public MarketSummaryDAO getMarketSummaryDAO() throws DAOException {
+		logger.debug("MSSQLDAOFactory.getOrderDAO");
+		try {
+			MarketSummaryDAO marketSummaryDAO = new MSSQLMarketSummaryDAO(
+					getConnection());
+			return marketSummaryDAO;
+		} catch (SQLException e) {
+			logger.debug("", e);
+			throw new DAOException(
+					"Exception was thrown when instantiating a MarketSummaryDAO",
+					e);
+		}
+	}
+
+	private String getConnectionString() {
+		if (connection == null) {
+			prop = new Properties();
+//			MessageContext messageContext = MessageContext
+//					.getCurrentMessageContext();
+//			if (messageContext != null) {
+//				AxisService service = messageContext.getAxisService();
+//				ClassLoader serviceClassLoader = service.getClassLoader();
+//				InputStream is = serviceClassLoader
+//						.getResourceAsStream(StockTraderUtility.MSSQL_DB_PROPERRTIES_FILE);
+//				if (is != null) {
+//					try {
+//						prop.load(is);
+//					} catch (IOException e) {
+//						logger
+//								.debug(
+//										"Unable to load mssql-db properties file and using [jdbc:jtds:sqlserver://highlander:1433/StockTraderDB;user=trade;password=trade;] as the default connection",
+//										e);
+//					}
+//				} else {
+//					logger
+//							.debug("Unable to load mssql-db properties file and using [jdbc:jtds:sqlserver://highlander:1433/StockTraderDB;user=trade;password=trade;] as the default connection");
+//
+//				}
+//			}
+
+            InputStream is = getClass().getClassLoader()
+                    .getResourceAsStream(StockTraderUtility.MSSQL_DB_PROPERRTIES_FILE);
+            if (is != null) {
+                try {
+                    prop.load(is);
+                } catch (IOException e) {
+                    logger
+                            .debug(
+                                    "Unable to load mssql-db properties file and using [jdbc:jtds:sqlserver://highlander:1433/StockTraderDB;user=trade;password=trade;] as the default connection",
+                                    e);
+                }
+            } else {
+                logger
+                        .debug("Unable to load mssql-db properties file and using [jdbc:jtds:sqlserver://highlEander:1433/StockTraderDB;user=trade;password=trade;] as the default connection");
+
+            }
+
+			if (prop.size() <= 0) {
+                //TODO: highlEander for localhost
+				connection = "jdbc:jtds:sqlserver://localhost:1433/StockTraderDB;user=trade;password=trade";
+			} else {
+				StringBuffer buf = new StringBuffer();
+				buf.append("jdbc:jtds:sqlserver://");
+				buf.append(prop.getProperty(PROP_MSSQL_DB_HOST));
+				buf.append(":" + prop.getProperty(PROP_MSSQL_DB_PORT));
+				buf.append("/" + prop.getProperty(PROP_MSSQL_DB_NAME));
+				buf.append(";user=" + prop.getProperty(PROP_MSSQL_DB_USER));
+				buf.append(";password=" + prop.getProperty(PROP_MSSQL_PASSWORD));
+				buf.append(";");
+				connection = buf.toString();
+			}
+		}
+
+		if (logger.isDebugEnabled()) {
+			logger.debug("MSSQLDAOFactory.getConnectionString()\nConnection :"
+					+ connection);
+		}
+		return connection;
+	}
+
+	private Connection getConnection() throws SQLException {
+		if (sqlConnection == null || sqlConnection.isClosed()) {
+			sqlConnection = DriverManager.getConnection(getConnectionString());
+		}
+		return sqlConnection;
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLMarketSummaryDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLMarketSummaryDAO.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLMarketSummaryDAO.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLMarketSummaryDAO.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.wso2.stocktrader.mssql;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.stocktrader.CustomQuoteBean;
+import org.wso2.stocktrader.dal.DAOException;
+import org.wso2.stocktrader.dal.MarketSummaryDAO;
+import org.wso2.stocktrader.util.StockTraderUtility;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public class MSSQLMarketSummaryDAO extends AbstractMSSQLDAO implements
+        MarketSummaryDAO {
+    private static final Log logger = LogFactory
+            .getLog(MSSQLMarketSummaryDAO.class);
+
+    private static final String SQL_SELECT_QUOTE = "Set NOCOUNT ON; SELECT symbol, companyname, volume, price, open1, low, high, change1 from dbo.quote with (ROWLOCK) where symbol = ?";
+    private static final String SQL_UPDATE_STOCKPRICEVOLUME = "UPDATE dbo.QUOTE WITH (ROWLOCK) SET PRICE=?, Low=?, High=?, Change1=?-open1, VOLUME=VOLUME+? WHERE SYMBOL=?";
+
+    public MSSQLMarketSummaryDAO(Connection sqlConnection) throws DAOException {
+        super(sqlConnection);
+    }
+
+    public CustomQuoteBean getQuoteForUpdate(String symbol) throws DAOException {
+        if (logger.isDebugEnabled()) {
+            logger.debug("MarketSummaryDAO.getQouteForUpdate(String)\nSymbol :"
+                    + symbol);
+        }
+        PreparedStatement qouteForUpdateStat = null;
+        try {
+            qouteForUpdateStat = sqlConnection
+                    .prepareStatement(SQL_SELECT_QUOTE);
+            CustomQuoteBean quote = null;
+
+            qouteForUpdateStat.setString(1, symbol);
+            ResultSet rs = qouteForUpdateStat.executeQuery();
+
+            if (rs.next()) {
+                quote = new CustomQuoteBean(rs.getString(1), rs.getString(2),
+                        rs.getDouble(3), rs.getBigDecimal(4), rs
+                                .getBigDecimal(5), rs.getBigDecimal(6), rs
+                                .getBigDecimal(7), rs.getDouble(8));
+
+                try {
+                    rs.close();
+                } catch (SQLException e) {
+                    logger.debug("", e);
+                }
+                return quote;
+            } else {
+                throw new DAOException("No quote entry found");
+            }
+        } catch (SQLException e) {
+            throw new DAOException("", e);
+        } finally {
+            try {
+                if (qouteForUpdateStat != null) {
+                    qouteForUpdateStat.close();
+                }
+            } catch (SQLException e) {
+                logger.debug("", e);
+            }
+        }
+    }
+
+    public void updateStockPriceVolume(double quantity, CustomQuoteBean quote)
+            throws DAOException {
+        BigDecimal priceChangeFactor = StockTraderUtility
+                .getRandomPriceChangeFactor(quote.getPrice());
+        BigDecimal newPrice = quote.getPrice().multiply(priceChangeFactor);
+
+        if (newPrice.compareTo(quote.getLow()) == -1) {
+            quote.setLow(newPrice);
+        }
+        if (newPrice.compareTo(quote.getHigh()) == 1) {
+            quote.setHigh(newPrice);
+        }
+
+        PreparedStatement updateStockPriceVolumeStat = null;
+        try {
+            updateStockPriceVolumeStat = sqlConnection
+                    .prepareStatement(SQL_UPDATE_STOCKPRICEVOLUME);
+            updateStockPriceVolumeStat.setBigDecimal(1, newPrice);
+            updateStockPriceVolumeStat.setBigDecimal(2, quote.getLow());
+            updateStockPriceVolumeStat.setBigDecimal(3, quote.getHigh());
+            updateStockPriceVolumeStat.setBigDecimal(4, newPrice);
+            updateStockPriceVolumeStat.setFloat(5, (float) quantity);
+            updateStockPriceVolumeStat.setString(6, quote.getSymbol());
+            updateStockPriceVolumeStat.executeUpdate();
+
+        } catch (SQLException e) {
+            throw new DAOException("", e);
+        } finally {
+            try {
+                if (updateStockPriceVolumeStat != null) {
+                    updateStockPriceVolumeStat.close();
+                }
+            } catch (SQLException e) {
+                logger.debug("", e);
+            }
+        }
+    }
+
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLOrderDAO.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLOrderDAO.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLOrderDAO.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/mssql/MSSQLOrderDAO.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.mssql;
+
+import java.math.BigDecimal;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Types;
+import java.util.Calendar;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.stocktrader.CustomHoldingBean;
+import org.wso2.stocktrader.CustomOrderBean;
+import org.wso2.stocktrader.CustomQuoteBean;
+import org.wso2.stocktrader.dal.CustomerDAO;
+import org.wso2.stocktrader.dal.DAOException;
+import org.wso2.stocktrader.dal.DAOFactory;
+import org.wso2.stocktrader.dal.MarketSummaryDAO;
+import org.wso2.stocktrader.dal.OrderDAO;
+import org.wso2.stocktrader.util.StockTraderUtility;
+
+public class MSSQLOrderDAO extends AbstractMSSQLDAO implements OrderDAO {
+	private static Log logger = LogFactory.getLog(MSSQLOrderDAO.class);
+
+	private static final String SQL_GET_ACCOUNTID_ORDER = "Set NOCOUNT ON; SELECT ACCOUNT_ACCOUNTID FROM dbo.ORDERS  WITH (NOLOCK) WHERE ORDERID=?";
+	private static final String SQL_INSERT_HOLDING = "INSERT INTO dbo.HOLDING (PURCHASEPRICE, QUANTITY, PURCHASEDATE, ACCOUNT_ACCOUNTID, QUOTE_SYMBOL) VALUES (?, ?, ?, ?, ?); SELECT ID=@@IDENTITY";
+	private static final String SQL_UPDATE_HOLDING = "UPDATE dbo.HOLDING WITH (ROWLOCK) SET QUANTITY=QUANTITY-? WHERE HOLDINGID=?";
+	private static final String SQL_DELETE_HOLDING = "DELETE FROM dbo.HOLDING WITH (ROWLOCK) WHERE HOLDINGID=?";
+	private static final String SQL_SELECT_HOLDING = "SELECT HOLDING.HOLDINGID, HOLDING.QUANTITY, HOLDING.PURCHASEPRICE, HOLDING.PURCHASEDATE, HOLDING.QUOTE_SYMBOL,HOLDING.ACCOUNT_ACCOUNTID FROM dbo.HOLDING WITH (NOLOCK) WHERE HOLDINGID= ?";
+	private static final String SQL_UPDATE_ORDER = "UPDATE dbo.ORDERS WITH (ROWLOCK) SET QUANTITY=? WHERE ORDERID=?";
+	private static final String SQL_CLOSE_ORDER = "UPDATE dbo.ORDERS WITH (ROWLOCK) SET ORDERSTATUS = ?, COMPLETIONDATE=GetDate(), HOLDING_HOLDINGID=?, PRICE=? WHERE ORDERID = ?";
+	private static final String SQL_GET_ACCOUNTID = "Set NOCOUNT ON; SELECT ACCOUNTID FROM dbo.ACCOUNT  WITH (NOLOCK) WHERE PROFILE_USERID = ?";
+
+	// CHECKME
+	private static final String SQL_INSERT_ORDER = "INSERT INTO dbo.ORDERS (OPENDATE, ORDERFEE, PRICE, QUOTE_SYMBOL, QUANTITY, ORDERTYPE, ORDERSTATUS, ACCOUNT_ACCOUNTID, HOLDING_HOLDINGID) VALUES (GetDate(), ?, ?, ?, ?, ?, 'open', ?, ?); SELECT ID=@@IDENTITY";
+
+	public MSSQLOrderDAO(Connection sqlConnection) throws DAOException {
+		super(sqlConnection);
+	}
+
+	public CustomQuoteBean getQuoteForUpdate(String symbol) throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger.debug("OrderDAO.getQuoteForUpdate()\nSymbol :" + symbol);
+		}
+
+		DAOFactory fac = MSSQLDAOFactory.getInstance();
+		MarketSummaryDAO marketSummaryDAO = fac.getMarketSummaryDAO();
+		return marketSummaryDAO.getQuoteForUpdate(symbol);
+	}
+
+	public int createHolding(CustomOrderBean order) throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger.debug("OrderDAO.createHolding(OrderDataModel)\nOrderID :"
+					+ order.getOrderID() + "\nOrderType :"
+					+ order.getOrderType() + "\nSymbol :" + order.getSymbol()
+					+ "\nQuantity :" + order.getQuantity() + "\nOrder Status :"
+					+ order.getOrderStatus() + "\nOrder Open Date :"
+					+ order.getOpenDate() + "\nCompletionDate :"
+					+ order.getCompletionDate());
+		}
+
+		PreparedStatement getAccountIdStat = null;
+		int accountId = -1;
+
+		try {
+			getAccountIdStat = sqlConnection
+					.prepareStatement(SQL_GET_ACCOUNTID_ORDER);
+			getAccountIdStat.setInt(1, order.getOrderID());
+
+			ResultSet rs = getAccountIdStat.executeQuery();
+			if (rs.next()) {
+				accountId = Integer.parseInt(rs.getString(1));
+				order.setAccountId(accountId);
+			}
+
+			try {
+				rs.close();
+			} catch (Exception e) {
+				logger.debug("", e);
+			}
+		} catch (SQLException e) {
+			throw new DAOException(
+					"Exception is thrown when selecting the accountID from order entries where order ID :"
+							+ order.getOrderID(), e);
+
+		} finally {
+			if (getAccountIdStat != null) {
+				try {
+					getAccountIdStat.close();
+				} catch (Exception e) {
+					logger.debug("", e);
+				}
+			}
+		}
+
+		if (accountId != -1) {
+			int holdingId = -1;
+			PreparedStatement insertHoldingStat = null;
+
+			try {
+				insertHoldingStat = sqlConnection
+						.prepareStatement(SQL_INSERT_HOLDING);
+				insertHoldingStat.setBigDecimal(1, order.getPrice());
+				// C# - insertHolding.setFloat(1, (float) order.getQuantity());
+				insertHoldingStat.setDouble(2, order.getQuantity());
+				Calendar openDate = (order.getOpenDate() != null) ? order
+						.getOpenDate() : Calendar.getInstance();
+				insertHoldingStat.setDate(3, StockTraderUtility
+						.convertToSqlDate(openDate));
+				insertHoldingStat.setInt(4, order.getAccountId());
+				insertHoldingStat.setString(5, order.getSymbol());
+
+				ResultSet rs = insertHoldingStat.executeQuery();
+				if (rs.next()) {
+					holdingId = rs.getInt(1);
+				}
+
+				try {
+					rs.close();
+				} catch (Exception e) {
+					logger.debug("", e);
+				}
+				return holdingId;
+
+			} catch (SQLException e) {
+				throw new DAOException(
+						"An exception is thrown during an insertion of a holding entry",
+						e);
+
+			} finally {
+				if (insertHoldingStat != null) {
+					try {
+						insertHoldingStat.close();
+					} catch (Exception e) {
+						logger.debug("", e);
+					}
+				}
+			}
+		}
+		return -1;
+	}
+
+	public void updateHolding(int holdingId, double quantity)
+			throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger.debug("OrderDAO.updateHolding()\nHolding ID :" + holdingId
+					+ "\nQuantity :" + quantity);
+		}
+
+		PreparedStatement updateHoldingStat = null;
+		try {
+			updateHoldingStat = sqlConnection
+					.prepareStatement(SQL_UPDATE_HOLDING);
+			updateHoldingStat.setDouble(1, quantity);
+			updateHoldingStat.setInt(2, holdingId);
+			updateHoldingStat.executeUpdate();
+
+		} catch (SQLException e) {
+			throw new DAOException(
+					"An exception is thrown during an updation of holding entry",
+					e);
+		} finally {
+			if (updateHoldingStat != null) {
+				try {
+					updateHoldingStat.close();
+				} catch (Exception e) {
+					logger.debug("", e);
+				}
+			}
+		}
+	}
+
+	public void deleteHolding(int holdingId) throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger.debug("OrderDAO.deleteHolding()\nHolding ID :" + holdingId);
+		}
+
+		PreparedStatement deleteHoldingStat = null;
+		try {
+			deleteHoldingStat = sqlConnection
+					.prepareStatement(SQL_DELETE_HOLDING);
+			deleteHoldingStat.setInt(1, holdingId);
+			deleteHoldingStat.execute();
+
+		} catch (SQLException e) {
+			throw new DAOException(
+					"An exception is thrown during deletion of a holding entry",
+					e);
+		} finally {
+			if (deleteHoldingStat != null) {
+				try {
+					deleteHoldingStat.close();
+				} catch (SQLException e) {
+					logger.debug("", e);
+				}
+			}
+		}
+	}
+
+	public CustomHoldingBean getHoldingForUpdate(int orderId)
+			throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger.debug("HoldingDataModel.getHoldingForUpdate()\nOrder ID :"
+					+ orderId);
+		}
+		DAOFactory fac = MSSQLDAOFactory.getInstance();
+		CustomerDAO customerDAO = fac.getCustomerDAO();
+		return customerDAO.getHoldingForUpdate(orderId);
+	}
+
+	public void updateAccountBalance(int accountId, BigDecimal total)
+			throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger
+					.debug("OrderDAO.updateAccountBalance(int,BigDecimal)\nAccount ID :"
+							+ accountId + "\nTotal :" + total);
+		}
+		DAOFactory fac = MSSQLDAOFactory.getInstance();
+		CustomerDAO customerDAO = fac.getCustomerDAO();
+		customerDAO.updateAccountBalance(accountId, total);
+	}
+
+	public void updateStockPriceVolume(double quantity, CustomQuoteBean quote)
+			throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger
+					.debug("OrderDAO.updateStockPriceVolume(double,QuatedataModle)\nQuantity :"
+							+ quantity + "\nQuote\nSymbol" + quote.getSymbol());
+		}
+		DAOFactory fac = MSSQLDAOFactory.getInstance();
+		MarketSummaryDAO marketSummaryDAO = fac.getMarketSummaryDAO();
+		marketSummaryDAO.updateStockPriceVolume(quantity, quote);
+	}
+
+	public void updateOrder(CustomOrderBean order) throws DAOException {
+		PreparedStatement updateHoldingStat = null;
+		try {
+			updateHoldingStat = sqlConnection
+					.prepareStatement(SQL_UPDATE_ORDER);
+			updateHoldingStat.setDouble(1, order.getQuantity());
+			updateHoldingStat.setInt(2, order.getOrderID());
+			updateHoldingStat.executeUpdate();
+
+		} catch (SQLException e) {
+			throw new DAOException(
+					"An Exception is thrown during updating a holding entry", e);
+		} finally {
+			if (updateHoldingStat != null) {
+				try {
+					updateHoldingStat.close();
+				} catch (Exception e) {
+					logger.debug("", e);
+				}
+			}
+		}
+	}
+
+	public void closeOrder(CustomOrderBean order) throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger.debug("OrderDAO.closeOrder(OrderDataModel)\nOrderID :"
+					+ order.getOrderID() + "\nOrderType :"
+					+ order.getOrderType() + "\nSymbol :" + order.getSymbol()
+					+ "\nQuantity :" + order.getQuantity() + "\nOrder Status :"
+					+ order.getOrderStatus() + "\nOrder Open Date :"
+					+ order.getOpenDate() + "\nCompletionDate :"
+					+ order.getCompletionDate());
+		}
+
+		PreparedStatement closeOrderStat = null;
+		try {
+			closeOrderStat = sqlConnection.prepareStatement(SQL_CLOSE_ORDER);
+			closeOrderStat.setString(1, StockTraderUtility.ORDER_STATUS_CLOSED);
+			if (StockTraderUtility.ORDER_TYPE_SELL.equals(order.getOrderType())) {
+				closeOrderStat.setNull(2, Types.INTEGER);
+			} else {
+				closeOrderStat.setInt(2, order.getHoldingId());
+			}
+			closeOrderStat.setBigDecimal(3, order.getPrice());
+			closeOrderStat.setInt(4, order.getOrderID());
+			closeOrderStat.executeUpdate();
+
+		} catch (SQLException e) {
+			throw new DAOException("", e);
+
+		} finally {
+			if (closeOrderStat != null) {
+				try {
+					closeOrderStat.close();
+				} catch (Exception e) {
+					logger.debug("", e);
+				}
+			}
+		}
+	}
+}

Added: incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/service/OrderProcessManager.java
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/service/OrderProcessManager.java?rev=781666&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/service/OrderProcessManager.java (added)
+++ incubator/stonehenge/contrib/stocktrader/metro/order_processor/src/org/wso2/stocktrader/service/OrderProcessManager.java Thu Jun  4 07:04:21 2009
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.wso2.stocktrader.service;
+
+import java.math.BigDecimal;
+import java.util.Calendar;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.wso2.stocktrader.CustomHoldingBean;
+import org.wso2.stocktrader.CustomOrderBean;
+import org.wso2.stocktrader.CustomQuoteBean;
+import org.wso2.stocktrader.dal.DAOException;
+import org.wso2.stocktrader.dal.DAOFactory;
+import org.wso2.stocktrader.mssql.MSSQLOrderDAO;
+import org.wso2.stocktrader.util.StockTraderUtility;
+
+public class OrderProcessManager {
+	private static final Log logger = LogFactory
+			.getLog(OrderProcessManager.class);
+
+	private MSSQLOrderDAO orderDAO = null;
+
+	public void processAndCompleteOrder(CustomOrderBean order)
+			throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger
+					.debug("ProcessOrder.processAndCompleteOrder(OrderDataModel) \nOrderID :"
+							+ order.getOrderID()
+							+ "\nOrderType :"
+							+ order.getOrderType()
+							+ "\nSymbol :"
+							+ order.getSymbol()
+							+ "\nQuantity :"
+							+ order.getQuantity()
+							+ "\nOrder Status :"
+							+ order.getOrderStatus()
+							+ "\nOrder Open Date :"
+							+ order.getOpenDate()
+							+ "\nCompletionDate :"
+							+ order.getCompletionDate());
+		}
+
+		try {
+			DAOFactory factory = DAOFactory
+					.getFacotry(DAOFactory.MS_SQL_FACTORY);
+
+			orderDAO = (MSSQLOrderDAO) factory.getOrderDAO();
+			orderDAO.beginTransaction();
+
+			BigDecimal total = null;
+			int holdingId = -1;
+
+			CustomQuoteBean quote = orderDAO.getQuoteForUpdate(order.getSymbol());
+			if (quote == null) {
+				if (logger.isDebugEnabled()) {
+					logger
+							.debug("Unable to locate a quote entry for the symbol :"
+									+ order.getSymbol());
+				}
+				return;
+			}
+
+			order.setPrice(quote.getPrice());
+
+			if (StockTraderUtility.ORDER_TYPE_BUY.equals(order.getOrderType())) {
+				holdingId = orderDAO.createHolding(order);
+				BigDecimal orderQuantity = BigDecimal.valueOf(order
+						.getQuantity());
+				BigDecimal orderPrice = order.getPrice();
+				total = orderQuantity.multiply(orderPrice);
+
+				BigDecimal orderFee = order.getOrderFee();
+				if (orderFee != null) {
+					total = total.add(orderFee);
+				}
+
+			} else if (StockTraderUtility.ORDER_TYPE_SELL.equals(order
+					.getOrderType())) {
+				holdingId = sellHolding(order);
+				if (holdingId == -1) {
+					return;
+				}
+
+				BigDecimal orderQuantity = BigDecimal.valueOf(-1
+						* order.getQuantity());
+				BigDecimal orderPrice = order.getPrice();
+				total = orderQuantity.multiply(orderPrice);
+
+				BigDecimal orderFee = order.getOrderFee();
+				if (total != null) {
+					total = total.add(orderFee);
+				}
+			}
+
+			orderDAO.updateAccountBalance(order.getAccountId(), total);
+			orderDAO.updateStockPriceVolume(order.getQuantity(), quote);
+			order.setOrderStatus(StockTraderUtility.ORDER_STATUS_CLOSED);
+			order.setCompletionDate(Calendar.getInstance());
+			order.setHoldingId(holdingId);
+			orderDAO.closeOrder(order);
+			orderDAO.commitTransaction();
+
+		} catch (DAOException e) {
+			try {
+				orderDAO.rollbackTransaction();
+			} catch (DAOException e1) {
+				logger.error("", e1);
+			}
+		} finally {
+			if (orderDAO != null) {
+				try {
+					orderDAO.close();
+				} catch (DAOException e) {
+					logger.error("", e);
+				}
+			}
+		}
+	}
+
+	private int sellHolding(CustomOrderBean order) throws DAOException {
+		if (logger.isDebugEnabled()) {
+			logger.debug("ProcessOrder.sellHolding(OrderDataModel) \nOrderID :"
+					+ order.getOrderID() + "\nOrderType :"
+					+ order.getOrderType() + "\nSymbol :" + order.getSymbol()
+					+ "\nQuantity :" + order.getQuantity() + "\nOrder Status :"
+					+ order.getOrderStatus() + "\nOrder Open Date :"
+					+ order.getOpenDate() + "\nCompletionDate :"
+					+ order.getCompletionDate());
+		}
+
+		CustomHoldingBean holding = orderDAO.getHoldingForUpdate(order.getOrderID());
+
+		if (holding == null) {
+			// TODO : DAOException ..
+			throw new RuntimeException(
+					"Unable to locate a holding entry for orderID :"
+							+ order.getOrderID());
+		}
+		order.setAccountId(holding.getAccountID());
+
+		// There are three distinct business cases here, each needs different
+		// treatment:
+		// a) Quantity requested is less than total shares in the holding --
+		// update holding.
+		// b) Quantity requested is equal to total shares in the holding --
+		// delete holding.
+		// c) Quantity requested is greater than total shares in the holding --
+		// delete holding, update order table.
+
+		if (order.getQuantity() < holding.getQuantity()) {
+			orderDAO.updateHolding(holding.getHoldingID(), order.getQuantity());
+
+		} else if (holding.getQuantity() == order.getQuantity()) {
+			orderDAO.deleteHolding(holding.getHoldingID());
+
+		} else if (order.getQuantity() > holding.getQuantity()) {
+			// We now need to back-update the order record quantity to reflect
+			// fact not all shares originally requested were sold since the
+			// holding had less shares in it, perhaps due to other orders placed
+			// against that holding that completed before this one. So we will
+			// sell the remaining shares, but need to update the final order to
+			// reflect this.
+			orderDAO.deleteHolding(holding.getHoldingID());
+			order.setQuantity(holding.getQuantity());
+			order.setAccountId(holding.getAccountID());
+			orderDAO.updateOrder(order);
+		}
+		return holding.getHoldingID();
+	}
+}



Mime
View raw message