You are viewing a plain text version of this content. The canonical link for it is here.
Posted to stonehenge-commits@incubator.apache.org by sh...@apache.org on 2008/11/26 10:49:07 UTC

svn commit: r720795 [5/7] - in /incubator/stonehenge/contrib/stocktrader/php: business_service/ business_service/keys/ business_service/wsdl/ config_service/ config_service/wsdl/ order_processor/ order_processor/keys/ trader_client/ trader_client/image...

Added: incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,523 @@
+<?php
+/*
+ * 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.
+ */
+
+ 
+require_once ("data_access_layer.php");
+
+define ("ORDER_TYPE_BUY", "buy");
+define ("ORDER_TYPE_SELL", "sell");
+define ("ORDER_STATUS_CLOSED", "closed");
+define ("STATUS_SUCCESS", 1);	//This represents a success status.
+define ("STATUS_FAILURE", 0);	//This represents a failure status.
+define ("INVALID_ID", -1); //Since Account ID 0 is valid, we used -1 
+									//to denote invalid
+
+/**
+ * This class encapsulates information regarding an order object.
+ */
+
+class OrderDataBean 
+{
+    public $orderID; // int
+    public $orderType; // string (buy | sell)
+    public $orderStatus; // string (closed | completed | open)
+    public $openDate; // dateTime
+    public $completionDate; // dateTime
+    public $quantity; // double
+    public $price; // decimal
+    public $orderFee; // decimal
+    public $symbol; // string
+}
+
+/**
+ * This class encapsulates an order object, and it contains information
+ * regarding a SubmitOrder request.
+ */
+
+class SubmitOrder 
+{
+    public $order; // OrderDataBean
+}
+
+/**
+ * This class encapsulates information regarding a particular holding.
+ * Each buy order creates a holding object and stores an entry in the
+ * holding table.
+ */
+
+class Holding
+{
+	public $purchasePrice; //decimal
+	public $holdingID; //int
+	public $quantity; //double
+	public $purchaseDate; //dateTime
+	public $accountID;	//string
+	public $quoteSymbol; //string
+}
+
+/**
+ * This class encapsulate information regarding a particular quote. The
+ * quote information related to a particular symbol, have to be analyzed 
+ * in order to process an order.
+ */
+
+class Quote
+{
+	public $low; //decimal
+	public $open1; //decimal
+	public $volume;	//double
+	public $price; //decimal
+	public $high; //decimal
+	public $symbol;	//string
+	public $change1; //decimal
+}
+
+/**
+ * This is the primary function which corresponds to the SubmitOrder 
+ * operation. 
+ */
+
+function ProcessOrder($order)
+{
+	$status = STATUS_SUCCESS;
+	$dbhandle = ConnectToDatabase();
+
+	/*This method with "BEGIN TRAN" initialize a transaction; which privides 
+	control so that later we can cancel a the transaction, if something 
+	goes wrong.*/
+
+	$status = ExecuteQuery("BEGIN TRAN"); 
+	if ($status)
+	{
+		$quote = GetQuoteForUpdate($order->symbol);
+		if ($quote)
+		{
+			$order->price = $quote->price;
+
+			/*Buy or sell orders either first creates a holding or sell a 
+			holding. The return value is the holdingID upon success. If NULL
+			is returned, then the tranaction can not be completed. This is due
+			to either problem of accessing the database or if there is no 
+			maching holding.*/
+
+			/*upon success, total price should be deducted from account's balance. 
+			In case of sell, balance should increase. So, in sell case, total price will be
+			negative value */
+
+			if ($order->orderType == ORDER_TYPE_BUY)
+			{
+				$holdingID = CreateHolding($order);
+				if ($holdingID != INVALID_ID)
+				{
+					$totalPrice = 
+						$order->quantity * $order->price + $order->orderFee;
+				}
+			}
+			if ($order->orderType == ORDER_TYPE_SELL)
+			{
+				$holdingID = SellHolding($order);
+				if ($holdingID != INVALID_ID)
+				{
+					$totalPrice = -1 * $order->quantity * $order->price + 
+						$order->orderFee;
+				}
+			}
+
+			if ($holdingID != INVALID_ID)
+			{
+				$status = UpdateSystemStatus($order, 
+					$quote, $holdingID, $totalPrice);
+			}
+			else
+			{
+				error_log ("Holding id for order with order id ".$order->orderID. " is not valid\n");
+				$status = STATUS_FAILURE;
+			}
+		}
+		else
+		{
+			error_log ("Cannot get quote with symbol ".$order->symbol. "\n");
+			$status = STATUS_FAILURE;
+		}
+
+	}
+	if ($status == STATUS_SUCCESS)
+	{
+		/*Transaction is successfull, we can safely commit the transaction
+		into the database.*/
+
+		ExecuteQuery("COMMIT TRAN");
+	}
+	else
+	{
+		/*Transaction is not successfull, we can safely rollback the 
+		transaction without commiting to the database.*/
+
+		ExecuteQuery("ROLLBACK TRAN");
+	}
+	CloseDatabase($dbhandle);
+}
+
+/**
+ * This method, retrieves all the information related to a particular symbol
+ * from the QUOTE table.
+ * @param symbol is the symbol we are looking for
+ * @return quote object filled with symbol information upons success and else 
+ * NULL is returned.
+ */
+
+function GetQuoteForUpdate($symbol)
+{
+	$query = "Set NOCOUNT ON; SELECT SYMBOL, COMPANYNAME, VOLUME, PRICE, ".
+		"OPEN1, LOW, HIGH, CHANGE1 FROM QUOTE WITH (NOLOCK) WHERE SYMBOL ".
+		"= '$symbol'";
+
+	/*Get the tuple corresponding to the particular symbol*/
+
+	$result =  ExecuteQuery($query);
+	if ($result)
+	{
+		$quote = new Quote();
+		$quote->symbol =  GetMSSQLValue($result, 0, 0);	//Get the symbol.
+		$quote->price = GetMSSQLValue($result, 0, 3); //Get the price.
+		$quote->low = GetMSSQLValue($result, 0, 5); //Get the low value.
+		$quote->high =  GetMSSQLValue($result, 0, 6); //Get the high value.
+	}
+	return $quote;
+}
+
+/**
+ * This method updates all the system information relates to a particular
+ * buy or sell operation.
+ * @param order order object
+ * @param quote  quote object
+ * @param holdingID holdingID of the holding which relates to the current order
+ * @param totalPrice the price change  (amount of money the flows in/out of a
+ * user's account).
+ * @return STATUS_SUCCESS upon success and STATUS_FAILURE otherwise.
+ */
+
+function UpdateSystemStatus($order, $quote, $holdingID, $totalPrice)
+{
+	$status = STATUS_SUCCESS;
+	$accountID = GetAccountIDFromOrder($order);
+	if ($accountID != INVALID_ID)
+	{
+		if(UpdateAccountBalance($accountID, $totalPrice))
+		{
+			if(UpdateStockPriceVolume($order->quantity, $quote))
+			{
+				if(!CloseOrder($order, $holdingID))
+				{
+					error_log ("Cannot close order for order id ". $order->orderID. " \n");
+					$status = STATUS_FAILURE;
+				}
+			}
+			else
+			{
+				error_log ("Cannot update stock price volume for symbol ". $quote->symbol. "\n");
+				$status = STATUS_FAILURE;
+			}
+		}
+		else
+		{
+			error_log ("Cannot update account balace for account id ".$accountID. "\n");
+			$status = STATUS_FAILURE;
+		}
+	}
+	else
+	{
+		error_log ("Account id for order id " .$order->orderID. " is not valid \n");
+		$status = STATUS_FAILURE;
+	}
+	return $status;
+}
+
+/**
+ * This function corresponds to a sell operation. It matches a particular
+ * holding related to a particular order (symbol) and then do the transaction
+ * @param order order object
+ * @return a non NULL holdingID upon success and NULL otherwise.
+ */
+
+function SellHolding($order)
+{
+	$holding = GetHoldingForUpdate($order);
+	if ($holding)
+	{
+		$accountID = $holding->accountID;
+		$quantity = $order->quantity;
+		$holdingQuantity = $holding->quantity;
+
+		if ($order->quantity < $holding->quantity)
+		{
+			if(!UpdateHolding($holding, $order->quantity))
+			{
+				error_log ("Cannot update holding with holding id ".$holding->holdingID. " \n");
+				$holding->holdingID = INVALID_ID;
+			}
+		}
+		else if ($order->quantity == $holding->quantity)
+		{
+			if(!DeleteHolding($holding))
+			{
+				error_log ("Cannot delete holding with holding id ".$holding->holdingID. " \n");
+				$holding->holdingID = INVALID_ID;
+			}
+		}
+		else
+		{
+			if(!DeleteHolding($holding))
+			{
+				error_log ("Cannot delete holding with holding id ".$holding->holdingID. " \n");
+				$holding->holdingID = INVALID_ID;
+			}
+			else
+			{
+				$order->quantity = $holding->quantity;
+				if(!UpdateOrder($order))
+				{
+					error_log ("Cannot update order with order id ".$order->orderID. " \n");
+					$holding->holdingID = INVALID_ID;
+				}
+			}
+		}
+	}
+	else
+	{
+		error_log ("Holding for order id ".$order->orderID. " is not valid \n");
+		return INVALID_ID;
+	}
+	return $holding->holdingID;
+}
+
+/**
+ * This method updates the status of an order as a result of a buy or sell
+ * operation.
+ * @param order order object
+ * @return NON-NULL on success and NULL on failure.
+ */
+
+function UpdateOrder($order)
+{
+	$query = "UPDATE ORDERS WITH (ROWLOCK) SET QUANTITY='$order->quantity' WHERE".
+		" ORDERID='$order->orderID'";
+	return ExecuteQuery($query);
+}
+
+/**
+ * This method updates a particular Holing entry in the HOLDING table.
+ * @param holding is the holding object.
+ * @param quantity is the amount of buy or sell.
+ * $return NON-NULL on success or NULL otherwise.
+ */
+
+function UpdateHolding($holding, $quantity)
+{
+	$query = "UPDATE HOLDING WITH (ROWLOCK) SET QUANTITY=QUANTITY-'$quantity'".
+		" WHERE HOLDINGID='$holding->holdingID'";
+	return ExecuteQuery($query);
+}
+
+/**
+ * Removes an entry from the HOLDING table when a matching order is received.
+ * @param holding is a holding object.
+ * @return NON-NULL value on success and NULL otherwise.
+ */
+
+function DeleteHolding($holding)
+{
+	$query = "DELETE FROM HOLDING WITH (ROWLOCK) WHERE ".
+		"HOLDINGID='$holding->holdingID'";
+	return ExecuteQuery($query);
+}
+
+/**
+ * This method returns a quote object which matches to the particular sell 
+ * order. 
+ * @param order the order object.
+ * @return a Holding object upon success and NULL otherwise.
+ */
+
+function GetHoldingForUpdate($order)
+{
+	$query = "Set NOCOUNT ON; SELECT HOLDING.HOLDINGID, HOLDING.ACCOUNT_ACCOUNTID,".
+		" HOLDING.QUANTITY, HOLDING.PURCHASEPRICE, HOLDING.PURCHASEDATE,".
+		" HOLDING.QUOTE_SYMBOL FROM HOLDING WITH (ROWLOCK) INNER JOIN ORDERS".
+		" ON HOLDING.HOLDINGID = ORDERS.HOLDING_HOLDINGID WHERE ".
+		"(ORDERS.ORDERID = '$order->orderID')";
+
+	/*Get the machining tuple from HOLDING table, that corresponds to the 
+	current sell operation.*/
+
+	$result = ExecuteQuery($query);
+	
+	if ($result)
+	{
+		$holding = new Holding();	
+		$holding->holdingID = GetMSSQLValue($result, 0, 0); //Get the holdingID.
+		$holding->accountID = GetMSSQLValue($result, 0, 1); //Get the accountID.
+		$holding->quantity = GetMSSQLValue($result, 0, 2); //Get the quantity.
+		$holding->purchasePrice = GetMSSQLValue($result, 0, 3); //Get the price.
+		$holding->purchaseDate = GetMSSQLValue($result, 0, 4); //Get the date.
+		$holding->quoteSymbol = GetMSSQLValue($result, 0, 5); //Get the symbol.
+	}
+	else
+	{
+		error_log ("Cannot obtain holding for order id ". $order->orderID . "\n");
+	}
+	return $holding;
+}
+
+/**
+ * This method updates the order status, with newest settings on completion
+ * of processing an order.
+ * @param order order object.
+ * @param holdingID holdingID of the particular holding.
+ * @return NON-NULL on success and NULL on failure.
+ */
+
+function CloseOrder($order, $holdingID)
+{
+	$order->orderStatus = ORDER_STATUS_CLOSED;
+	if ($order->orderType == ORDER_TYPE_SELL)
+	{
+		$holdingID = NULL;
+	}
+	$query = "UPDATE ORDERS WITH (ROWLOCK) SET ".
+		"ORDERSTATUS='".ORDER_STATUS_CLOSED."',".
+		" COMPLETIONDATE=GetDate(), HOLDING_HOLDINGID='$holdingID',".
+		" PRICE='$order->price' WHERE ORDERID='$order->orderID'";
+	return ExecuteQuery($query);
+}
+
+/**
+ * Create an entry in the HOLDING table to represent a particular buy order.
+ * @param order order object filled with order information.
+ * @return the holdingID of the created holding upon success and else it 
+ * returns NULL 
+ */
+
+function CreateHolding($order)
+{
+	$accountID = GetAccountIDFromOrder($order);
+	if ($accountID != INVALID_ID)
+	{
+		$query = "INSERT INTO HOLDING (PURCHASEPRICE, QUANTITY, PURCHASEDATE,".
+			" ACCOUNT_ACCOUNTID, QUOTE_SYMBOL) VALUES ('$order->price',".
+			" '$order->quantity', GetDate(), '$accountID', '$order->symbol');".
+			" SELECT ID=@@IDENTITY";
+		$result = ExecuteQuery($query);
+		if ($result)
+		{
+			$holdingID = GetMSSQLValue($result, 0, 0); 
+		}
+		else
+		{
+			error_log ("Cannot create holding for order id ". $order->orderID . "\n");
+			$holdingID = INVALID_ID;
+		}
+	}
+	else
+	{
+		error_log ("Account id for order with order id ".$order->orderID. " is not valid\n");
+		$holdingID = INVALID_ID;
+	}
+	return $holdingID;
+}
+
+/**
+ * This method retrieves the acccountID from a given order.
+ * @param order the order object.
+ * @return NON-NULL accountID upon success and NULL otherwise. 
+ */
+
+function GetAccountIDFromOrder($order)
+{
+	$query = "Set NOCOUNT ON; SELECT ACCOUNT_ACCOUNTID FROM ORDERS WITH ".
+		"(NOLOCK) WHERE ORDERID='$order->orderID'";
+
+	/*Get a tuple including accountID for a particular order*/
+
+	$result = ExecuteQuery($query);
+	if ($result != NULL)
+	{
+		$accountID = GetMSSQLValue($result, 0, 0); //Get accountID.
+	}
+	else
+	{
+		error_log ("Cannot obtain account id for order with order id ".$order->orderID. "\n");
+		$accountID = INVALID_ID;
+	}
+  	return $accountID; 
+}
+
+/**
+ * This method updates the account balance of the user who buy or sell some
+ * sybmol.
+ * @param accountID is the account to be updated.
+ * @param amount the amount of money by which the account is updated.
+ * @return NON-NULL upon success and NULL on failure.
+ */
+
+function UpdateAccountBalance($accountID, $amount)
+{
+	$query = "UPDATE ACCOUNT WITH (ROWLOCK) SET BALANCE=(BALANCE - '$amount')".
+		" WHERE ACCOUNTID = '$accountID'";
+	return ExecuteQuery($query);
+}
+
+/**
+ * This method updates the QUOTE table with the new price values. In here, a
+ * random value is generated which is between 0.1 and 2, and then the quote
+ * price is changed by multiplying it with the generted random value.
+ * @param quantity the quantity of a particular symbol the client buy or sell.
+ * @return STATUS_SUCCESS upon success and STATUS_FAILURE upon failure.
+ */
+
+function UpdateStockPriceVolume($quantity, $quote)
+{
+	if ($quote)
+	{
+		$rand = rand(1, 20);
+		$priceChangeFactor = ((float)$rand)/10;
+		$quote->price = $quote->price * $priceChangeFactor;
+
+		if($quote->price < 0.05 || $quote->price > 1000)
+		{
+			$quote->price = 100;
+		}
+
+		if ($quote->price < $quote->low)
+		{
+			$quote->low = $quote->price;
+		}
+		if ($quote->price > $quote->high)
+		{
+			$quote->high = $quote->price;
+		}
+
+		$query = "UPDATE QUOTE WITH (ROWLOCK) SET PRICE='$quote->price', ".
+			"LOW='$quote->low', HIGH='$quote->high', CHANGE1='$quote->price' - ".
+			"OPEN1, VOLUME=VOLUME+'$quantity' WHERE SYMBOL='$quote->symbol'";
+
+		$status = ExecuteQuery($query);
+	}
+	return $status;
+}
+?>

