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 be...@apache.org on 2009/07/18 16:22:51 UTC

svn commit: r795391 - in /incubator/stonehenge/trunk/stocktrader/dotnet: business_service/BusinessServiceConfigurationSettings/ business_service/BusinessServiceConsole/ business_service/BusinessServiceImplementation/ business_service/OrderProcessorASyn...

Author: bendewey
Date: Sat Jul 18 16:22:50 2009
New Revision: 795391

URL: http://svn.apache.org/viewvc?rev=795391&view=rev
Log:
STONEHENGE-81 thanks Avantika, great to see all those switch statements removed, much simpler now.  I also like that we don't have the hard-coded endpoint name strings.

Modified:
    incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConfigurationSettings/Settings.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/App.config
    incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/Program.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.csproj
    incubator/stonehenge/trunk/stocktrader/dotnet/common/ConfigClient/ConfigClient.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/common/DALSQLServer/Config.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/common/IDAL/IConfig.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/common/OrderProcessorServiceConfigurationSettings/Settings.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/common/ServiceConfigurationSettings/Settings.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/Utility.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConfigurationSettings/Settings.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/App.config
    incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/Program.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceContract/IConfigService.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceDataContract/ConfigServiceDataContract.csproj
    incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceImplementation/ConfigService.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/App.config
    incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebAppSolution.sln
    incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebApplicationClients/BusinessServiceClient.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Account.aspx.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Controls/AccountOrders.ascx.cs
    incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConfigurationSettings/Settings.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConfigurationSettings/Settings.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConfigurationSettings/Settings.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConfigurationSettings/Settings.cs Sat Jul 18 16:22:50 2009
@@ -76,12 +76,12 @@
         //            WELL AS UPDATE SETTINGS ON LIVE CLUSTERED SYSTEMS WITHOUT APP RESTARTS.
         public static string EVENT_LOG;
         public static string CS_DOTNET_ENDPOINT_CONFIG_HTTP;
-        public static string OPS_DOTNET_ENDPOINT_CONFIG_HTTP;
-        public static string OPS_DOTNET_ENDPOINT_CONFIG_WSHTTP;
-        public static string OPS_PHP_ENDPOINT_CONFIG_HTTP;
-        public static string OPS_PHP_ENDPOINT_CONFIG_WSHTTP;
-        public static string OPS_WSAS_ENDPOINT_CONFIG_HTTP;
-        public static string OPS_WSAS_ENDPOINT_CONFIG_WSHTTP;
+        //public static string OPS_DOTNET_ENDPOINT_CONFIG_HTTP;
+        //public static string OPS_DOTNET_ENDPOINT_CONFIG_WSHTTP;
+        //public static string OPS_PHP_ENDPOINT_CONFIG_HTTP;
+        //public static string OPS_PHP_ENDPOINT_CONFIG_WSHTTP;
+        //public static string OPS_WSAS_ENDPOINT_CONFIG_HTTP;
+        //public static string OPS_WSAS_ENDPOINT_CONFIG_WSHTTP;
         public static string DBServer; 
         public static string Database; 
         public static string UserID; 
@@ -98,6 +98,7 @@
         public static int LOGIN_ITERATIONSTO_DISPLAY;
         public static string BSL_VALID_USERID;
         public static string BSL_VALID_PASSWORD;
+        public static string BS_LABEL;
 
         
         //End Repository Settings -----------------------------------
@@ -127,14 +128,9 @@
             Settings.MAX_QUERY_TOP_ORDERS = Convert.ToInt32(ConfigurationManager.AppSettings.Get("MAX_QUERY_TOP_ORDERS"));
             Settings.DISPLAY_WEBSERVICE_LOGINS = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("DISPLAY_WEBSERVICE_LOGINS"));
             Settings.LOGIN_ITERATIONSTO_DISPLAY = Convert.ToInt32(ConfigurationManager.AppSettings.Get("LOGIN_ITERATIONSTO_DISPLAY"));
-            Settings.OPS_DOTNET_ENDPOINT_CONFIG_HTTP = ConfigurationManager.AppSettings.Get("OPS_DOTNET_ENDPOINT_CONFIG_HTTP");
-            Settings.OPS_DOTNET_ENDPOINT_CONFIG_WSHTTP = ConfigurationManager.AppSettings.Get("OPS_DOTNET_ENDPOINT_CONFIG_WSHTTP");
-            Settings.OPS_PHP_ENDPOINT_CONFIG_HTTP = ConfigurationManager.AppSettings.Get("OPS_PHP_ENDPOINT_CONFIG_HTTP");
-            Settings.OPS_PHP_ENDPOINT_CONFIG_WSHTTP = ConfigurationManager.AppSettings.Get("OPS_PHP_ENDPOINT_CONFIG_WSHTTP");
-            Settings.OPS_WSAS_ENDPOINT_CONFIG_HTTP = ConfigurationManager.AppSettings.Get("OPS_WSAS_ENDPOINT_CONFIG_HTTP");
-            Settings.OPS_WSAS_ENDPOINT_CONFIG_WSHTTP = ConfigurationManager.AppSettings.Get("OPS_WSAS_ENDPOINT_CONFIG_WSHTTP");
             Settings.BSL_VALID_USERID = ConfigurationManager.AppSettings.Get("BSL_VALID_USERID");
             Settings.BSL_VALID_PASSWORD = ConfigurationManager.AppSettings.Get("BSL_VALID_PASSWORD");