Added: incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor_svc.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor_svc.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor_svc.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor_svc.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,100 @@
+<?php
+/*
+ * 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.
+ */
+ 
+require_once ("order_processor.php");
+
+// define the class map
+$class_map = array("anyType" => "anyType", "OrderDataBean" => "OrderDataBean", 
+	"SubmitOrder" => "SubmitOrder", "isOnline" => "isOnline");
+
+class isOnline
+{
+}
+
+
+/**
+ * This method corresponds to the primary operation of the service.It processes
+ * an incomming order object.
+ * @param input, the order object, filled with data correspond to an order
+ * @return accept upon success.
+ */ 
+
+function SubmitOrder($input) 
+{
+	SendAcceptNotification();
+	if ($input->order != NULL)
+	{
+		if(($input->order->orderType == ORDER_TYPE_BUY) || 
+			($input->order->orderType == ORDER_TYPE_SELL))
+		{
+			ProcessOrder($input->order);
+		}
+		else
+		{
+			error_log ("Incoming order type is incorrect.\n");
+		}
+	}
+	else
+	{
+		error_log ("Incoming order request is NULL.\n");
+	}
+}
+
+/**
+ * This method obtains some additional time and let the business service
+ * to store information regarding an order. Then the OrderProcessor can
+ * continue processing the order request that was just stored in the 
+ * database.
+ */
+
+function SendAcceptNotification()
+{
+	header('HTTP/1.1 202 Accepted');
+	header('Content-Length: 0');
+	flush();
+	sleep(1);
+}
+
+/**
+ * This function corresponds to the isOnline operation. This is used by the
+ * Configuration service to make sure that the OrderProcessor service is 
+ * online.
+ * @return just a return is expected to make sure the service is online.
+ */
+
+function isOnline($input) 
+{
+	return;
+}
+
+// define the operations map
+$operations = array("SubmitOrder" => "SubmitOrder", "isOnline" => "isOnline");
+
+// define the actions => operations map
+$actions = array("SubmitOrderOnePhase" => "SubmitOrder", 
+	"isOnline" => "isOnline");
+
+// create service in WSDL mode
+$service = new WSService(array ("wsdl" =>"TradeOrders.wsdl",
+	"operations" => $operations,
+    "actions" => $actions,
+	"classmap" => $class_map,));
+
+// process client requests and reply
+$service->reply();
+?>