+            Settings.BS_LABEL = ConfigurationManager.AppSettings.Get("BS_LABEL");
             buildConnString();
             setTxModel();
         }

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/App.config
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/App.config?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/App.config (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/App.config Sat Jul 18 16:22:50 2009
@@ -44,13 +44,14 @@
     <add key="DISPLAYNUMBERORDERITERATIONS" value="3" />
     <!--Can't be ZERO-->
     <add key="CS_DOTNET_ENDPOINT_CONFIG_HTTP" value="ConfigClient_DotNet_BasicHttpBinding"/>
-    <add key="OPS_DOTNET_ENDPOINT_CONFIG_HTTP" value="OpsClient_DotNet_BasicHttpBinding" />
-    <add key="OPS_DOTNET_ENDPOINT_CONFIG_WSHTTP" value="OpsClient_DotNet_WsHttpBinding_MSec" />
-    <add key="OPS_PHP_ENDPOINT_CONFIG_HTTP" value="OpsClient_PHP_BasicHttpBinding" />
-    <add key="OPS_PHP_ENDPOINT_CONFIG_WSHTTP" value="OpsClient_PHP_WsHttpBinding_MSec" />
-    <add key="OPS_WSAS_ENDPOINT_CONFIG_HTTP" value="OpsClient_WSAS_BasicHttpBinding" />
-    <add key="OPS_WSAS_ENDPOINT_CONFIG_WSHTTP" value="OpsClient_WSAS_WsHttpBinding_MSec" />
+    <add key="DOTNET_OPS" value="OpsClient_DotNet_BasicHttpBinding" />
+    <add key="DOTNET_OPSSEC" value="OpsClient_DotNet_WsHttpBinding_MSec" />
+    <add key="PHP_OPS" value="OpsClient_PHP_BasicHttpBinding" />
+    <add key="PHP_OPSSEC" value="OpsClient_PHP_WsHttpBinding_MSec" />
+    <add key="JAVA_OPS" value="OpsClient_WSAS_BasicHttpBinding" />
+    <add key="JAVA_OPSSEC" value="OpsClient_WSAS_WsHttpBinding_MSec" />
     <add key="ClientSettingsProvider.ServiceUri" value="" />
+    <add key="BS_LABEL" value="DOTNET_BS"/>
   </appSettings>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/Program.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/Program.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/Program.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceConsole/Program.cs Sat Jul 18 16:22:50 2009
@@ -147,7 +147,7 @@
                     //Test to see what the database specifies as the Order Processing Mode
                     var configClient = new ConfigServiceClient();
                     var bsRequest = new BSConfigRequest();
-                    bsRequest.BSName = "DOTNET_BS";
+                    bsRequest.BSName = Trade.BusinessServiceConfigurationSettings.Settings.BS_LABEL;
                     var bsConfig = configClient.GetBSConfig(bsRequest);
 
                     Console.WriteLine(" ORDER_PROCESSING_MODE is currently = {0}\n", bsConfig.OPSName);

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceImplementation/TradeService.cs Sat Jul 18 16:22:50 2009
@@ -118,15 +118,14 @@
             // Get Config
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
                 throw new Exception(string.Format(StockTraderUtility.EXCEPTION_MESSAGE_BAD_CONFIG, bsRequest.BSName));
 
             //Create instance of a DAL, which could be designed for any type of DB backend.
-            //TODO: This is the DAL for MSSQL but not for MySQL - find a way to toggle the DAL based on bsConfig.DBName
-            dalCustomer = Trade.DALFactory.Customer.Create("Trade.DALSQLServer");
+            dalCustomer = Trade.DALFactory.Customer.Create(SQLHelper.GetAssemblyNameFromDBName(bsConfig.DBName));
             
             //As feature of the StockTrader DAL, you will see dal.Open, dal.BeginTransaction, dal.CommitTransaction,
             //dal.AbortTransaction and dal.Close methods being invoked in the BSL. The pattern  within this BSL is:
@@ -188,7 +187,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -224,7 +223,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -258,7 +257,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -292,7 +291,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -326,7 +325,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -360,7 +359,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -395,7 +394,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -430,7 +429,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -470,7 +469,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -597,7 +596,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -631,7 +630,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -665,7 +664,7 @@
         {
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)
@@ -752,7 +751,7 @@
 
             var configClient = new ConfigServiceClient();
             var bsRequest = new BSConfigRequest();
-            bsRequest.BSName = "DOTNET_BS";
+            bsRequest.BSName = Settings.BS_LABEL;
             var bsConfig = configClient.GetBSConfig(bsRequest);
 
             if (bsConfig == null)

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.cs Sat Jul 18 16:22:50 2009
@@ -44,6 +44,7 @@
 using System.Runtime.Serialization;
 using System.Globalization;
 using System.Reflection;
+using System.Configuration;
 using Trade.BusinessServiceDataContract;
 using Trade.OrderProcessorContract;
 using Trade.BusinessServiceConfigurationSettings;
@@ -62,7 +63,6 @@
     public class TradeOrderServiceAsyncClient : IOrderProcessor
     {
         public Client.Client opsclient;
-        private string _clientConfig;
 
         /// <summary>
         /// This will initialize the correct client/endpoint based on the OrderMode setting the user has set
@@ -71,45 +71,14 @@
         /// <param name="orderMode">The order mode, determines what type of binding/remote interface is used for communication.</param>
         public TradeOrderServiceAsyncClient(string orderMode)
         {
-            switch (orderMode)
+            try
+            {
+                opsclient = new Client.Client(typeof(IOrderProcessor), ConfigurationManager.AppSettings.Get(orderMode));
+            }
+            catch
             {
-                default:
-                    {
-                        throw new Exception("OrderMode not recognized");
-                    }
-                case StockTraderUtility.DOTNET_OPS:
-                    {
-                        _clientConfig = Settings.OPS_DOTNET_ENDPOINT_CONFIG_HTTP;
-                        break;
-                    }
-
-                case StockTraderUtility.DOTNET_OPSSEC:
-                    {
-                        _clientConfig = Settings.OPS_DOTNET_ENDPOINT_CONFIG_WSHTTP;
-                        break;
-                    }
-                case StockTraderUtility.PHP_OPS:
-                    {
-                        _clientConfig = Settings.OPS_PHP_ENDPOINT_CONFIG_HTTP;
-                        break;
-                    }
-                case StockTraderUtility.PHP_OPSSEC:
-                    {
-                        _clientConfig = Settings.OPS_PHP_ENDPOINT_CONFIG_WSHTTP;
-                        break;
-                    }
-                case StockTraderUtility.JAVA_OPS:
-                    {
-                        _clientConfig = Settings.OPS_WSAS_ENDPOINT_CONFIG_HTTP;
-                        break;
-                    }
-                case StockTraderUtility.JAVA_OPSSEC:
-                    {
-                        _clientConfig = Settings.OPS_WSAS_ENDPOINT_CONFIG_WSHTTP;
-                        break;
-                    }
+                throw new Exception("Order Mode not recognized");
             }
-            opsclient = new Client.Client(typeof(IOrderProcessor), _clientConfig);
         }
 
         /// <summary>

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.csproj
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.csproj?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.csproj (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/business_service/OrderProcessorASyncClient/OrderProcessorAsyncClient.csproj Sat Jul 18 16:22:50 2009
@@ -45,6 +45,7 @@
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
+    <Reference Include="System.configuration" />
     <Reference Include="System.Core">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/common/ConfigClient/ConfigClient.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/common/ConfigClient/ConfigClient.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/common/ConfigClient/ConfigClient.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/common/ConfigClient/ConfigClient.cs Sat Jul 18 16:22:50 2009
@@ -49,6 +49,7 @@
 using System.Configuration;
 using Trade.ConfigServiceContract;
 using Trade.ConfigServiceDataContract;
+using ConfigServiceDataContract;
 
 namespace Trade.ConfigClient
 {
@@ -129,6 +130,19 @@
             }
         }
 
+        public OPSConfigResponse GetOPSConfig(OPSConfigRequest ops)
+        {
+            try
+            {
+                return this.Channel.GetOPSConfig(ops);
+            }
+            catch
+            {
+                this.Channel = null;
+                throw;
+            }
+        }
+
         public void SetClientToBS(ClientToBS clientConfig)
         {
             try

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/common/DALSQLServer/Config.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/common/DALSQLServer/Config.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/common/DALSQLServer/Config.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/common/DALSQLServer/Config.cs Sat Jul 18 16:22:50 2009
@@ -119,6 +119,8 @@
 	WHERE b1.BS = @Bs) as b 
 INNER JOIN (SELECT 1 as Row, DBNAME, HOSTNAME, PORT FROM DBCONFIG WHERE ACTIVE='Y') as d 
 ON b.Row = d.Row";
+        private const string SQL_GET_OPS_CONFIG = @"SET NOCOUNT ON;
+SELECT d.DBNAME, d.HOSTNAME, d.PORT FROM dbo.DBCONFIG as d";
         private const string SQL_FIND_CLIENT_TO_BS = @"SET NOCOUNT ON;
 SELECT b.CLIENT, b.BS
 FROM dbo.CLIENTTOBS as b
@@ -197,6 +199,29 @@
             return response;
         }
 
+        /// <summary>
+        /// Finds the database configuration information from DBCONFIG for the Order Processing Service
+        /// </summary>
+        /// <param name="bs">Name of the Order Processing Service</param>
+        /// <returns>OPSConfigResponse object with config information on the DB connection info</returns>
+        public OPSConfigResponse GetOPSConfig(string ops)
+        {
+            SqlDataReader rdr = SQLHelper.ExecuteReaderNoParm(_internalConnection, _internalADOTransaction, CommandType.Text,
+                SQL_GET_OPS_CONFIG);
+
+            // Read and Gaurd
+            if (!rdr.Read())
+                return null;
+
+            var response = new OPSConfigResponse();
+            response.DBName = rdr.GetString(rdr.GetOrdinal("DBNAME"));
+            response.DBHostName = rdr.GetString(rdr.GetOrdinal("HOSTNAME"));
+            response.DBPort = rdr.GetInt32(rdr.GetOrdinal("PORT"));
+
+            rdr.Close();
+
+            return response;
+        }
 
         /// <summary>
         /// Sets a connection between the specified client and business service

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/common/IDAL/IConfig.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/common/IDAL/IConfig.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/common/IDAL/IConfig.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/common/IDAL/IConfig.cs Sat Jul 18 16:22:50 2009
@@ -41,10 +41,14 @@
         /// <returns>The client configuration for the supplied name</returns>
         ClientConfigResponse GetClientConfig(string client);
 
-        /// <param name="bs">the name of the bs to get the config for</param>
+        /// <param name="bs">the name of the BS to get the config for</param>
         /// <returns>the endpoint url of the business service that this client points to</returns>
         BSConfigResponse GetBSConfig(string bs);
 
+        /// <param name="bs">the name of the OPS to get the config for</param>
+        /// <returns>the DB Configuration information for the Order Processing Service</returns>
+        OPSConfigResponse GetOPSConfig(string ops);
+
         /// <summary>
         /// Sets a connection between the specified client and business service
         /// If no ClientToBS configuration entry exists for this client, it is created

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/common/OrderProcessorServiceConfigurationSettings/Settings.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/common/OrderProcessorServiceConfigurationSettings/Settings.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/common/OrderProcessorServiceConfigurationSettings/Settings.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/common/OrderProcessorServiceConfigurationSettings/Settings.cs Sat Jul 18 16:22:50 2009
@@ -79,6 +79,7 @@
         public static int SYSTEMDOTTRANSACTION_TIMEOUT;
         public static string ORDER_PROCESSING_BEHAVIOR;
         public static int DISPLAYNUMBERORDERITERATIONS;
+        public static string OPS_LABEL;
 
         public Settings()
         {
@@ -90,6 +91,7 @@
             Settings.SYSTEMDOTTRANSACTION_TIMEOUT = Convert.ToInt32(ConfigurationManager.AppSettings.Get("SYSTEMDOTTRANSACTION_TIMEOUT"));
             Settings.ORDER_PROCESSING_BEHAVIOR = ConfigurationManager.AppSettings.Get("ORDER_PROCESSING_BEHAVIOR");
             Settings.DISPLAYNUMBERORDERITERATIONS = Convert.ToInt32(ConfigurationManager.AppSettings.Get("DISPLAYNUMBERORDERITERATIONS"));
+            Settings.OPS_LABEL = ConfigurationManager.AppSettings.Get("OPS_LABEL");
             buildConnString();
         }
 

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/common/ServiceConfigurationSettings/Settings.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/common/ServiceConfigurationSettings/Settings.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/common/ServiceConfigurationSettings/Settings.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/common/ServiceConfigurationSettings/Settings.cs Sat Jul 18 16:22:50 2009
@@ -64,10 +64,6 @@
     /// </summary>
     public class Settings //db : ConfigurationSettingsBase   //Inherit from base implementation!!
     {
-        public static string BSL_DOTNET_ENDPOINT_CONFIG_HTTP;
-        public static string BSL_DOTNET_ENDPOINT_CONFIG_WSHTTP;
-        public static string BSL_PHP_ENDPOINT_CONFIG_HTTP;
-        public static string BSL_WSAS_ENDPOINT_CONFIG_HTTP;
         public static string BSL_USERID;
         public static string BSL_PASSWORD;
 
@@ -77,7 +73,9 @@
         public static bool CHECK_ORDER_ALERT_EVERY_REQUEST;
         public static int ORDER_ALERT_CHECK_FREQUENCY;
         public static string EVENT_LOG;
-      
+        public static string CLIENT_LABEL;
+        public static string BS_LABEL;
+
         public static int interfaceMode = -1;
 
         public static readonly string CACHE_KEY_CLOSED_ORDERSALERT = "O";
@@ -111,20 +109,17 @@
             Settings.DISPLAY_DUPLICATE_KEY_EXCEPTIONS = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("DISPLAY_DUPLICATE_KEY_EXCEPTIONS"));
             Settings.CHECK_ORDER_ALERT_EVERY_REQUEST = Convert.ToBoolean(ConfigurationManager.AppSettings.Get("DISPLAY_DUPLICATE_KEY_EXCEPTIONS"));
             Settings.ORDER_ALERT_CHECK_FREQUENCY = Convert.ToInt32(ConfigurationManager.AppSettings.Get("ORDER_ALERT_CHECK_FREQUENCY"));
-            Settings.BSL_DOTNET_ENDPOINT_CONFIG_HTTP = ConfigurationManager.AppSettings.Get("BSL_DOTNET_ENDPOINT_CONFIG_HTTP");
-            Settings.BSL_DOTNET_ENDPOINT_CONFIG_WSHTTP = ConfigurationManager.AppSettings.Get("BSL_DOTNET_ENDPOINT_CONFIG_WSHTTP");
-            Settings.BSL_PHP_ENDPOINT_CONFIG_HTTP = ConfigurationManager.AppSettings.Get("BSL_PHP_ENDPOINT_CONFIG_HTTP");
-            Settings.BSL_WSAS_ENDPOINT_CONFIG_HTTP = ConfigurationManager.AppSettings.Get("BSL_WSAS_ENDPOINT_CONFIG_HTTP");
             Settings.BSL_USERID = ConfigurationManager.AppSettings.Get("BSL_USERID");
-            Settings.BSL_PASSWORD = ConfigurationManager.AppSettings.Get("BSL_PASSWORD"); 
-            
+            Settings.BSL_PASSWORD = ConfigurationManager.AppSettings.Get("BSL_PASSWORD");
+            Settings.CLIENT_LABEL = ConfigurationManager.AppSettings.Get("CLIENT_LABEL");
+            Settings.BS_LABEL = ConfigurationManager.AppSettings.Get("BS_LABEL");
             setAccessMode();
 
         }
 
 
         /// <summary>