Added: incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor_svc_msec.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor_svc_msec.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor_svc_msec.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/order_processor/order_processor_svc_msec.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,108 @@
+<?php
+/*
+ * 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.
+ */
+ 
+require_once ("order_processor.php");
+
+// define the class map
+$class_map = array("anyType" => "anyType", "OrderDataBean" => "OrderDataBean", 
+	"SubmitOrder" => "SubmitOrder", "isOnline" => "isOnline");
+
+class isOnline
+{
+}
+
+
+/**
+ * This method corresponds to the primary operation of the service.It processes
+ * an incomming order object.
+ * @param input, the order object, filled with data correspond to an order
+ * @return accept upon success.
+ */ 
+
+function SubmitOrder($input) 
+{
+	SendAcceptNotification();
+	if ($input->order != NULL)
+	{
+		if(($input->order->orderType == ORDER_TYPE_BUY) || 
+			($input->order->orderType == ORDER_TYPE_SELL))
+		{
+			ProcessOrder($input->order);
+		}
+		else
+		{
+			error_log ("Incoming order type is incorrect.\n");
+		}
+	}
+	else
+	{
+		error_log ("Incoming order request is NULL.\n");
+	}
+}
+
+/**
+ * This method obtains some additional time and let the business service
+ * to store information regarding an order. Then the OrderProcessor can
+ * continue processing the order request that was just stored in the 
+ * database.
+ */
+
+function SendAcceptNotification()
+{
+	header('HTTP/1.1 202 Accepted');
+	header('Content-Length: 0');
+	flush();
+	sleep(1);
+}
+
+/**
+ * This function corresponds to the isOnline operation. This is used by the
+ * Configuration service to make sure that the OrderProcessor service is 
+ * online.
+ * @return just a return is expected to make sure the service is online.
+ */
+
+function isOnline($input) 
+{
+	return;
+}
+
+// define the operations map
+$operations = array("SubmitOrder" => "SubmitOrder", "isOnline" => "isOnline");
+
+// define the actions => operations map
+$actions = array("SubmitOrderOnePhase" => "SubmitOrder", 
+	"isOnline" => "isOnline");
+
+//This is the security information
+$pvt_key = ws_get_key_from_file("./keys/bob_key.pem");
+$policy_xml = file_get_contents("policy.xml"); 
+$policy = new WSPolicy($policy_xml);
+$sec_token = new WSSecurityToken(array("privateKey" => $pvt_key));
+
+// create service in WSDL mode
+$service = new WSService(array ("wsdl" =>"TradeOrders.wsdl",
+	"operations" => $operations,
+	"actions" => $actions,
+	"policy" => $policy,
+	"securityToken" => $sec_token,
+	"classmap" => $class_map,));
+
+// process client requests and reply
+$service->reply();
+?>