-        /// Sets the selected AccessMode to an int constant. Faster for switch statements than parsing a string.
+        /// sets an interface mode which is used to detect whether or not the DOTNET_CLIENT is being used.
         /// </summary>
         static public int setAccessMode()
         {
@@ -132,40 +127,12 @@
             //Configuration Settings specified in the database i.e. the row containing DOTNET_CLIENT
             var configClient = new ConfigServiceClient();
             var clientRequest = new ClientConfigRequest();
-            clientRequest.ClientName = "DOTNET_CLIENT";
+            clientRequest.ClientName = Settings.CLIENT_LABEL;
             var clientConfig = configClient.GetClientConfig(clientRequest);
 
-            switch (clientConfig.BSName)
+            if (clientConfig.BSName.Equals(Settings.BS_LABEL))
             {
-                case StockTraderUtility.DOTNET_BS:
-                    {
-                        interfaceMode = StockTraderUtility.ACCESS_DotNet_Http_WcfService;
-                        break;
-                    }
-
-                case StockTraderUtility.DOTNET_BSSEC:
-                    {
-                        interfaceMode = StockTraderUtility.ACCESS_DotNet_WsHttp_WcfService;
-                        break;
-                    }
-
-                case StockTraderUtility.PHP_BS:
-                    {
-                        interfaceMode = StockTraderUtility.ACCESS_PHP_Http_WebService;
-                        break;
-                    }
-                
-                case StockTraderUtility.JAVA_BS:
-                    {
-                        interfaceMode = StockTraderUtility.ACCESS_WSAS_Http_WebService;
-                        break;
-                    }
-
-
-                default:
-                    {
-                        throw new Exception(clientConfig.BSName + ": " + StockTraderUtility.EXCEPTION_MESSAGE_INVALID_ACCESSMODE_CONFIG);
-                    }
+                    interfaceMode = 1;
             }
             return interfaceMode;
         }

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/SQLHelper.cs Sat Jul 18 16:22:50 2009
@@ -347,5 +347,13 @@
                 + ";database=StockTraderDB"
                 + ";user id=trade;password=yyy";
         }