Added: incubator/stonehenge/contrib/stocktrader/php/order_processor/policy.xml
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/order_processor/policy.xml?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/order_processor/policy.xml (added)
+++ incubator/stonehenge/contrib/stocktrader/php/order_processor/policy.xml Wed Nov 26 02:49:04 2008
@@ -0,0 +1,43 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+    <wsp:ExactlyOne>
+        <wsp:All>
+            <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                <wsp:Policy>
+                    <sp:ProtectionToken>
+                        <wsp:Policy>
+                            <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+                                <wsp:Policy>
+                                    <sp:WssX509V3Token10/>
+                                </wsp:Policy>
+                            </sp:X509Token>
+                        </wsp:Policy>
+                    </sp:ProtectionToken>
+                    <sp:AlgorithmSuite>
+                        <wsp:Policy>
+                            <sp:Basic256/>
+                        </wsp:Policy>
+                    </sp:AlgorithmSuite>
+                    <sp:Layout>
+                        <wsp:Policy>
+                            <sp:Strict/>
+                        </wsp:Policy>
+                    </sp:Layout>
+                    <sp:IncludeTimestamp/>
+                </wsp:Policy>
+            </sp:SymmetricBinding>
+            <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                <wsp:Policy>
+                    <sp:MustSupportRefKeyIdentifier/>
+                    <sp:MustSupportRefEmbeddedToken/>
+                    <sp:MustSupportRefIssuerSerial/>
+                </wsp:Policy>
+            </sp:Wss10>
+            <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                <sp:Body/>
+            </sp:SignedParts>
+            <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                <sp:Body/>
+            </sp:EncryptedParts>
+        </wsp:All>
+    </wsp:ExactlyOne>
+</wsp:Policy>

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/account.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/account.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/trader_client/account.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/trader_client/account.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,277 @@
+<?php
+/*
+ * 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.
+ */
+
+require_once("request_processor.php");
+if(!IsLoggedIn())
+{
+	header("Location: login.php");
+}
+else
+{
+	/*If the user requested to update his profile information*/
+	if ($_POST['UPDATEUSERPROFILE'])
+	{
+		$userID = GetUserFromCookie();
+		$password = $_POST['PASSWORD'];
+		$fullName = $_POST['FULLNAME'];
+		$address = $_POST['ADDRESS'];
+		$email = $_POST['EMAIL'];
+		$creditCard = $_POST['CREDITCARD'];
+
+		UpdateAccountProfile($userID, 
+			$fullName, $email, $address, $creditCard, $password);
+	}
+	$ordersReturn = GetOrders(GetUserFromCookie())->getOrdersReturn;
+	$accountSummary = GetUserAccountSummary($ordersReturn);
+	$userAccountDataReturn = 
+		GetAccountData(GetUserFromCookie())->getAccountDataReturn;
+	$userAccountProfileDataReturn = 
+		GetAccountProfileData(GetUserFromCookie())->getAccountProfileDataReturn;
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>WSF/PHP StockTrader Welcome</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+			<div id="header">
+				<div class="logo"><img src="images/logo.gif"></div>
+			</div>
+			<div id="header-links">
+				<table>
+					<tr>
+					<td>
+						<a href="index.php">Welcome</a>
+					</td>
+					<td>
+						<a href="home.php">Home</a>
+					</td>
+					<td>
+						<a href="account.php">Account</a>
+					</td>
+					<td>
+						<a href="portfolio.php">Portfolio</a>
+					</td>
+					<td>
+						<a href="quotes.php">Quotes/Trade</a>
+					</td>
+					<td>
+						<a href="glossary.php">Glossary</a>
+					</td>
+					<td>
+						<a href="config.php">Config</a>
+					</td>
+					<td>
+						<a href="login.php">Login/Logout</a>
+					</td>
+					</tr>
+				</table>
+			</div>
+			<div id="middle">
+
+			<?php
+				$getClosedOrdersReturn = GetClosedOrders();
+
+				/*Checking whether there is new status change happened in the 
+				related to a particular order.*/
+				if ($getClosedOrdersReturn)
+				{
+					print ("<p style=\"color: red\" align=\"center\">Trade Alert: 
+						The following orders have completed.</p>");
+					print("<table class=\"table-outer\" 
+						cellspacing=\"0\" align=\"center\"><thead>
+						<tr><th>Order ID</th><th>Order Status</th>
+						<th>Creation Date</th><th>Completion Date</th>
+						<th>Txn Fee</th><th>Type</th><th>Symbol</th>
+						<th>Quantity</th></tr></thead><tbody>");
+
+					$index = 0;
+					while ($getClosedOrdersReturn->OrderDataBean[$index])
+					{
+						$openDate = new DateTime($getClosedOrdersReturn->OrderDataBean[$index]->openDate);
+						$completionDate =new DateTime( $getClosedOrdersReturn->OrderDataBean[$index]->completionDate);
+						print ("<tr><td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderID."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderStatus."</td>
+							<td>".$openDate->format("m/d/Y h:i:s A")."</td>
+							<td>".$completionDate->format("m/d/Y h:i:s A")."</td>
+							<td>$".$getClosedOrdersReturn->OrderDataBean[$index]->orderFee."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->orderType."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->symbol."</td>
+							<td>".$getClosedOrdersReturn->OrderDataBean[$index]->quantity."</td></tr>");
+						$index ++;
+					}
+					print("</tbody></table><br/><br/>");
+				}
+
+				/*Display the account summary information of a particular user.*/
+				if ($accountSummary)
+				{	
+					print ("<div class=\"main-title\"><h1>Account Information
+						</h1><script type=\"text/javascript\">var thisdate = new Date();
+					document.writeln(thisdate.toLocaleString());</script></div>");
+
+					print ("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\">
+						<thead><tr><th>Subtotal Buys</th><th>Subtotal Sells</th><th>Subtotal Fees
+						</th><th>Net Impact Cash Balance</th></tr></thead><tbody><tr>");
+
+					printf("<td class=\"currency\">$%.2f</td>", $accountSummary->totalBuys);
+					printf("<td class=\"currency\">$%.2f</td>", $accountSummary->totalSells);
+					printf("<td class=\"currency\">$%.2f</td>", $accountSummary->totalTax);
+					printf("<td class=\"currency\">");
+
+					if ($accountSummary->totalImpact > 0)
+					{
+						printf("<span class=\"price-loss\">$%.2f</span>", $accountSummary->totalImpact);
+					}
+					else if ($accountSummary->totalImpact < 0)
+					{
+						printf("<span class=\"price-gain\">$%.2f</span>", $accountSummary->totalImpact);
+					}
+					else
+					{
+						printf("<span>($%.2f)</span>", $accountSummary->totalImpact);
+					}
+					printf("</td></tr></tbody></table>");
+				}
+
+				/*Display the orders a particular user is associated with.*/
+				if ($ordersReturn)
+				{
+					print("<div><p><b>Total Orders Shown</b></p></div>");
+					print("<table class=\"table-outer\" cellspacing=\"0\" align=\"center\"><thead><tr>");
+					print("<th>Order ID</th><th>Order Status</th><th>Creation Date</th><th>Completion Date
+						</th><th>Txn Fee</th><th>Type</th><th>Symbol</th><th>Quantity</th><th>Price
+						</th><th>Total</th></tr></thead><tbody>");
+					
+					$index = 0;
+					while ($ordersReturn->OrderDataBean[$index])
+					{
+						$openDate = new DateTime($ordersReturn->OrderDataBean[$index]->openDate);
+						$completionDate = new DateTime($ordersReturn->OrderDataBean[$index]->completionDate);
+						print ("<tr><td>".$ordersReturn->OrderDataBean[$index]->orderID."</td>
+							<td>".$ordersReturn->OrderDataBean[$index]->orderStatus."</td>
+							<td>".$openDate->format("m/d/Y h:i:s A")."
+							</td><td>".$completionDate->format("m/d/Y h:i:s A")."</td>
+							<td class=\"currency\">$".$ordersReturn->OrderDataBean[$index]->orderFee."</td>
+							<td>".$ordersReturn->OrderDataBean[$index]->orderType."</td>");
+							
+						print ("<td><form action = \"quotes.php\" method = \"post\">
+							<input type=\"hidden\" name=\"SYMBOLS\" value=\"".
+							$ordersReturn->OrderDataBean[$index]->symbol."\"/>
+							<input type=\"submit\" name=\"GETQUOTE\" value=\"".
+							$ordersReturn->OrderDataBean[$index]->symbol."\"/></form></td>");
+
+						print ("<td class=\"currency\">".$ordersReturn->OrderDataBean[$index]->quantity."</td>
+							<td class=\"currency\">$".$ordersReturn->OrderDataBean[$index]->price."</td>
+							<td class=\"currency\">$".(($ordersReturn->OrderDataBean[$index]->price * 
+							$ordersReturn->OrderDataBean[$index]->quantity) + 
+							$ordersReturn->OrderDataBean[$index]->orderFee)."</td></tr>");
+
+						$index ++;
+					}
+					print ("</tbody></table>");
+				}
+				
+				/*Display the account profile information associted to a 
+				the user.*/
+				if ($userAccountProfileDataReturn)
+				{
+					print ("<form action = \"account.php\"  method =\"post\">
+						<table class=\"profile\" cellspacing=\"0\" width=\"100%\"><thead><tr>
+						<th>Update Account Profile:".GetUserFromCookie()."</th></tr></thead><tbody><tr><td>");
+					print ("<table cellspacing=\"0\" align=\"center\">");
+					print ("<tr><td>Full Name:</td><td><input name=\"FULLNAME\" type=\"text\" value=\"".
+						$userAccountProfileDataReturn->fullName."\" id=\"\" size=\"25\"/>
+						</td><td>Email Address:</td><td><input name=\"EMAIL\" type=\"text\" value=\"".
+						$userAccountProfileDataReturn->email."\" id=\"\" size=\"25\"/></td></tr>");
+					print ("<tr><td>Address:</td><td><input name=\"ADDRESS\" type=\"text\" value=\"".
+						$userAccountProfileDataReturn->address."\" id=\"\" size=\"25\"/></td>
+						<td>Password:</td><td><input type=\"password\" name=\"PASSWORD\" type=\"text\" value=\"".
+						$userAccountProfileDataReturn->password."\" id=\"\" size=\"25\"/></td></tr>");
+					print ("<tr><td>Credit Card:</td><td><input name=\"CREDITCARD\" type=\"text\" value=\"".
+						$userAccountProfileDataReturn->creditCard."\" id=\"\" size=\"25\"/></td>
+						<td>Confirm Password:</td><td><input type=\"password\" name=\"PASSWORD\" type=\"text\" value=\"".
+						$userAccountProfileDataReturn->password."\" id=\"\" size=\"25\"/></td></tr>");
+					print ("<tr><td colspan=\"4\" class=\"button\"><input type=\"submit\" 
+						name=\"UPDATEUSERPROFILE\"value=\"Update\" class=\"button\"/></td></tr>");
+					print ("</table></form");
+
+					/*Display the account information of a the user*/
+					if ($userAccountDataReturn)	
+					{
+						$creationDate = new DateTime($userAccountDataReturn->creationDate);
+						$lastLogin = new DateTime($userAccountDataReturn->lastLogin);
+						print("<table align=\"center\" class=\"profile-content\" cellspacing=\"0\"><tbody>");
+						print ("<tr><td class=\"left\">Account ID:</td>
+							<td>".$userAccountDataReturn->accountID."</td><td class=\"left\">
+							Account Created</td><td>".$creationDate->format("m/d/Y h:i:s A")."</td></tr>");
+						print ("<tr><td class=\"left\">User ID:</td>
+							<td>".$userAccountDataReturn->profileID."</td><td class=\"left\">
+							Last Login:</td><td>".$lastLogin->format("m/d/Y h:i:s A")."</td></tr>");
+						print ("<tr><td class=\"left\">Opening Balance:</td>
+							<td>".$userAccountDataReturn->openBalance."</td>
+							<td class=\"left\">Total Logins:</td>
+							<td>".$userAccountDataReturn->loginCount."</td></tr>");
+						print("<tr><td class=\"left\">Cash Balance:</td>");
+							
+						if ($userAccountDataReturn->balance > 0)
+						{
+							print("<td><span class=\"price-gain\">$".
+								$userAccountDataReturn->balance."</span></td>");
+						}
+						else if($userAccountDataReturn->balance < 0)
+						{
+							print("<td><span class=\"price-loss\">$".
+								(-1) * $userAccountDataReturn->balance."</span></td>");
+						}
+						else
+						{
+							print("<td>$".$userAccountDataReturn->balance."</td>");
+						}	
+						print("<td class=\"left\">Total Logous:</td>
+							<td>".$userAccountDataReturn->logoutCount."</td></tr>");
+						print("</tbody></table>");
+					}
+					print("</td></tr></tbody></table>");
+				}
+			?>
+			<div class="bottom">
+			<form method = "post"  action = "quotes.php">
+			<input type="text" value="<?php print ($symbol); ?>" name="SYMBOLS" size="25"/>
+			<input type="submit" value="Get Quote" name="GETQUOTE" class="button"/>
+			</form>
+			</div>
+			</div>
+			<div id="footer">
+				<div style="float:left;">Copyright 2008, WSO2 Inc.</div>
+				<div style="margin-left:432px;float:left;">Powered by 
+				<img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></div>
+			</div>
+		</div>
+	</body>
+
+</html>

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/config.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/config.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/trader_client/config.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/trader_client/config.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,113 @@
+<?php
+/*
+ * 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.
+ */
+
+require_once ("request_processor.php");
+
+
+if (isset ($_POST['SETENDPOINT']))
+{
+	if (($_POST['ENDPOINT']) != "")
+	{
+		WriteEndpoint($_POST['ENDPOINT']);
+		header("Location: login.php");
+	}
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>WSF/PHP StockTrader Welcome</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+
+	<form method = "post"  action = "config.php">
+
+		<div id="content">
+		<div id="header">
+			<div class="logo"><img src="images/logo.gif"></div>
+		</div>
+
+		<div id="header-links">
+		<table>
+			<tr>
+			<td>
+			<a href="index.php">Welcome</a>
+			</td>
+			<td>
+			<a href="home.php">Home</a>
+			</td>
+			<td>
+			<a href="account.php">Account</a>
+			</td>
+			<td>
+			<a href="portfolio.php">Portfolio</a>
+			</td>
+			<td>
+			<a href="quotes.php">Quotes/Trade</a>
+			</td>
+			<td>
+			<a href="glossary.php">Glossary</a>
+			</td>
+			<td>
+			<a href="config.php">Config</a>
+			</td>
+			<td>
+			<a href="login.php">Login/Logout</a>
+			</td>
+			</tr>
+		</table>
+		</div>
+
+		<div id="middle">
+
+		<div class="main-title">
+		<h1>Config</h1>
+		<script type=\"text/javascript\">
+			var thisdate = new Date();
+			document.writeln(thisdate.toLocaleString());
+		</script>
+		</div>
+
+		<div class="login">
+		<table>
+		<tr>
+		<td>Configuration Service</td>
+		<td><input type="text" name = "ENDPOINT" value = <?php if (GetEndpoint() == "") print ("http://localhost:8080/config_service/config_svc.php"); else print(GetEndpoint());?> size = "75"/></td>
+		</tr>
+		<tr>
+		<td></td>
+		<td><input type = "submit" name = "SETENDPOINT" value = "Set" class="button"/></td>
+		</tr>
+		</table>
+		</div>
+		</div>
+		<div id="footer">
+			<div style="float:left;">Copyright 2008, WSO2 Inc.</div>
+			<div style="margin-left:432px;float:left;">Powered by 
+			<img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></div>
+	</div>
+
+		</div>
+		</form>
+	</body>
+</html>

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/confirmation.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/confirmation.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/trader_client/confirmation.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/trader_client/confirmation.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,150 @@
+<?php
+/*
+ * 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.
+ */
+
+
+require_once("request_processor.php");
+if(!IsLoggedIn())
+{
+	header("Location: login.php");
+}
+else
+{
+	if ($_POST['SELL'])
+	{
+		$isSell = $_POST['SELL'];
+		$holdingID = $_POST['HOLDINGID'];
+		$quantity = $_POST['QUANTITY'];
+		$symbol = $_POST['SYMBOL'];
+	}
+	else if ($_POST['BUY'])
+	{
+		$quantity = $_POST['QUANTITY'];
+		$symbol = $_POST['SYMBOL'];
+		$price = $_POST['PRICE'];
+		$isBuy = $_POST['BUY'];
+	}
+	else
+	{
+		print ("This is not buy or sell.");
+	}
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>WSF/PHP StockTrader Welcome</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+			<div id="header">
+				<div class="logo"><img src="images/logo.gif"></div>
+			</div>
+			<div id="header-links">
+				<table>
+					<tr>
+					<td>
+						<a href="index.php">Welcome</a>
+					</td>
+					<td>
+						<a href="home.php">Home</a>
+					</td>
+					<td>
+						<a href="account.php">Account</a>
+					</td>
+					<td>
+						<a href="portfolio.php">Portfolio</a>
+					</td>
+					<td>
+						<a href="quotes.php">Quotes/Trade</a>
+					</td>
+					<td>
+						<a href="glossary.php">Glossary</a>
+					</td>
+					<td>
+						<a href="config.php">Config</a>
+					</td>
+					<td>
+						<a href="login.php">Login/Logout</a>
+					</td>
+					</tr>
+				</table>
+			</div>
+			<div id="middle">
+				<div class="main-title">
+					<h1>Trade</h1>
+					<script type=\"text/javascript\">
+						var thisdate = new Date();
+						document.writeln(thisdate.toLocaleString());
+					</script>
+				</div>
+				
+				<div id="confirm">
+				<h2>Trade Confirmation</h2>
+				<div class="confirm-content">
+					<form action="quotes.php" method="post">
+					<?php
+
+						if ($isSell)
+						{
+							print("<p>You have requested to sell all or part of your holding ".$holdingID.". 
+									This holding has a total of ".$quantity." shares of stock ".$symbol.". 
+									Please indicate how many share to sell.</p>");
+
+							print("<nobr>Number of Shares: <input type=\"text\" name=\"QUANTITY\" value=\"".$quantity."\" id=\"\" size=\"10\"/>");
+							print ("<input type=\"hidden\" name=\"HOLDINGID\" value=\"".$holdingID."\"></input>");
+							print ("<input type=\"submit\" name=\"SELL\" value=\"Sell\" class=\"button\"/>");
+						}
+						else if ($isBuy)
+						{
+							print("<nobr>Number of Shares: <input type=\"text\" name=\"QUANTITY\" value=\"".$quantity."\" id=\"\" size=\"10\"/>");
+							print("<p>You have requested to buy shares of ".$symbol." which is currently trading at $".$price.".</p>");
+							print ("<input type=\"hidden\" name=\"SYMBOL\" value=\"".$symbol."\"></input>");
+							print ("<input type=\"submit\" name=\"BUY\" value=\"Buy\" class=\"button\"/>");
+						}
+						else
+						{
+						}
+						print ("<input type=\"submit\" name = \"CANCEL\" value=\"Cancel\" class=\"button\"/></nobr>");
+					?>
+					</form>
+				</div>
+				</div>
+				
+			<div class="bottom">
+			<form method = "post"  action = "quotes.php">
+			<input type="text" value="<?php print ($symbol); ?>" name="SYMBOLS" size="25"/>
+			<input type="submit" value="Get Quote" name="GETQUOTE" class="button"/>
+			</form>
+			</div>
+			</div>
+			<div id="footer">
+				<div style="float:left;">Copyright 2008, WSO2 Inc.</div>
+				<div style="margin-left:432px;float:left;">Powered by 
+				<img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></div>
+			</div>
+		</div>
+	</body>
+
+</html>

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/glossary.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/glossary.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/trader_client/glossary.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/trader_client/glossary.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,226 @@
+<?php
+/*
+ * 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.
+ */
+
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>WSF/PHP StockTrader Welcome</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+			<div id="header">
+				<div class="logo"><img src="images/logo.gif"></div>
+			</div>
+			<div id="header-links">
+				<table>
+					<tr>
+					<td>
+						<a href="index.php">Welcome</a>
+					</td>
+					<td>
+						<a href="home.php">Home</a>
+					</td>
+					<td>
+						<a href="account.php">Account</a>
+					</td>
+					<td>
+						<a href="portfolio.php">Portfolio</a>
+					</td>
+					<td>
+						<a href="quotes.php">Quotes/Trade</a>
+					</td>
+					<td>
+						<a href="glossary.php">Glossary</a>
+					</td>
+					<td>
+						<a href="config.php">Config</a>
+					</td>
+					<td>
+						<a href="login.php">Login/Logout</a>
+					</td>
+					</tr>
+				</table>
+			</div>
+			<div id="middle">
+				<div class="main-title">
+					<h1>Glossary</h1>
+					<script type="text/javascript">
+						var thisdate = new Date();
+						document.writeln(thisdate.toLocaleString());
+					</script>
+				</div>
+				<table align="center" class="glossary" >
+					<thead>
+						<tr>
+							<th>Term</th>
+							<th>Description</th>
+						</tr>
+					</thead>
+					<tbody>
+						<tr>
+							<td class="left">Account ID</td>
+							<td>A unique Integer based key. Each user is assigned an account ID at account creation time.</td>
+						</tr>
+						<tr>
+							<td class="left">Account Created</td>
+							<td>The time and date the users account was first created.</td>
+						</tr>
+						<tr>
+							<td class="left">Cash Balance</td>
+							<td>The current cash balance in the users account. This does not include current stock holdings.</td>
+						</tr>
+							<td class="left">Company</td>
+							<td>The full company name for an individual stock.</td>
+						</tr>
+							<td class="left">Current Gain/Loss</td>
+							<td>The total gain or loss of this account, computed by substracting the current sum of cash/holdings minus the opening account balance.</td>
+						</tr>
+							<td class="left">Current Price</td>
+							<td>The current trading price for a given stock symbol.</td>
+						</tr>
+							<td class="left">Gain/Loss</td>
+							<td>The current gain or loss of an individual stock holding, computed as (current market value - holding basis).</td>
+						</tr>
+						</tr>
+							<td class="left">Last Login</td>
+							<td>The date and time this user last logged in to Trade.</td>
+						</tr>
+						</tr>
+							<td class="left">Market Value</td>
+							<td>The current total value of a stock holding, computed as (quantity * current price).</td>
+						</tr>
+						</tr>
+							<td class="left">Number of Holdings</td>
+							<td>The total number of stocks currently owned by this account.</td>
+						</tr>
+						</tr>
+							<td class="left">Open Price</td>
+							<td>The price of a given stock at the open of the trading session.</td>
+						</tr>
+						</tr>
+							<td class="left">Order ID</td>
+							<td>A unique Integer based key. Each order is assigned an order ID at order creation time.</td>
+						</tr>
+						</tr>
+							<td class="left">Opening Balance</td>
+							<td>The initial cash balance in this account when it was opened.</td>
+						</tr>
+						</tr>
+							<td class="left">Order Status</td>
+							<td>orders are opened, processed, closed and completed. Order status shows the current stat for this order.</td>
+						</tr>
+						</tr>
+							<td class="left">Price Range</td>
+							<td>The low and high prices for this stock during the current trading session</td>
+						</tr>
+						</tr>
+							<td class="left">Purchase Date</td>
+							<td>The date and time the a stock was purchased.</td>
+						</tr>
+						</tr>
+							<td class="left">Purchase Price</td>
+							<td>The price used when purchasing the stock.</td>
+						</tr>
+						</tr>
+							<td class="left">Purchase Basis</td>
+							<td>The total cost to purchase this holding. This is computed as (quantity * purchase price).</td>
+						</tr>
+						</tr>
+							<td class="left">Quantity</td>
+							<td>The number of stock shares in the order or user holding.</td>
+						</tr>
+						</tr>
+							<td class="left">Session Created</td>
+							<td>An HTTP session is created for each user at during login. Session created shows the time and day when the session was created.</td>
+						</tr>
+						</tr>
+							<td class="left">Sum of Cash/Holdings</td>
+							<td>The total current value of this account. This is the sum of the cash balance along with the value of current stock holdings.</td>
+						</tr>
+						</tr>
+							<td class="left">Symbol</td>
+							<td>The symbol for a Trade stock.</td>
+						</tr>
+						</tr>
+							<td class="left">Total Logins</td>
+							<td>The total number of logins performed by this user.</td>
+						</tr>
+						</tr>
+							<td class="left">Total Logouts</td>
+							<td>The total number of logouts performed by this user.</td>
+						</tr>
+						</tr>
+							<td class="left">Total of Holdings</td>
+							<td>The current total value of all stock holdings in this account given the current valuation of each stock held.</td>
+						</tr>
+						</tr>
+							<td class="left">Top gainers</td>
+							<td>The list of stocks (matching LIKE CLAUSE 's:1__%' per WebSphere Trade 6.1 behavior) gaining the most in price during the current trading session.</td>
+						</tr>
+						</tr>
+							<td class="left">Top Losers</td>
+							<td>The list of stocks (matching LIKE CLAUSE 's:1__%' per WebSphere Trade 6.1 behavior) falling the most in price during the current trading session.</td>
+						</tr>
+						</tr>
+							<td class="left">Trader Stock Index (TSIA)</td>
+							<td>A computed index of the top 20 stocks (matching LIKE CLAUSE 's:1__%' per WebSphere Trade 6.1 behavior) in Trade.</td>
+						</tr>
+						</tr>
+							<td class="left">Trading Volume</td>
+							<td>The total number of shares traded for stocks (matching LIKE CLAUSE 's:1__%' per WebSphere Trade 6.1 behavior) during this trading session.</td>
+						</tr>
+						</tr>
+							<td class="left">Txn Fee</td>
+							<td>The fee charged by the brokerage to process this order.</td>
+						</tr>
+						</tr>
+							<td class="left">Type</td>
+							<td>The order type (buy or sell).</td>
+						</tr>
+						</tr>
+							<td class="left">User ID</td>
+							<td>The unique user ID for the account chosen by the user at account registration.</td>
+						</tr>
+						</tr>
+							<td class="left">Volume</td>
+							<td>The total number of shares traded for this stock.</td>
+						</tr>
+					</tbody>
+				</table>
+								
+				
+				
+			
+			</div>
+			<div id="footer">
+				<div style="float:left;">Copyright 2008, WSO2 Inc.</div>
+				<div style="margin-left:432px;float:left;">Powered by 
+				<img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></div>
+			</div>
+		</div>
+	</body>
+
+</html>

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/home.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/home.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/trader_client/home.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/trader_client/home.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,312 @@
+<?php
+/*
+ * 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.
+ */
+
+
+require_once("request_processor.php");
+
+if(!IsLoggedIn())
+{
+	header("Location: login.php");
+}
+else 
+{
+	/*Market data summary.*/
+	$mktSummary = GetMarketSummary();
+	$tsia = round($mktSummary->getMarketSummaryReturn->TSIA, 2);
+	$gain = round($mktSummary->getMarketSummaryReturn->TSIA - $mktSummary->getMarketSummaryReturn->openTSIA, 2);
+	$volume = $mktSummary->getMarketSummaryReturn->volume;
+	$topGainers = $mktSummary->getMarketSummaryReturn->topGainers;
+	$topLosers = $mktSummary->getMarketSummaryReturn->topLosers;
+
+	/*Account information for the user.*/
+	$accountData = GetAccountData(GetUserFromCookie());
+	$accountDataReturn = $accountData->getAccountDataReturn;
+
+	/*Holding information for a particular user*/	
+	$holdings = GetHoldings(GetUserFromCookie());
+	$holdingInfo = GetHoldingInformation($holdings);
+	$noOfHoldings = $holdingInfo->noOfHoldings;
+	$totalHoldings = $holdingInfo->totalHoldings;
+}
+
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>WSF/PHP StockTrader Welcome</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+			<div id="header">
+				<div class="logo"><img src="images/logo.gif"></div>
+			</div>
+			<div id="header-links">
+				<table>
+					<tr>
+					<td>
+						<a href="index.php">Welcome</a>
+					</td>
+					<td>
+						<a href="home.php">Home</a>
+					</td>
+					<td>
+						<a href="account.php">Account</a>
+					</td>
+					<td>
+						<a href="portfolio.php">Portfolio</a>
+					</td>
+					<td>
+						<a href="quotes.php">Quotes/Trade</a>
+					</td>
+					<td>
+						<a href="glossary.php">Glossary</a>
+					</td>
+					<td>
+						<a href="config.php">Config</a>
+					</td>
+					<td>
+						<a href="login.php">Login/Logout</a>
+					</td>
+					</tr>
+				</table>
+			</div>
+			<div id="middle">
+
+			<?php
+				print ("<div class=\"main-title\"><h1>Home</h1><script type=\"text/javascript\">var thisdate = new Date();
+					document.writeln(thisdate.toLocaleString());</script></div>");
+				print ("<h3>Welcome ".GetUserFromCookie()."</h3>");
+			?>
+
+				<table>
+				<tr>
+				<td>
+				<div class="left">
+					<table class="normal">
+						<thead><tr><th colspan="2">User Statistics</th></tr></thead>
+
+						<?php
+							if($accountDataReturn)
+							{
+								$creationDate = new DateTime($accountDataReturn->creationDate);
+								$lastLogin = new DateTime($accountDataReturn->lastLogin);
+								print ("<tbody>");
+								print ("<tr><td class=\"left\">Account ID:</td>
+									<td>".($accountDataReturn->accountID)."</td></tr>");
+								print ("<tr><td class=\"left\">Account Created:</td>
+									<td>".$creationDate->format("m/d/Y h:i:s A")."</td></tr>");
+								print ("<tr><td class=\"left\">Total Logins:</td>
+									<td>".$accountDataReturn->loginCount."</td></tr>");
+								print ("<tr><td class=\"left\">Session Created:</td>
+									<td>".$lastLogin->format("m/d/Y h:i:s A")."</td></tr>");
+								print ("</tbody>");
+							}
+						?>
+
+						<thead><tr><th colspan="2">Summary</th></tr></thead>
+						<?php
+							if (!($holdingInfo == NULL) || ($accountDataReturn == NULL))
+							{
+								print ("<tbody>");
+								print ("<tr><td class=\"left\">Cash Balance:</td>
+									<td>".$accountDataReturn->balance."</td></tr>");
+
+								print ("<tr><td class=\"left\">Number of Holdings:</td>
+									<td>".$noOfHoldings."</td></tr>");
+								
+								print ("<tr><td class=\"left\">Total of Holdings:</td><td>");
+								printf("$ %.2f",$totalHoldings);
+								print ("</td></tr>");
+
+								print ("<tr><td class=\"left\">Sum of Cash and Holdings:</td><td>");
+								printf("$ %.2f",($totalHoldings + ($accountDataReturn->balance)));
+								print ("</td></tr>");
+
+								print ("<tr><td class=\"left\">Opening Balance:</td><td>");
+								printf ("$ %.2f", $accountDataReturn->openBalance);
+								print ("</td></tr>");
+
+								print ("<tr><td class=\"left\">Current Gain/(Loss):</td>
+									<td><span class=\"price\">");
+								$gain =  (($totalHoldings + ($accountDataReturn->balance)) - $accountDataReturn->openBalance);
+								if ($gain < 0)
+								{
+									printf("$ (%.2f)", ((-1) * $gain));
+								}
+								else if ($gain >= 0)
+								{
+									printf("$ %.2f", $gain);
+								}
+								$gainPercent = round((($gain/$accountDataReturn->openBalance) * 100), 2);
+								print ("</span></td></tr>");
+
+
+								print ("<tr><td class=\"left\">%Gain/(Loss):</td><td>");
+
+								if ($gainPercent > 0)
+								{
+									print ("<span class=\"price-gain\">".$gainPercent."%</span>");
+								}
+								else if ($gainPercent < 0)
+								{
+									print ("<span class=\"price-loss\">".$gainPercent."%</span>");
+								}
+								else
+								{
+									print ("<span>".$gainPercent."%</span>");
+								}
+								print ("</td></tr>");
+								print("</tbody>");
+							}
+							?>
+							</table>
+						</td>
+
+						<td>
+						<div class="right">
+						<h3>Market Summary</h3>
+							<p><?php print(date("D, F j, Y, g:i a")); ?></p>
+
+							<table class="table-outer" cellspacing="0">
+							<?php
+							if (!($holdingInfo == NULL) || ($accountDataReturn == NULL))
+							{
+								print ("<tr><td class=\"special\">Trade Stock Index (TSIA)</td><td>");
+								print($tsia);
+								print(" ");
+								print("<span");	
+
+								if ($gain > 0)
+								{
+									print (" class=\"price-gain\">$");
+								}
+								else if ($gain < 0)
+								{
+									print (" class=\"price-loss\">$");
+								}
+								else
+								{
+									print(">");
+								}
+								printf("%.2f</span>", $gain);
+								print ("</td></tr>");
+
+								print ("<tr><td class=\"special\">Trading Volume</td><td>");
+
+								print ($volume);
+								print ("</td></tr>");
+
+								print("<tr><td class=\"special\">Top Gainers</td><td>");
+								print ("<table class=\"table-inner\" cellspacing=\"0\">");
+								print("<thead><tr><th>Symbol</th><th>Price</th><th>Change</th></tr></thead>");
+								print("<tbody>");
+
+								$index = 0;
+								$gainer = $topGainers->QuoteDataBean[$index];
+								while($gainer)
+								{
+									print ("<tr><td><form action = \"quotes.php\" method = \"post\">
+										<input type=\"hidden\" name=\"SYMBOLS\" value=\"".$gainer->symbol."\"/>
+										<input type=\"submit\" name=\"GETQUOTE\" value=\"".$gainer->symbol."\"></input></form></td>");
+
+									printf ("<td>$%.2f</td>", $gainer->price);
+									print ("<td><span");
+
+									if (($gainer->change) > 0)
+									{
+										print ("class=\"price-gain\">$");
+									}
+									else if (($gainer->change) < 0)
+									{
+										print ("class=\"price-loss\">$");
+									}
+									else
+									{
+										print(">$");
+									}
+
+									printf ("%.2f", $gainer->change);
+									print ("</span></td>");	
+									print ("</form></tr>");
+
+									$index++;
+									$gainer = $topGainers->QuoteDataBean[$index];
+								}	
+
+								print ("</tbody></table></td></tr>");
+
+								print ("<tr><td class=\"special\">Top Losers</td><td>
+									<table class=\"table-inner\" cellspacing=\"0\"><thead>
+									<tr><th>Symbol</th><th>Price</th><th>Change</th></tr></thead><tbody>");
+
+								$index = 0;
+								$loser = $topLosers->QuoteDataBean[$index];
+								while($loser)
+								{
+									print ("<tr><td><form action = \"quotes.php\" method = \"post\">
+										<input type=\"submit\" name=\"SYMBOLS\" value=\"".
+										$loser->symbol."\"></input></form></td>");
+
+									printf ("<td>$%.2f</td>", $loser->price);
+									print ("<td><span");
+
+									if (($loser->change) > 0)
+									{
+										print (" class=\"price-gain\">$");
+									}
+									else if (($loser->change) < 0)
+									{
+										print (" class=\"price-loss\">$");
+									}
+									else
+									{
+										print(">$");
+									}	
+									printf ("%.2f", $loser->change);
+									print ("</span></td>");	
+									print ("</tr>");
+
+									$index++;
+									$loser = $topLosers->QuoteDataBean[$index];
+								}
+								print("</tbody></table>");
+								print("</td></tr></table>");
+								print("</div>");
+								print("</td></tr></table>");
+							}
+							?>
+
+			<div class="bottom">
+			<input type="text" value="" id="" size="25"/><input type="button" value="Get Quote" class="button"/>
+			</div>
+			</div>
+			<div id="footer">
+				<div style="float:left;">Copyright 2008, WSO2 Inc.</div>
+				<div style="margin-left:432px;float:left;">Powered by 
+				<img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></div>
+			</div>
+		</div>
+	</body>
+</html>

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/Thumbs.db
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/Thumbs.db?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/Thumbs.db
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/bg.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/bg.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/bg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/button-bg.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/button-bg.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/button-bg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/footer-bg.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/footer-bg.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/footer-bg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/green-arrow.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/green-arrow.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/green-arrow.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-bg.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-bg.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-bg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-link-bg-hover.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-link-bg-hover.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-link-bg-hover.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-link-bg.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-link-bg.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-link-bg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-links-bg.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-links-bg.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/header-links-bg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/logo.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/logo.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/logo.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/middle-bg.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/middle-bg.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/middle-bg.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/powered-by-logo.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/powered-by-logo.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/powered-by-logo.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/red-arrow.gif
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/images/red-arrow.gif?rev=720795&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/stonehenge/contrib/stocktrader/php/trader_client/images/red-arrow.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/index.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/index.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/trader_client/index.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/trader_client/index.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,115 @@
+<?php 
+/*
+ * 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.
+ */
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>WSF/PHP StockTrader Welcome</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+		<div id="content">
+		<div id="header">
+			<div class="logo"><img src="images/logo.gif"></div>
+		</div>
+		<div id="header-links">
+		<table>
+			<tr>
+			<td>
+			<a href="index.php">Welcome</a>
+			</td>
+			<td>
+			<a href="home.php">Home</a>
+			</td>
+			<td>
+			<a href="account.php">Account</a>
+			</td>
+			<td>
+			<a href="portfolio.php">Portfolio</a>
+			</td>
+			<td>
+			<a href="quotes.php">Quotes/Trade</a>
+			</td>
+			<td>
+			<a href="glossary.php">Glossary</a>
+			</td>
+			<td>
+			<a href="config.php">Config</a>
+			</td>
+			<td>
+			<a href="login.php">Login/Logout</a>
+			</td>
+			</tr>
+		</table>
+		</div>
+		<div id="middle">
+				<div class="main-title">
+		<h1>Welcome!</h1>
+		<script type=\"text/javascript\">
+			var thisdate = new Date();
+			document.writeln(thisdate.toLocaleString());
+		</script>
+		</div>
+		<table>
+		<tr>
+		<td>
+		<div class="left">
+				<p> The design of WSO2 StockTrader sample application is based on an online stock trading scenario with the functionality of the application equivalent to the  <a href="http://msdn.microsoft.com/stocktrader">Microsoft .NET Stock Trader </a> sample benchmark application and <a href="https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?source=trade6">IBM WebSphere's Trade 6.1 </a> sample application. WSO2 StockTrader sample application is powered by <a href="http://wso2.org/projects/wsf/php">WSO2 WSF/PHP</a> and <a href="http://wso2.org/projects/wsas/java">WSO2 WSAS</a>. It serves to illustrate interoperability between PHP Java and .NET in deploying high-performance, scalable service oriented applications. </p>
+
+<p>For more details, check <a href="http://wso2.org/interop/stocktrader">WSO2 Stock Trader home page</a>. </p>
+
+		</div>
+		</td>
+		<td>	
+		<div class="right">
+						<h3>Sample of Technologies Demonstrated</h3>
+						<table>
+							<tbody>
+								<tr>
+									<td>
+										<ul>
+											<li>Service-oriented, n-tier design with PHP, Java and .NET</li>
+											<li>Clean separation of UI, business services and DB access</li>
+											<li>WSO2 Web Services Framework For PHP</li>
+											<li>WSO2 Web Services Application Server</li>
+											<li>Interoperability with .NET</li>
+											<li>Loosely-coupled, message-oriented design</li>
+										</ul>
+									</td>
+								</tr>
+							</tbody>
+						</table>
+					</div>
+				</tr>	
+			</table>
+		</div>
+		<div id="footer">
+			<div style="float:left;">Copyright 2008, WSO2 Inc.</div>
+			<div style="margin-left:432px;float:left;">Powered by 
+			<img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></div>
+		</div>
+		</div>
+	</body>
+
+</html>

Added: incubator/stonehenge/contrib/stocktrader/php/trader_client/login.php
URL: http://svn.apache.org/viewvc/incubator/stonehenge/contrib/stocktrader/php/trader_client/login.php?rev=720795&view=auto
==============================================================================
--- incubator/stonehenge/contrib/stocktrader/php/trader_client/login.php (added)
+++ incubator/stonehenge/contrib/stocktrader/php/trader_client/login.php Wed Nov 26 02:49:04 2008
@@ -0,0 +1,139 @@
+<?php
+/*
+ * 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.
+ */
+
+require_once ("request_processor.php");
+
+if (IsLoggedIn())
+{
+	/*By deleting the cookie the user is logged off*/
+	LogoutUser(GetUserFromCookie());
+	header("Location: login.php");
+}
+
+if (isset ($_POST['LOGINREQUEST']))
+{
+	if (!isset ($_POST['USERNAME']) || !isset($_POST['PASSWORD']))
+	{
+		/*Username or password has left blank*/
+	}
+	else
+	{
+		if(Login($_POST['USERNAME'], $_POST['PASSWORD']))
+		{
+			/*successful login, write the cookie and go to account page.*/
+			WriteCookie($_POST['USERNAME']);
+			header("Location: account.php");
+		}
+		else
+		{
+			/*Unsuccessful login, go to login page.*/
+		}
+	}
+}
+?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+	<head>
+		<meta http-equiv="content-type" content="text/html;charset=utf-8" />
+		<meta name="generator" content="Adobe GoLive" />
+		<title>WSF/PHP StockTrader Welcome</title>
+		<link href="style.css" rel="stylesheet" type="text/css" media="all" />
+	</head>
+
+	<body>
+
+	<div id="content">
+		<div id="header">
+			<div class="logo"><img src="images/logo.gif"></div>
+		</div>
+
+		<div id="header-links">
+		<table>
+			<tr>
+			<td>
+			<a href="index.php">Welcome</a>
+			</td>
+			<td>
+			<a href="home.php">Home</a>
+			</td>
+			<td>
+			<a href="account.php">Account</a>
+			</td>
+			<td>
+			<a href="portfolio.php">Portfolio</a>
+			</td>
+			<td>
+			<a href="quotes.php">Quotes/Trade</a>
+			</td>
+			<td>
+			<a href="glossary.php">Glossary</a>
+			</td>
+			<td>
+			<a href="config.php">Config</a>
+			</td>
+			<td>
+			<a href="login.php">Login/Logout</a>
+			</td>
+			</tr>
+		</table>
+		</div>
+
+		<div id="middle">
+	
+			<div class="main-title">
+			<h1>Login</h1>
+			<script type="text/javascript">
+				var thisdate = new Date();
+				document.writeln(thisdate.toLocaleString());
+			</script>
+			</div>
+		
+			<div class="login">
+				<form method="post"  action="login.php">
+					<table>
+					<tr>
+					<td>Username</td>
+					<td><input name = "USERNAME" size = "25"/></td>
+					</tr>
+					<tr>
+					<td>Password</td>
+					<td><input type="password" name = "PASSWORD" size = "25"/></td>
+					</tr>
+					<tr>
+					<td></td>
+					<td><input type = "submit" name = "LOGINREQUEST" value = "Login" class="button"/></td>
+					</tr>
+					</table>
+				</form>
+		
+				<p>Try password "xxx" for user "uid:0" to access the stock trader web application.</p>
+				<p class="new-user">
+				<a href="register.php">First time user?</a>
+				</p>
+			</div>	
+		</div>
+			<div id="footer">
+				<div style="float:left;">Copyright 2008, WSO2 Inc.</div>
+				<div style="margin-left:432px;float:left;">Powered by 
+				<img align="top" src="images/powered-by-logo.gif" style="margin-top:-3px; margin-left: 0px;"/></div>
+			</div>
+		</div>
+	
+	</body>
+</html>