+
+        public static string GetAssemblyNameFromDBName(string DBName)
+        {
+           if (DBName.Equals("MSSQL"))
+                return "Trade.DALSQLServer";
+           else
+               throw new Exception("Database name, "+ DBName+", not supported");
+        }
     }
 }
\ No newline at end of file

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/Utility.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/Utility.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/Utility.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/common/StockTraderUtility/Utility.cs Sat Jul 18 16:22:50 2009
@@ -94,50 +94,6 @@
         public static readonly decimal JUNK_STOCK_MIRACLE_MULTIPLIER = 500m;
         public static readonly int STOCK_CHANGE_MAX_PERCENT = 5;
 
-
-        //Valid Config Values for user-set "AccessMode" config setting.  Note in all cases, the same
-        //WCF client (that inherits from LoadBalancingClient) is used.  Just the binding and service host name varies.
-        public const string ACCESS_STRING_DotNet_Http_WcfService = "DotNet_Http_WcfService";
-        public const string ACCESS_STRING_DotNet_WsHttp_WcfService = "DotNet_WsHttp_WcfService";
-        public const string ACCESS_STRING_PHP_Http_WebService = "PHP_Http_WebService";
-        public const string ACCESS_STRING_WSAS_Http_WebService = "WSAS_Http_WebService";
-       
-        //Map string/user-friendly modes to ints for faster lookups
-        public const int ACCESS_DotNet_Http_WcfService = 1;
-        public const int ACCESS_DotNet_WsHttp_WcfService = 2;
-        public const int ACCESS_PHP_Http_WebService = 3;
-        public const int ACCESS_WSAS_Http_WebService = 4;
-
-        //Valid Config Values for user-set "OrderMode" config setting.
-        public const string ORDER_STRING_ASync_DotNet_Http = "ASync_DotNet_Http";
-        public const string ORDER_STRING_ASync_DotNet_WsHttp_MSec = "ASync_DotNet_WsHttp_MSecurity";
-        public const string ORDER_STRING_ASync_PHP_Http = "ASync_PHP_Http";
-        public const string ORDER_STRING_ASync_PHP_WsHttp_MSec = "ASync_PHP_WsHttp_MSecurity";
-        public const string ORDER_STRING_ASync_WSAS_Http = "ASync_WSAS_Http";
-        public const string ORDER_STRING_ASync_WSAS_WsHttp_MSec = "ASync_WSAS_WsHttp_MSecurity";
-
-        //OrderMode constants
-        public const int ORDER_ASync_DotNet_Http = 1;
-        public const int ORDER_ASync_DotNet_WsHttp_MSec = 2;
-        public const int ORDER_ASync_PHP_Http = 3;
-        public const int ORDER_ASync_PHP_WsHttp_MSec = 4;
-        public const int ORDER_ASync_WSAS_Http = 5;
-        public const int ORDER_ASync_WSAS_WsHttp_MSec = 6;
-
-        //Strings for the database configuration system, which specify the order mode
-        public const string DOTNET_OPS = "DOTNET_OPS";
-        public const string DOTNET_OPSSEC = "DOTNET_OPSSEC";
-        public const string PHP_OPS = "PHP_OPS";
-        public const string PHP_OPSSEC = "PHP_OPSSEC";
-        public const string JAVA_OPS = "JAVA_OPS";
-        public const string JAVA_OPSSEC = "JAVA_OPSSEC";
-
-        //Strings for the database configuration system, which specifu the access mode
-        public const string DOTNET_BS = "DOTNET_BS";
-        public const string DOTNET_BSSEC = "DOTNET_BSSEC";
-        public const string PHP_BS = "PHP_BS";
-        public const string JAVA_BS = "JAVA_BS";
-
         //map user strings to ints for faster lookups. We want to catch invalid settings
         //so the user knows what tx model they are running within a service.
         public const string TRANSACTION_STRING_SYSTEMDOTTRANSACTION_TRANSACTION = "true";

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConfigurationSettings/Settings.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConfigurationSettings/Settings.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConfigurationSettings/Settings.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConfigurationSettings/Settings.cs Sat Jul 18 16:22:50 2009
@@ -68,6 +68,8 @@
         public static int MaxDBConnections;
         public static string TRADEDB_SQL_CONN_STRING;
         public static string DAL;
+        public static string BS_LABEL;
+        public static string CLIENT_LABEL;
 
 
         public Settings()
@@ -80,6 +82,8 @@
             Settings.MinDBConnections = Convert.ToInt32(ConfigurationManager.AppSettings.Get("MinDBConnections"));
             Settings.MaxDBConnections = Convert.ToInt32(ConfigurationManager.AppSettings.Get("MaxDBConnections"));
             Settings.DAL = ConfigurationManager.AppSettings.Get("DAL");
+            Settings.BS_LABEL = ConfigurationManager.AppSettings.Get("BS_LABEL");
+            Settings.CLIENT_LABEL = ConfigurationManager.AppSettings.Get("CLIENT_LABEL");
             buildConnString();
         }
 

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/App.config
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/App.config?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/App.config (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/App.config Sat Jul 18 16:22:50 2009
@@ -25,17 +25,17 @@
 -->
 <configuration>
   <appSettings>
-    <add key="DBServer" value="localhost" />
+    <add key="DBServer" value="localhost\SQLExpress" />
     <add key="Database" value="StockTraderDB" />
     <add key="UserID" value="trade" />
     <add key="Password" value="yyy" />
     <add key="MinDBConnections" value="20" />
     <add key="MaxDBConnections" value="20" />
     <add key="DAL" value="Trade.DALSQLServer" />
-    <!--<add key="ENABLE_GLOBAL_SYSTEM_DOT_TRANSACTIONS_CONFIGSTRING" value="true" />
-    <add key="SYSTEMDOTTRANSACTION_TIMEOUT" value="30" />
-    <add key="DISPLAYNUMBERORDERITERATIONS" value="3" />-->
     <add key="ClientSettingsProvider.ServiceUri" value="" />
+    <add key="CLIENT_LABEL" value="DOTNET_CLIENT"/>
+    <add key="BS_LABEL" value="DOTNET_BS"/>
+    
   </appSettings>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/Program.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/Program.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/Program.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceConsoleHost/Program.cs Sat Jul 18 16:22:50 2009
@@ -138,12 +138,12 @@
                     var proxy = client.CreateChannel(new EndpointAddress(GetUri()));
 
                     var request = new ClientConfigRequest();
-                    request.ClientName = "DOTNET_CLIENT";
+                    request.ClientName = Settings.CLIENT_LABEL;
                     var response = proxy.GetClientConfig(request);
 
                     Console.ForegroundColor = ConsoleColor.Green;
                     Console.WriteLine("Test Success");
-                    Console.WriteLine(" Current DOTNET_CLIENT-> BS = {0}", response.BS);
+                    Console.WriteLine(" Current DOTNET_CLIENT-> BS = {0}", response.BSName);
                     Console.ForegroundColor = ConsoleColor.Gray;
                 }
                 catch (Exception ex)
@@ -166,14 +166,17 @@
                     client.Endpoint.Binding = new BasicHttpBinding();
                     var proxy = client.CreateChannel(new EndpointAddress(GetUri()));
 
-                    var request = new BSConfigRequest();
-                    request.BSName = "DOTNET_BS";
-                    var bs = proxy.GetBSConfig(request);
+                    var request = new ClientConfigRequest();
+                    request.ClientName = Settings.CLIENT_LABEL;
+                    var response = proxy.GetClientConfig(request);
+                    var bsrequest = new BSConfigRequest();
+                    bsrequest.BSName = response.BSName;
+                    var bs = proxy.GetBSConfig(bsrequest);
 
                     Console.ForegroundColor = ConsoleColor.Green;
                     Console.WriteLine("Test Success");
-                    Console.WriteLine(" Current DOTNET_BS-> OPS = {0}", bs.OPS);
-                    Console.WriteLine(" Current DOTNET_BS-> DBHost = {0}", bs.DBHostName);
+                    Console.WriteLine(" Current {0}-> OPS = {1}", response.BSName, bs.OPSName);
+                    Console.WriteLine(" Current {0}-> DBHost = {1}", response.BSName, bs.DBHostName);
                     Console.ForegroundColor = ConsoleColor.Gray;
                 }
                 catch (Exception ex)

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceContract/IConfigService.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceContract/IConfigService.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceContract/IConfigService.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceContract/IConfigService.cs Sat Jul 18 16:22:50 2009
@@ -19,6 +19,7 @@
 
 using System.ServiceModel;
 using Trade.ConfigServiceDataContract;
+using ConfigServiceDataContract;
 
 namespace Trade.ConfigServiceContract
 {
@@ -47,6 +48,12 @@
         BSConfigResponse GetBSConfig(BSConfigRequest bs);
 
         /// <summary>
+        /// Get configurations of an order processor service
+        /// </summary>
+        [OperationContract]
+        OPSConfigResponse GetOPSConfig(OPSConfigRequest ops);
+
+        /// <summary>
         /// Sets connection from client to business service
         /// </summary>
         [OperationContract(Action = "ClientToBS")]
@@ -122,11 +129,6 @@
         [OperationContract(Action = "GetBSToOPSConnections")]
         BSToOPS[] GetBSToOPSConnections();
 
-        /// <summary>
-        /// Get configurations of a order processor service
-        /// </summary>
-        [OperationContract]
-        OPSConfigResponse GetOPSConfig(OPSConfigRequest ops);
         ********************************************************************************/
 
     }

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceDataContract/ConfigServiceDataContract.csproj
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceDataContract/ConfigServiceDataContract.csproj?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceDataContract/ConfigServiceDataContract.csproj (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceDataContract/ConfigServiceDataContract.csproj Sat Jul 18 16:22:50 2009
@@ -50,6 +50,7 @@
     <Compile Include="BSConfigRequest.cs" />
     <Compile Include="BSConfigResponse.cs" />
     <Compile Include="BSToOPS.cs" />
+    <Compile Include="OPSConfigRequest.cs" />
     <Compile Include="OPSConfigResponse.cs" />
     <Compile Include="ClientConfigRequest.cs" />
     <Compile Include="ClientConfigResponse.cs" />

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceImplementation/ConfigService.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceImplementation/ConfigService.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceImplementation/ConfigService.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/config_service/ConfigServiceImplementation/ConfigService.cs Sat Jul 18 16:22:50 2009
@@ -33,6 +33,7 @@
 using Trade.IDAL;
 using Trade.DALFactory;
 using Trade.Utility;
+using ConfigServiceDataContract;
 
 
 namespace Trade.ConfigServiceImplementation
@@ -78,6 +79,17 @@
             return ans;
         }
 
+        public OPSConfigResponse GetOPSConfig(OPSConfigRequest ops)
+        {
+            dalConfig = startDAL();
+
+            OPSConfigResponse ans = dalConfig.GetOPSConfig(ops.OPSName);
+
+            dalConfig.Close();
+
+            return ans;
+        }
+
         public void SetClientToBS(ClientToBS clientConfig)
         {
             dalConfig = startDAL();

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/App.config
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/App.config?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/App.config (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorConsoleServiceHost/App.config Sat Jul 18 16:22:50 2009
@@ -33,6 +33,7 @@
     <add key="SYSTEMDOTTRANSACTION_TIMEOUT" value="30" />
     <add key="DISPLAYNUMBERORDERITERATIONS" value="3" />
     <add key="CS_DOTNET_ENDPOINT_CONFIG_HTTP" value="ConfigClient_DotNet_BasicHttpBinding"/>
+    <add key="OPS_LABEL" value="DOTNET_OPS"/>
   </appSettings>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/order_processor/OrderProcessorImplementation/ProcessOrder.cs Sat Jul 18 16:22:50 2009
@@ -50,6 +50,7 @@
 using Trade.Utility;
 using Trade.ConfigClient;
 using Trade.ConfigServiceDataContract;
+using ConfigServiceDataContract;
 
 
 namespace Trade.OrderProcessorImplementation
@@ -63,19 +64,17 @@
             try
             {
                 //Get the DB Config information from the database
-                //TODO: This should ideally use GetOPSConfig("DOTNET_OPS") but the DBConfig info will still be the same
                 var configClient = new ConfigServiceClient();
-                var bsRequest = new BSConfigRequest();
-                bsRequest.BSName = "DOTNET_BS";
-                var bsConfig = configClient.GetBSConfig(bsRequest);
+                var opsRequest = new OPSConfigRequest();
+                opsRequest.OPSName = Settings.OPS_LABEL;
+                var opsConfig = configClient.GetOPSConfig(opsRequest);
 
-                if (bsConfig == null)
-                    throw new Exception(string.Format(StockTraderUtility.EXCEPTION_MESSAGE_BAD_CONFIG, bsRequest.BSName));
+                if (opsConfig == null)
+                    throw new Exception(string.Format(StockTraderUtility.EXCEPTION_MESSAGE_BAD_CONFIG, opsRequest.OPSName));
 
                 //Create instance of a DAL, which could be designed for any type of DB backend.
-                //TODO: Replace he hardcoded DAL String - perhaps include this info in the database?
-                dalOrder = Trade.DALFactory.Order.Create("Trade.DALSQLServer");
-                var connectionString = SQLHelper.GenerateSqlServerConnectionString(bsConfig.DBHostName, bsConfig.DBPort);
+                dalOrder = Trade.DALFactory.Order.Create(SQLHelper.GetAssemblyNameFromDBName(opsConfig.DBName));
+                var connectionString = SQLHelper.GenerateSqlServerConnectionString(opsConfig.DBHostName, opsConfig.DBPort);
                 dalOrder.Open(connectionString);
 
 

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebAppSolution.sln
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebAppSolution.sln?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebAppSolution.sln (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebAppSolution.sln Sat Jul 18 16:22:50 2009
@@ -51,6 +51,10 @@
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessServiceContract", "..\business_service\BusinessServiceContract\BusinessServiceContract.csproj", "{36FA3564-9AF5-496A-805B-6ED262CAAE2B}"
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ConfigService", "ConfigService", "{2C0CE48A-C1A0-454D-BED9-8636406D7DFC}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BusinessService", "BusinessService", "{2F109EA4-F2B9-4CED-BCAE-A7BBDAC8F28C}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|.NET = Debug|.NET
@@ -185,6 +189,13 @@
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
+	GlobalSection(NestedProjects) = preSolution
+		{82B5FA73-8A82-4DC0-B473-43B78543668B} = {2C0CE48A-C1A0-454D-BED9-8636406D7DFC}
+		{5A192168-838E-4DD1-A5E9-9EE191B941FE} = {2C0CE48A-C1A0-454D-BED9-8636406D7DFC}
+		{B0D086A8-B168-4DCD-8D2C-6F08CE159B5C} = {2C0CE48A-C1A0-454D-BED9-8636406D7DFC}
+		{36FA3564-9AF5-496A-805B-6ED262CAAE2B} = {2F109EA4-F2B9-4CED-BCAE-A7BBDAC8F28C}
+		{EBB1604B-3F50-4A81-87C3-1AE4029EEEC6} = {2F109EA4-F2B9-4CED-BCAE-A7BBDAC8F28C}
+	EndGlobalSection
 	GlobalSection(SubversionScc) = preSolution
 		Svn-Managed = True
 		Manager = AnkhSVN - Subversion Support for Visual Studio

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebApplicationClients/BusinessServiceClient.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebApplicationClients/BusinessServiceClient.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebApplicationClients/BusinessServiceClient.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/StockTraderWebApplicationClients/BusinessServiceClient.cs Sat Jul 18 16:22:50 2009
@@ -33,6 +33,7 @@
 using System.Runtime.Serialization;
 using System.Collections.Generic;
 using System.Threading;
+using System.Configuration;
 using Trade.BusinessServiceContract;
 using Trade.BusinessServiceDataContract;
 using Trade.StockTraderWebApplicationSettings;
@@ -63,14 +64,14 @@
             //be recognized without restarts
             Initialize();
           
-            string endpointConfigName = null;
+            //string endpointConfigName = null;
             
 
             //Using the database configuration system - this BusinessServiceClient is created based on the CLIENTTOBS
             //Configuration Settings specified in the database i.e. the row containing DOTNET_CLIENT
             var configClient = new ConfigServiceClient();
             var clientRequest = new ClientConfigRequest();
-            clientRequest.ClientName = "DOTNET_CLIENT";
+            clientRequest.ClientName = Settings.CLIENT_LABEL;
             var clientConfig = configClient.GetClientConfig(clientRequest);
 
             //In case the client cannot be properly configured from the database, look up the default ACCESSMODE from the 
@@ -82,43 +83,21 @@
 
             //If configuration information was properly received from the database then choose the appropriate business
             //service based on the info in the CLIENTTOBS table i.e. the row with DOTNET_CLIENT
-            switch (clientConfig.BSName)
+            try
             {
-                case StockTraderUtility.DOTNET_BS:
-                    {
-                        endpointConfigName = Settings.BSL_DOTNET_ENDPOINT_CONFIG_HTTP;
-                        bslclient = new Client.Client(typeof(ITradeServices), endpointConfigName);
-                        break;
-                    }
-
-                case StockTraderUtility.DOTNET_BSSEC:
-                    {
-                        endpointConfigName = Settings.BSL_DOTNET_ENDPOINT_CONFIG_WSHTTP;
-                        bslclient = new Client.Client(typeof(ITradeServices), endpointConfigName, Settings.BSL_USERID, Settings.BSL_PASSWORD);
-                        break;
-                    }
-
-                case StockTraderUtility.PHP_BS:
-                    {
-                        endpointConfigName = Settings.BSL_PHP_ENDPOINT_CONFIG_HTTP;
-                        bslclient = new Client.Client(typeof(ITradeServices), endpointConfigName, Settings.BSL_USERID, Settings.BSL_PASSWORD);
-                        break;
-                    }
-
-                case StockTraderUtility.JAVA_BS:
-                    {
-                        endpointConfigName = Settings.BSL_WSAS_ENDPOINT_CONFIG_HTTP;
-                        bslclient = new Client.Client(typeof(ITradeServices), endpointConfigName, Settings.BSL_USERID, Settings.BSL_PASSWORD);
-                        break;
-                    }
-
-                default:
-                    {
-                        throw new Exception(string.Format(StockTraderUtility.EXCEPTION_MESSAGE_BAD_CONFIG, clientRequest.ClientName));
-
-                    }
+                if (clientConfig.BSName.Equals(Settings.BS_LABEL))
+                {
+                    bslclient = new Client.Client(typeof(ITradeServices), ConfigurationManager.AppSettings.Get(clientConfig.BSName));
+                }
+                else
+                {
+                    bslclient = new Client.Client(typeof(ITradeServices), ConfigurationManager.AppSettings.Get(clientConfig.BSName), Settings.BSL_USERID, Settings.BSL_PASSWORD);
+                }
             }
-            
+            catch
+            {
+                throw new Exception(string.Format(StockTraderUtility.EXCEPTION_MESSAGE_BAD_CONFIG, clientRequest.ClientName));
+            }             
         }
 
 

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Account.aspx.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Account.aspx.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Account.aspx.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Account.aspx.cs Sat Jul 18 16:22:50 2009
@@ -42,8 +42,7 @@
             string action = Request.QueryString["action"] ?? string.Empty;
 
             if (action.Equals("showtoporders", StringComparison.InvariantCultureIgnoreCase)
-                && (Settings.interfaceMode == StockTraderUtility.ACCESS_PHP_Http_WebService
-                    || Settings.interfaceMode == StockTraderUtility.ACCESS_WSAS_Http_WebService))
+                && (Settings.interfaceMode != 1))
             {
                 NumOrdersShown.Text = AccountOrdersControl.totalOrders.ToString();
                 WASLimit.Text = "<div style=\"font-size:8pt;color:darkred\">WebSphere Trade 6.1 Returns a Maximum of 5 Orders!</div>";

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Configuration.aspx.cs Sat Jul 18 16:22:50 2009
@@ -41,7 +41,7 @@
             {
                 ConfigServiceClient configClient = new ConfigServiceClient();
                 ClientToBS clientRequest = new ClientToBS();
-                clientRequest.Client = "DOTNET_CLIENT";
+                clientRequest.Client = Settings.CLIENT_LABEL;
                 clientRequest.Bs = this.BsName.SelectedItem.Value;
                 BSToOPS bsRequest = new BSToOPS();
                 bsRequest.Bs = this.BsName.SelectedItem.Value;
@@ -96,7 +96,7 @@
             {
                 //Select the current configuration settings as the default values in the dropdown list
                 ClientConfigRequest existingClientConfig = new ClientConfigRequest();
-                existingClientConfig.ClientName = "DOTNET_CLIENT";
+                existingClientConfig.ClientName = Settings.CLIENT_LABEL;
                 BsName.SelectedValue = configClient.GetClientConfig(existingClientConfig).BSName;
 
                 BSConfigRequest existingBsConfig = new BSConfigRequest();

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Controls/AccountOrders.ascx.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Controls/AccountOrders.ascx.cs?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Controls/AccountOrders.ascx.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Controls/AccountOrders.ascx.cs Sat Jul 18 16:22:50 2009
@@ -45,8 +45,7 @@
             string action = Request.QueryString["action"] ?? string.Empty;
             
             if (action.Equals("showtoporders", StringComparison.InvariantCultureIgnoreCase)
-                && Settings.interfaceMode != StockTraderUtility.ACCESS_WSAS_Http_WebService
-                && Settings.interfaceMode != StockTraderUtility.ACCESS_PHP_Http_WebService)
+                && Settings.interfaceMode == 1)
             {
                 ordersRequested = Settings.MAX_DISPLAY_TOP_ORDERS;
                 orderData = businessServicesClient.getTopOrders(userid);

Modified: incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config?rev=795391&r1=795390&r2=795391&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/trader_client/Trade/Web.config Sat Jul 18 16:22:50 2009
@@ -36,12 +36,14 @@
     <add key="CHECK_ORDER_ALERT_EVERY_REQUEST" value="true"/>
     <add key="ORDER_ALERT_CHECK_FREQUENCY" value="30"/>
     <add key="CS_DOTNET_ENDPOINT_CONFIG_HTTP" value="ConfigClient_DotNet_BasicHttpBinding"/>
-    <add key="BSL_DOTNET_ENDPOINT_CONFIG_HTTP" value="BsClient_DotNet_BasicHttpBinding"/>
-    <add key="BSL_DOTNET_ENDPOINT_CONFIG_WSHTTP" value="BsClient_DotNet_WsHttpBinding"/>
-    <add key="BSL_PHP_ENDPOINT_CONFIG_HTTP" value="BsClient_PHP_BasicHttpBinding"/>
-    <add key="BSL_WSAS_ENDPOINT_CONFIG_HTTP" value="BsClient_WSAS_BasicHttpBinding"/>
+    <add key="DOTNET_BS" value="BsClient_DotNet_BasicHttpBinding"/>
+    <add key="DOTNET_BSSEC" value="BsClient_DotNet_WsHttpBinding"/>
+    <add key="PHP_BS" value="BsClient_PHP_BasicHttpBinding"/>
+    <add key="JAVA_BS" value="BsClient_WSAS_BasicHttpBinding"/>
     <add key="BSL_USERID" value="bsloperationuser"/>
     <add key="BSL_PASSWORD" value="yyy"/>
+    <add key="CLIENT_LABEL" value="DOTNET_CLIENT"/>
+    <add key="BS_LABEL" value="DOTNET_BS"/>
   </appSettings>
   <runtime>
     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">