TIBCO EMS QuickStart
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.EmsQuickStart.Integration.Tests.2005", "test\Spring\Spring.EmsQuickStart.Integration.Tests\Spring.EmsQuickStart.Integration.Tests.2005.csproj", "{E641F51F-1B51-4B94-B419-F902EABCE4D4}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.EmsQuickStart.Tests.2005", "test\Spring\Spring.EmsQuickStart.Tests\Spring.EmsQuickStart.Tests.2005.csproj", "{94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.EmsQuickStart.Common", "src\Spring\Spring.EmsQuickStart.Common\Spring.EmsQuickStart.Common.csproj", "{AC5A3035-75DD-48E5-ABCA-38FBC8193F22}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.EmsQuickStart.Server", "src\Spring\Spring.EmsQuickStart.Server\Spring.EmsQuickStart.Server.csproj", "{85E7B947-8153-45E4-B572-BEDB191F1FB2}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.EmsQuickStart.Client", "src\Spring\Spring.EmsQuickStart.Client\Spring.EmsQuickStart.Client.csproj", "{87D0B725-A652-4A6B-A95F-197F7155769F}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Core.2005", "..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj", "{710961A3-0DF4-49E4-A26E-F5B9C044AC84}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Aop.2005", "..\..\..\src\Spring\Spring.Aop\Spring.Aop.2005.csproj", "{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Data.2005", "..\..\..\src\Spring\Spring.Data\Spring.Data.2005.csproj", "{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Spring.Messaging.Ems.2005", "..\..\..\src\Spring\Spring.Messaging.Ems\Spring.Messaging.Ems.2005.csproj", "{900E3839-301E-48B1-BAEB-B6645620ACFF}"
|
||||
ProjectSection(WebsiteProperties) = preProject
|
||||
Debug.AspNetCompiler.Debug = "True"
|
||||
Release.AspNetCompiler.Debug = "False"
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E641F51F-1B51-4B94-B419-F902EABCE4D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E641F51F-1B51-4B94-B419-F902EABCE4D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E641F51F-1B51-4B94-B419-F902EABCE4D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E641F51F-1B51-4B94-B419-F902EABCE4D4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AC5A3035-75DD-48E5-ABCA-38FBC8193F22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AC5A3035-75DD-48E5-ABCA-38FBC8193F22}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AC5A3035-75DD-48E5-ABCA-38FBC8193F22}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AC5A3035-75DD-48E5-ABCA-38FBC8193F22}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{85E7B947-8153-45E4-B572-BEDB191F1FB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{85E7B947-8153-45E4-B572-BEDB191F1FB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{85E7B947-8153-45E4-B572-BEDB191F1FB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{85E7B947-8153-45E4-B572-BEDB191F1FB2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{87D0B725-A652-4A6B-A95F-197F7155769F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{87D0B725-A652-4A6B-A95F-197F7155769F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{87D0B725-A652-4A6B-A95F-197F7155769F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{87D0B725-A652-4A6B-A95F-197F7155769F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{710961A3-0DF4-49E4-A26E-F5B9C044AC84}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{900E3839-301E-48B1-BAEB-B6645620ACFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{900E3839-301E-48B1-BAEB-B6645620ACFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{900E3839-301E-48B1-BAEB-B6645620ACFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{900E3839-301E-48B1-BAEB-B6645620ACFF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
|
||||
<sectionGroup name="spring">
|
||||
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
|
||||
</sectionGroup>
|
||||
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
|
||||
</configSections>
|
||||
|
||||
<spring>
|
||||
|
||||
<context>
|
||||
<resource uri="~/Config/Messaging.xml"/>
|
||||
<resource uri="~/Config/Application.xml"/>
|
||||
</context>
|
||||
|
||||
<parsers>
|
||||
|
||||
<parser type="Spring.Messaging.Ems.Config.EmsNamespaceParser, Spring.Messaging.Ems" />
|
||||
|
||||
</parsers>
|
||||
|
||||
|
||||
</spring>
|
||||
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="showLogName" value="true" />
|
||||
<arg key="showDataTime" value="true" />
|
||||
<arg key="level" value="INFO" />
|
||||
<arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net"
|
||||
xmlns:Ems="http://www.springframework.net/ems">
|
||||
|
||||
<!-- MVC objects -->
|
||||
<object id="StockController" type="Spring.EmsQuickStart.Client.UI.StockController, Spring.EmsQuickStart.Client">
|
||||
<property name="StockService" ref="StockServiceGateway"/>
|
||||
</object>
|
||||
|
||||
<object name="StockAppHandler" type="Spring.EmsQuickStart.Client.Handlers.StockAppHandler, Spring.EmsQuickStart.Client">
|
||||
<property name="StockController" ref="StockController"/>
|
||||
</object>
|
||||
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net"
|
||||
xmlns:ems="http://www.springframework.net/ems">
|
||||
|
||||
|
||||
|
||||
<object id="ConnectionFactory" type="Spring.Messaging.Ems.Common.EmsConnectionFactory, Spring.Messaging.Ems">
|
||||
<constructor-arg index="0" value="tcp://localhost:7222"/>
|
||||
</object>
|
||||
|
||||
<!-- EMS based implementation of technology neutral IStockServiceGateway -->
|
||||
<object name="StockServiceGateway" type="Spring.EmsQuickStart.Client.Gateways.EmsStockServiceGateway, Spring.EmsQuickStart.Client">
|
||||
<property name="EmsTemplate" ref="EmsTemplate"/>
|
||||
<property name="DefaultReplyToQueue">
|
||||
<object type="TIBCO.EMS.Queue, TIBCO.EMS">
|
||||
<constructor-arg value="APP.STOCK.JOE"/>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
|
||||
<object name="EmsTemplate" type="Spring.Messaging.Ems.Core.EmsTemplate, Spring.Messaging.Ems">
|
||||
<property name="ConnectionFactory" ref="ConnectionFactory"/>
|
||||
<property name="DefaultDestinationName" value="APP.STOCK.REQUEST"/>
|
||||
<property name="MessageConverter" ref="XmlMessageConverter"/>
|
||||
</object>
|
||||
|
||||
|
||||
<ems:listener-container connection-factory="ConnectionFactory">
|
||||
<ems:listener ref="MessageListenerAdapter" destination="APP.STOCK.JOE" />
|
||||
<ems:listener ref="MessageListenerAdapter" destination="APP.STOCK.MARKETDATA" pubsub-domain="true"/>
|
||||
</ems:listener-container>
|
||||
|
||||
|
||||
<!-- Plain object message handler -->
|
||||
<object id="MessageListenerAdapter" type="Spring.Messaging.Ems.Listener.Adapter.MessageListenerAdapter, Spring.Messaging.Ems">
|
||||
<property name="HandlerObject" ref="StockAppHandler"/>
|
||||
<property name="DefaultHandlerMethod" value="Handle"/>
|
||||
<!-- converter from JMS object to plain object -->
|
||||
<property name="MessageConverter" ref="XmlMessageConverter"/>
|
||||
</object>
|
||||
|
||||
|
||||
<object name="XmlMessageConverter" type="Spring.EmsQuickStart.Common.Converters.XmlMessageConverter, Spring.EmsQuickStart.Common">
|
||||
<property name="TypeMapper" ref="TypeMapper"/>
|
||||
</object>
|
||||
|
||||
<object name="TypeMapper" type="Spring.EmsQuickStart.Common.Converters.TypeMapper, Spring.EmsQuickStart.Common">
|
||||
<!-- use simple configuation style -->
|
||||
<property name="DefaultNamespace" value="Spring.EmsQuickStart.Common.Data"/>
|
||||
<property name="DefaultAssemblyName" value="Spring.EmsQuickStart.Common"/>
|
||||
</object>
|
||||
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
|
||||
using System;
|
||||
using Spring.Messaging.Ems.Core;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
using Spring.Objects.Factory;
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.Gateways
|
||||
{
|
||||
public class EmsStockServiceGateway : EmsGatewaySupport, IStockService
|
||||
{
|
||||
private Destination defaultReplyToQueue;
|
||||
|
||||
public Destination DefaultReplyToQueue
|
||||
{
|
||||
set { defaultReplyToQueue = value; }
|
||||
}
|
||||
|
||||
public void Send(TradeRequest tradeRequest)
|
||||
{
|
||||
EmsTemplate.ConvertAndSendWithDelegate(tradeRequest, delegate(Message message)
|
||||
{
|
||||
message.ReplyTo = defaultReplyToQueue;
|
||||
message.CorrelationID = new Guid().ToString();
|
||||
return message;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
using Spring.Messaging.Ems.Core;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.Gateways
|
||||
{
|
||||
public class EmsSyncStockServiceGateway : EmsGatewaySupport, ISyncStockService
|
||||
{
|
||||
public TradeResponse Send(TradeRequest tradeRequest)
|
||||
{
|
||||
RequestReplyEmsTemplate requestReplyNmsTemplate = (RequestReplyEmsTemplate) EmsTemplate;
|
||||
return (TradeResponse)requestReplyNmsTemplate.ConvertAndSendRequestReply(tradeRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.Gateways
|
||||
{
|
||||
public interface IStockService
|
||||
{
|
||||
void Send(TradeRequest tradeRequest);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.Gateways
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// <author>Mark Pollack</author>
|
||||
public interface ISyncStockService
|
||||
{
|
||||
TradeResponse Send(TradeRequest tradeRequest);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using Spring.Messaging.Ems.Core;
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.Gateways
|
||||
{
|
||||
/// <summary>
|
||||
/// Not used in the example application but included to show how one could layer on top of
|
||||
/// EMS a synchronous request reply interaction. This implementation uses temporary queues but
|
||||
/// another approach would be to use a permanent queue with a message selector unique to the request.
|
||||
/// </summary>
|
||||
public class RequestReplyEmsTemplate : EmsTemplate
|
||||
{
|
||||
public object ConvertAndSendRequestReply(object objectToSend)
|
||||
{
|
||||
|
||||
return Execute(delegate(ISession session, IMessageProducer producer)
|
||||
{
|
||||
TemporaryQueue tempQueue = null;
|
||||
try
|
||||
{
|
||||
tempQueue = session.CreateTemporaryQueue();
|
||||
this.ConvertAndSendWithDelegate(objectToSend, delegate(Message message)
|
||||
{
|
||||
message.ReplyTo = tempQueue;
|
||||
return message;
|
||||
});
|
||||
return ReceiveAndConvert(tempQueue);
|
||||
}
|
||||
finally
|
||||
{
|
||||
//TODO use Admin API
|
||||
//if (tempQueue != null) session.DeleteDestination(tempQueue);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Collections;
|
||||
using Common.Logging;
|
||||
using Spring.EmsQuickStart.Client.UI;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.Handlers
|
||||
{
|
||||
public class StockAppHandler
|
||||
{
|
||||
#region Logging Definition
|
||||
|
||||
private readonly ILog log = LogManager.GetLogger(typeof(StockAppHandler));
|
||||
|
||||
#endregion
|
||||
|
||||
private StockController stockController;
|
||||
|
||||
|
||||
public StockController StockController
|
||||
{
|
||||
get { return stockController; }
|
||||
set { stockController = value; }
|
||||
}
|
||||
|
||||
public void Handle(Hashtable data)
|
||||
{
|
||||
log.Info(string.Format("Received market data. Ticker = {0}, Price = {1}", data["TICKER"], data["PRICE"]));
|
||||
|
||||
// forward to controller to update view
|
||||
stockController.UpdateMarketData(data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void Handle(TradeResponse tradeResponse)
|
||||
{
|
||||
log.Info(string.Format("Received trade resonse. Ticker = {0}, Price = {1}", tradeResponse.Ticker, tradeResponse.Price));
|
||||
stockController.UpdateTrade(tradeResponse);
|
||||
}
|
||||
|
||||
public void Handle(object catchAllObject)
|
||||
{
|
||||
log.Error("could not handle object of type = " + catchAllObject.GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Common.Logging;
|
||||
using Spring.Context;
|
||||
using Spring.Context.Support;
|
||||
using Spring.EmsQuickStart.Client.UI;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(Program));
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
try
|
||||
{
|
||||
log.Info("Running....");
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
using (IApplicationContext ctx = ContextRegistry.GetContext())
|
||||
{
|
||||
StockForm stockForm = new StockForm();
|
||||
Application.ThreadException += ThreadException;
|
||||
Application.Run(stockForm);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.Error("Spring.EmsQuickStart.Client is broken.", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
log.Error("Uncaught application exception.", e.Exception);
|
||||
Application.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Spring.EmsQuickStart.Client")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Spring.EmsQuickStart.Client")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("aff1d9ab-7818-4748-8234-8a78e5631899")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.3053
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Spring.EmsQuickStart.Client.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.3053
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,127 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{87D0B725-A652-4A6B-A95F-197F7155769F}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.EmsQuickStart.Client</RootNamespace>
|
||||
<AssemblyName>Spring.EmsQuickStart.Client</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Common.Logging, Version=1.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="TIBCO.EMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b83db8ff05c64ba, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\lib\Net\2.0\TIBCO.EMS.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Gateways\EmsSyncStockServiceGateway.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Gateways\IStockService.cs" />
|
||||
<Compile Include="Gateways\EmsStockServiceGateway.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Handlers\StockAppHandler.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="UI\StockForm.resx">
|
||||
<DependentUpon>StockForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="UI\StockController.cs" />
|
||||
<Compile Include="UI\StockForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UI\StockForm.designer.cs">
|
||||
<DependentUpon>StockForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Aop\Spring.Aop.2005.csproj">
|
||||
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
|
||||
<Name>Spring.Aop.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Data\Spring.Data.2005.csproj">
|
||||
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
|
||||
<Name>Spring.Data.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Messaging.Ems\Spring.Messaging.Ems.2005.csproj">
|
||||
<Project>{900E3839-301E-48B1-BAEB-B6645620ACFF}</Project>
|
||||
<Name>Spring.Messaging.Ems.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.EmsQuickStart.Common\Spring.EmsQuickStart.Common.csproj">
|
||||
<Project>{AC5A3035-75DD-48E5-ABCA-38FBC8193F22}</Project>
|
||||
<Name>Spring.EmsQuickStart.Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Config\Application.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Config\Messaging.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,75 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
using System.Collections;
|
||||
using Spring.EmsQuickStart.Client.Gateways;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.UI
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles requests from the UI and forwards them to the remote service. Messages recieved from
|
||||
/// the service routed through this controller to update the UI.
|
||||
/// </summary>
|
||||
public class StockController
|
||||
{
|
||||
private StockForm stockForm;
|
||||
|
||||
private IStockService stockService;
|
||||
|
||||
public StockForm StockForm
|
||||
{
|
||||
get { return stockForm; }
|
||||
set { stockForm = value; }
|
||||
}
|
||||
|
||||
public IStockService StockService
|
||||
{
|
||||
get { return stockService; }
|
||||
set { stockService = value; }
|
||||
}
|
||||
|
||||
public void SendTradeRequest()
|
||||
{
|
||||
TradeRequest tradeRequest = new TradeRequest();
|
||||
tradeRequest.AccountName = "ACCT-123";
|
||||
tradeRequest.BuyRequest = true;
|
||||
tradeRequest.OrderType = "MARKET";
|
||||
tradeRequest.Quantity = 314000000;
|
||||
tradeRequest.RequestID = "REQ-1";
|
||||
tradeRequest.Ticker = "CSCO";
|
||||
tradeRequest.UserName = "Joe Trader";
|
||||
|
||||
stockService.Send(tradeRequest);
|
||||
}
|
||||
|
||||
public void UpdateMarketData(IDictionary marketDataDict)
|
||||
{
|
||||
stockForm.UpdateMarketData(marketDataDict);
|
||||
}
|
||||
|
||||
public void UpdateTrade(TradeResponse tradeResponse)
|
||||
{
|
||||
stockForm.UpdateTrade(tradeResponse);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
using Common.Logging;
|
||||
using Spring.Context.Support;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Client.UI
|
||||
{
|
||||
public partial class StockForm : Form
|
||||
{
|
||||
#region Logging Definition
|
||||
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof (StockForm));
|
||||
|
||||
#endregion
|
||||
|
||||
private StockController stockController;
|
||||
|
||||
public StockForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
stockController = ContextRegistry.GetContext()["StockController"] as StockController;
|
||||
stockController.StockForm = this;
|
||||
}
|
||||
|
||||
public StockController Controller
|
||||
{
|
||||
set { stockController = value; }
|
||||
}
|
||||
|
||||
private void OnSendTradeRequest(object sender, EventArgs e)
|
||||
{
|
||||
//In this simple example no data is collected from the view.
|
||||
//Instead a hardcoded trade request is created in the controller.
|
||||
tradeRequestStatusTextBox.Text = "Request Pending...";
|
||||
stockController.SendTradeRequest();
|
||||
log.Info("Sent trade request.");
|
||||
}
|
||||
|
||||
public void UpdateTrade(TradeResponse trade)
|
||||
{
|
||||
Invoke(new MethodInvoker(
|
||||
delegate
|
||||
{
|
||||
tradeRequestStatusTextBox.Text = "Confirmed. " + trade.Ticker + " " + trade.Price;
|
||||
}));
|
||||
}
|
||||
|
||||
public void UpdateMarketData(IDictionary marketDataDict)
|
||||
{
|
||||
Invoke(new MethodInvoker(
|
||||
delegate
|
||||
{
|
||||
marketDataListBox.Items.Add(marketDataDict["TICKER"] + " " + marketDataDict["PRICE"]);
|
||||
}));
|
||||
}
|
||||
|
||||
private void OnPortfolioRequest(object sender, EventArgs e)
|
||||
{
|
||||
MessageBox.Show("Get Portfolio operation not yet implemented.", "EmsQuickStart");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
127
examples/Spring/Spring.EmsQuickStart/src/Spring/Spring.EmsQuickStart.Client/UI/StockForm.designer.cs
generated
Normal file
127
examples/Spring/Spring.EmsQuickStart/src/Spring/Spring.EmsQuickStart.Client/UI/StockForm.designer.cs
generated
Normal file
@@ -0,0 +1,127 @@
|
||||
namespace Spring.EmsQuickStart.Client.UI
|
||||
{
|
||||
partial class StockForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.tradeRequestButton = new System.Windows.Forms.Button();
|
||||
this.tradeRequestStatusTextBox = new System.Windows.Forms.TextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.portfolioListBox = new System.Windows.Forms.ListBox();
|
||||
this.marketDataListBox = new System.Windows.Forms.ListBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tradeRequestButton
|
||||
//
|
||||
this.tradeRequestButton.Location = new System.Drawing.Point(12, 12);
|
||||
this.tradeRequestButton.Name = "tradeRequestButton";
|
||||
this.tradeRequestButton.Size = new System.Drawing.Size(135, 23);
|
||||
this.tradeRequestButton.TabIndex = 0;
|
||||
this.tradeRequestButton.Text = "Send Trade Request";
|
||||
this.tradeRequestButton.UseVisualStyleBackColor = true;
|
||||
this.tradeRequestButton.Click += new System.EventHandler(this.OnSendTradeRequest);
|
||||
//
|
||||
// tradeRequestStatusTextBox
|
||||
//
|
||||
this.tradeRequestStatusTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tradeRequestStatusTextBox.Location = new System.Drawing.Point(154, 13);
|
||||
this.tradeRequestStatusTextBox.Name = "tradeRequestStatusTextBox";
|
||||
this.tradeRequestStatusTextBox.Size = new System.Drawing.Size(340, 20);
|
||||
this.tradeRequestStatusTextBox.TabIndex = 1;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(12, 41);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(135, 23);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Get Portfolio";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.OnPortfolioRequest);
|
||||
//
|
||||
// portfolioListBox
|
||||
//
|
||||
this.portfolioListBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.portfolioListBox.FormattingEnabled = true;
|
||||
this.portfolioListBox.Location = new System.Drawing.Point(154, 41);
|
||||
this.portfolioListBox.Name = "portfolioListBox";
|
||||
this.portfolioListBox.Size = new System.Drawing.Size(340, 108);
|
||||
this.portfolioListBox.TabIndex = 3;
|
||||
//
|
||||
// marketDataListBox
|
||||
//
|
||||
this.marketDataListBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.marketDataListBox.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(177)));
|
||||
this.marketDataListBox.FormattingEnabled = true;
|
||||
this.marketDataListBox.ItemHeight = 14;
|
||||
this.marketDataListBox.Location = new System.Drawing.Point(90, 155);
|
||||
this.marketDataListBox.Name = "marketDataListBox";
|
||||
this.marketDataListBox.Size = new System.Drawing.Size(404, 102);
|
||||
this.marketDataListBox.TabIndex = 4;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(12, 155);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(72, 13);
|
||||
this.label1.TabIndex = 5;
|
||||
this.label1.Text = "Market Data :";
|
||||
//
|
||||
// StockForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(506, 269);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.marketDataListBox);
|
||||
this.Controls.Add(this.portfolioListBox);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.tradeRequestStatusTextBox);
|
||||
this.Controls.Add(this.tradeRequestButton);
|
||||
this.Name = "StockForm";
|
||||
this.Text = "TradeForm";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button tradeRequestButton;
|
||||
private System.Windows.Forms.TextBox tradeRequestStatusTextBox;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.ListBox portfolioListBox;
|
||||
private System.Windows.Forms.ListBox marketDataListBox;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
|
||||
namespace Spring.NmsQuickStart.Common.Bo
|
||||
{
|
||||
public class Trade
|
||||
{
|
||||
private string ticker;
|
||||
|
||||
private long quantity;
|
||||
|
||||
private double price;
|
||||
|
||||
private string orderType;
|
||||
|
||||
|
||||
public string Ticker
|
||||
{
|
||||
get { return ticker; }
|
||||
set { ticker = value; }
|
||||
}
|
||||
|
||||
public long Quantity
|
||||
{
|
||||
get { return quantity; }
|
||||
set { quantity = value; }
|
||||
}
|
||||
|
||||
public double Price
|
||||
{
|
||||
get { return price; }
|
||||
set { price = value; }
|
||||
}
|
||||
|
||||
public string OrderType
|
||||
{
|
||||
get { return orderType; }
|
||||
set { orderType = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace Spring.NmsQuickStart.Common.Bo
|
||||
{
|
||||
public class TradeRequest
|
||||
{
|
||||
private string ticker;
|
||||
|
||||
private long quantity;
|
||||
|
||||
private double price;
|
||||
|
||||
private string orderType;
|
||||
|
||||
private string accountName;
|
||||
|
||||
private bool buyRequest;
|
||||
|
||||
private string userName;
|
||||
|
||||
private string requestId;
|
||||
|
||||
|
||||
public string Ticker
|
||||
{
|
||||
get { return ticker; }
|
||||
set { ticker = value; }
|
||||
}
|
||||
|
||||
public long Quantity
|
||||
{
|
||||
get { return quantity; }
|
||||
set { quantity = value; }
|
||||
}
|
||||
|
||||
public double Price
|
||||
{
|
||||
get { return price; }
|
||||
set { price = value; }
|
||||
}
|
||||
|
||||
public string OrderType
|
||||
{
|
||||
get { return orderType; }
|
||||
set { orderType = value; }
|
||||
}
|
||||
|
||||
public string AccountName
|
||||
{
|
||||
get { return accountName; }
|
||||
set { accountName = value; }
|
||||
}
|
||||
|
||||
public bool BuyRequest
|
||||
{
|
||||
get { return buyRequest; }
|
||||
set { buyRequest = value; }
|
||||
}
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get { return userName; }
|
||||
set { userName = value; }
|
||||
}
|
||||
|
||||
public string RequestId
|
||||
{
|
||||
get { return requestId; }
|
||||
set { requestId = value; }
|
||||
}
|
||||
|
||||
public bool Validate(IList validationErrors)
|
||||
{
|
||||
// Not intended to be an example best practices for validation
|
||||
// The intention is to include some simple behavior in the class
|
||||
|
||||
if (userName == null)
|
||||
{
|
||||
validationErrors.Add("User name not specified");
|
||||
}
|
||||
if (requestId == null || requestId.Length == 0)
|
||||
{
|
||||
validationErrors.Add("Request Id not specified");
|
||||
}
|
||||
if (!orderType.Equals("MARKET"))
|
||||
{
|
||||
if (price <= 0)
|
||||
{
|
||||
validationErrors.Add("Market order must have a price");
|
||||
}
|
||||
}
|
||||
return validationErrors.Count > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
|
||||
using System;
|
||||
using Apache.NMS;
|
||||
using Spring.Objects.Factory;
|
||||
|
||||
namespace Spring.NmsQuickStart.Common.Converters
|
||||
{
|
||||
public abstract class AbstractNamedMessageConverter : INamedMessageConverter, IObjectNameAware
|
||||
{
|
||||
private string objectName;
|
||||
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return objectName; }
|
||||
set { objectName = value; }
|
||||
}
|
||||
|
||||
public abstract Type TargetType { get; }
|
||||
|
||||
public string ObjectName
|
||||
{
|
||||
set { objectName = value; }
|
||||
}
|
||||
|
||||
public abstract IMessage ToMessage(object objectToConvert, ISession session);
|
||||
public abstract object FromMessage(IMessage messageToConvert);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using Spring.Messaging.Nms.Support.Converter;
|
||||
|
||||
namespace Spring.NmsQuickStart.Common.Converters
|
||||
{
|
||||
public interface INamedMessageConverter : IMessageConverter
|
||||
{
|
||||
string Name { get; set; }
|
||||
|
||||
Type TargetType { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace Spring.EmsQuickStart.Common.Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides a layer of indirection when adding the 'type' of the object as a message property.
|
||||
/// </summary>
|
||||
/// <author>Mark Pollack</author>
|
||||
public interface ITypeMapper
|
||||
{
|
||||
string TypeIdFieldName
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
string FromType(Type typeOfObjectToConvert);
|
||||
|
||||
Type ToType(string typeId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Apache.NMS;
|
||||
using Spring.Messaging.Nms.Support.Converter;
|
||||
using Spring.Objects.Factory;
|
||||
|
||||
namespace Spring.NmsQuickStart.Common.Converters
|
||||
{
|
||||
public class MultiMessageConverter : IMessageConverter, IInitializingObject
|
||||
{
|
||||
private IMessageConverter defaultMessageConverter = new SimpleMessageConverter();
|
||||
|
||||
private IDictionary typeConverterMapping = new Hashtable();
|
||||
|
||||
private IDictionary nameConverterMapping = new Hashtable();
|
||||
|
||||
private IList namedMessageConverters = new ArrayList();
|
||||
|
||||
|
||||
public MultiMessageConverter()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public IList NamedMessageConverters
|
||||
{
|
||||
set { namedMessageConverters = value; }
|
||||
}
|
||||
|
||||
private string converterIdFieldName = "__ConverterId__";
|
||||
|
||||
public IMessage ToMessage(object objectToConvert, ISession session)
|
||||
{
|
||||
if (objectToConvert == null)
|
||||
{
|
||||
throw new MessageConversionException("Can't convert null object");
|
||||
}
|
||||
if (objectToConvert.GetType().Equals(typeof(string)) ||
|
||||
typeof(IDictionary).IsAssignableFrom(objectToConvert.GetType()) ||
|
||||
objectToConvert.GetType().Equals(typeof(Byte[])))
|
||||
{
|
||||
return defaultMessageConverter.ToMessage(objectToConvert, session);
|
||||
}
|
||||
else
|
||||
{
|
||||
INamedMessageConverter converter = GetConverterForType(objectToConvert.GetType());
|
||||
if (converter != null)
|
||||
{
|
||||
IMessage msg = converter.ToMessage(objectToConvert, session);
|
||||
msg.Properties.SetString(converterIdFieldName, converter.Name);
|
||||
return msg;
|
||||
}
|
||||
throw new MessageConversionException("Can't convert object of type " + objectToConvert.GetType());
|
||||
}
|
||||
}
|
||||
|
||||
private INamedMessageConverter GetConverterForType(Type typeOfObjectToConvert)
|
||||
{
|
||||
if (typeConverterMapping.Contains(typeOfObjectToConvert))
|
||||
{
|
||||
return typeConverterMapping[typeOfObjectToConvert] as INamedMessageConverter;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public object FromMessage(IMessage messageToConvert)
|
||||
{
|
||||
if (messageToConvert == null)
|
||||
{
|
||||
throw new MessageConversionException("Can't convert null message");
|
||||
}
|
||||
string converterId = messageToConvert.Properties.GetString(converterIdFieldName);
|
||||
if (converterId == null)
|
||||
{
|
||||
return defaultMessageConverter.FromMessage(messageToConvert);
|
||||
}
|
||||
else
|
||||
{
|
||||
IMessageConverter converter = GetConverterForId(converterId);
|
||||
if (converter != null)
|
||||
{
|
||||
return converter.FromMessage(messageToConvert);
|
||||
}
|
||||
throw new MessageConversionException("Can't convert message with ConverterId = " + converterId + ". Message = " + messageToConvert);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private IMessageConverter GetConverterForId(string converterName)
|
||||
{
|
||||
if (nameConverterMapping.Contains(converterName))
|
||||
{
|
||||
return nameConverterMapping[converterName] as IMessageConverter;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void AfterPropertiesSet()
|
||||
{
|
||||
foreach (INamedMessageConverter namedMessageConverter in namedMessageConverters)
|
||||
{
|
||||
nameConverterMapping.Add(namedMessageConverter.Name, namedMessageConverter);
|
||||
typeConverterMapping.Add(namedMessageConverter.TargetType, namedMessageConverter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
|
||||
|
||||
using System;
|
||||
using Apache.NMS;
|
||||
using Spring.Messaging.Nms.Support.Converter;
|
||||
using Spring.NmsQuickStart.Common.Bo;
|
||||
|
||||
namespace Spring.NmsQuickStart.Common.Converters
|
||||
{
|
||||
public class TradeConverter : AbstractNamedMessageConverter
|
||||
{
|
||||
public override Type TargetType
|
||||
{
|
||||
get { return typeof (Trade); }
|
||||
}
|
||||
|
||||
public override IMessage ToMessage(object objectToConvert, ISession session)
|
||||
{
|
||||
Trade trade = objectToConvert as Trade;
|
||||
if (trade == null)
|
||||
{
|
||||
throw new MessageConversionException("TradeConverter can not convert object of type " +
|
||||
objectToConvert.GetType());
|
||||
}
|
||||
try
|
||||
{
|
||||
IMapMessage mm = session.CreateMapMessage();
|
||||
|
||||
mm.Body.SetString("orderType", trade.OrderType);
|
||||
mm.Body.SetDouble("price", trade.Price);
|
||||
mm.Body.SetLong("quantity", trade.Quantity);
|
||||
mm.Body.SetString("ticker", trade.Ticker);
|
||||
|
||||
return mm;
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new MessageConversionException("Could not convert TradeRequest to message", e);
|
||||
}
|
||||
}
|
||||
|
||||
public override object FromMessage(IMessage messageToConvert)
|
||||
{
|
||||
IMapMessage mm = messageToConvert as IMapMessage;
|
||||
if (mm != null)
|
||||
{
|
||||
Trade trade = new Trade();
|
||||
trade.OrderType = mm.Body.GetString("orderType");
|
||||
trade.Price = mm.Body.GetDouble("price");
|
||||
trade.Quantity = mm.Body.GetLong("quantity");
|
||||
trade.Ticker = mm.Body.GetString("ticker");
|
||||
return trade;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new MessageConversionException("Not of expected type MapMessage. Message = " + messageToConvert);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using Apache.NMS;
|
||||
using Spring.Messaging.Nms.Support.Converter;
|
||||
using Spring.NmsQuickStart.Common.Bo;
|
||||
|
||||
namespace Spring.NmsQuickStart.Common.Converters
|
||||
{
|
||||
public class TradeRequestConverter : AbstractNamedMessageConverter
|
||||
{
|
||||
public override IMessage ToMessage(object objectToConvert, ISession session)
|
||||
{
|
||||
TradeRequest tradeRequest = objectToConvert as TradeRequest;
|
||||
if (tradeRequest == null)
|
||||
{
|
||||
throw new MessageConversionException("TradeRequestConverter can not convert object of type " +
|
||||
objectToConvert.GetType());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
IMapMessage mm = session.CreateMapMessage();
|
||||
|
||||
|
||||
mm.Body.SetString("accountName", tradeRequest.AccountName);
|
||||
mm.Body.SetBool("buyRequest", tradeRequest.BuyRequest);
|
||||
mm.Body.SetString("orderType", tradeRequest.OrderType);
|
||||
mm.Body.SetDouble("price", tradeRequest.Price);
|
||||
mm.Body.SetLong("quantity", tradeRequest.Quantity);
|
||||
mm.Body.SetString("requestId", tradeRequest.RequestId);
|
||||
mm.Body.SetString("ticker", tradeRequest.Ticker);
|
||||
mm.Body.SetString("username", tradeRequest.UserName);
|
||||
|
||||
return mm;
|
||||
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw new MessageConversionException("Could not convert TradeRequest to message", e);
|
||||
}
|
||||
}
|
||||
|
||||
public override object FromMessage(IMessage messageToConvert)
|
||||
{
|
||||
IMapMessage mm = messageToConvert as IMapMessage;
|
||||
if (mm != null)
|
||||
{
|
||||
TradeRequest tradeRequest = new TradeRequest();
|
||||
tradeRequest.AccountName = mm.Body.GetString("accountName");
|
||||
tradeRequest.BuyRequest = mm.Body.GetBool("buyRequest");
|
||||
tradeRequest.OrderType = mm.Body.GetString("orderType");
|
||||
tradeRequest.Price = mm.Body.GetDouble("price");
|
||||
tradeRequest.Quantity = mm.Body.GetLong("quantity");
|
||||
tradeRequest.RequestId = mm.Body.GetString("requestId");
|
||||
tradeRequest.Ticker = mm.Body.GetString("ticker");
|
||||
tradeRequest.UserName = mm.Body.GetString("username");
|
||||
|
||||
return tradeRequest;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new MessageConversionException("Not of expected type MapMessage. Message = " + messageToConvert);
|
||||
}
|
||||
}
|
||||
|
||||
public override Type TargetType
|
||||
{
|
||||
get { return typeof (TradeRequest); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using Spring.Core.TypeResolution;
|
||||
|
||||
namespace Spring.EmsQuickStart.Common.Converters
|
||||
{
|
||||
public class TypeMapper : ITypeMapper
|
||||
{
|
||||
private string defaultNamespace;
|
||||
private string defaultAssemblyName;
|
||||
|
||||
//Generics not used to support both 1.1 and 2.0
|
||||
private IDictionary idTypeMapping;
|
||||
private IDictionary typeIdMapping;
|
||||
|
||||
|
||||
//TODO generalize?
|
||||
private string defaultHashtableTypeId = "Hashtable";
|
||||
|
||||
private Type defaultHashtableClass = typeof(Hashtable);
|
||||
|
||||
public TypeMapper()
|
||||
{
|
||||
idTypeMapping = new Hashtable();
|
||||
typeIdMapping = new Hashtable();
|
||||
}
|
||||
|
||||
|
||||
public IDictionary IdTypeMapping
|
||||
{
|
||||
get { return idTypeMapping; }
|
||||
set { idTypeMapping = value; }
|
||||
}
|
||||
|
||||
public string TypeIdFieldName
|
||||
{
|
||||
get { return "__TypeId__"; }
|
||||
}
|
||||
|
||||
|
||||
public Type DefaultHashtableClass
|
||||
{
|
||||
set { defaultHashtableClass = value; }
|
||||
}
|
||||
|
||||
public string FromType(Type typeOfObjectToConvert)
|
||||
{
|
||||
|
||||
if (typeIdMapping.Contains(typeOfObjectToConvert))
|
||||
{
|
||||
return typeIdMapping[typeOfObjectToConvert] as string;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( typeof (IDictionary).IsAssignableFrom(typeOfObjectToConvert))
|
||||
{
|
||||
return defaultHashtableTypeId;
|
||||
}
|
||||
return typeOfObjectToConvert.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public Type ToType(string typeId)
|
||||
{
|
||||
if (idTypeMapping.Contains(typeId))
|
||||
{
|
||||
return idTypeMapping[typeId] as Type;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typeId.Equals(defaultHashtableTypeId))
|
||||
{
|
||||
return defaultHashtableClass;
|
||||
}
|
||||
string fullyQualifiedTypeName = defaultNamespace + "." +
|
||||
typeId + ", " +
|
||||
DefaultAssemblyName;
|
||||
return TypeResolutionUtils.ResolveType(fullyQualifiedTypeName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string DefaultNamespace
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultNamespace;
|
||||
}
|
||||
set
|
||||
{
|
||||
defaultNamespace = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public string DefaultAssemblyName
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultAssemblyName;
|
||||
}
|
||||
set
|
||||
{
|
||||
defaultAssemblyName = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void AfterPropertiesSet()
|
||||
{
|
||||
ValidateIdTypeMapping();
|
||||
if (DefaultAssemblyName != null && DefaultNamespace == null)
|
||||
{
|
||||
throw new ArgumentException("Default Namespace required when DefaultAssemblyName is set.");
|
||||
}
|
||||
if (DefaultNamespace != null && DefaultAssemblyName == null)
|
||||
{
|
||||
throw new ArgumentException("Default Assembly Name required when DefaultNamespace is set.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ValidateIdTypeMapping()
|
||||
{
|
||||
IDictionary finalIdTypeMapping = new Hashtable();
|
||||
foreach (DictionaryEntry entry in idTypeMapping)
|
||||
{
|
||||
string id = entry.Key.ToString();
|
||||
Type t = entry.Value as Type;
|
||||
if (t == null)
|
||||
{
|
||||
//convert from string value.
|
||||
string typeName = entry.Value.ToString();
|
||||
t = TypeResolutionUtils.ResolveType(typeName);
|
||||
}
|
||||
finalIdTypeMapping.Add(id,t);
|
||||
typeIdMapping.Add(t,id);
|
||||
|
||||
}
|
||||
idTypeMapping = finalIdTypeMapping;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using Spring.Messaging.Ems.Common;
|
||||
using TIBCO.EMS;
|
||||
using Spring.Messaging.Ems.Support.Converter;
|
||||
|
||||
namespace Spring.EmsQuickStart.Common.Converters
|
||||
{
|
||||
public class XmlMessageConverter : IMessageConverter
|
||||
{
|
||||
private IMessageConverter defaultMessageConverter = new SimpleMessageConverter();
|
||||
|
||||
|
||||
private ITypeMapper typeMapper;
|
||||
|
||||
|
||||
public ITypeMapper TypeMapper
|
||||
{
|
||||
set { typeMapper = value; }
|
||||
}
|
||||
|
||||
public Message ToMessage(object objectToConvert, ISession session)
|
||||
{
|
||||
if (objectToConvert == null)
|
||||
{
|
||||
throw new MessageConversionException("Can't convert null object");
|
||||
}
|
||||
try
|
||||
{
|
||||
if (objectToConvert.GetType().Equals(typeof (string)) ||
|
||||
typeof (IDictionary).IsAssignableFrom(objectToConvert.GetType()) ||
|
||||
objectToConvert.GetType().Equals(typeof (Byte[])))
|
||||
{
|
||||
return defaultMessageConverter.ToMessage(objectToConvert, session);
|
||||
}
|
||||
else
|
||||
{
|
||||
string xmlString = GetXmlString(objectToConvert);
|
||||
Message msg = session.CreateTextMessage(xmlString);
|
||||
msg.SetStringProperty(typeMapper.TypeIdFieldName, typeMapper.FromType(objectToConvert.GetType()));
|
||||
return msg;
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw new MessageConversionException("Can't convert object of type " + objectToConvert.GetType(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private string GetXmlString(object objectToConvert)
|
||||
{
|
||||
string xmlString;
|
||||
XmlTextWriter xmlTextWriter = null;
|
||||
MemoryStream memoryStream = null;
|
||||
try
|
||||
{
|
||||
memoryStream = new MemoryStream();
|
||||
xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
|
||||
XmlSerializer xs = new XmlSerializer(objectToConvert.GetType());
|
||||
xs.Serialize(xmlTextWriter, objectToConvert);
|
||||
xmlString = UTF8ByteArrayToString(((MemoryStream) xmlTextWriter.BaseStream).ToArray());
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw new MessageConversionException("Can't convert object of type " + objectToConvert.GetType(), e);
|
||||
} finally
|
||||
{
|
||||
if (memoryStream != null) memoryStream.Close();
|
||||
if (xmlTextWriter != null) xmlTextWriter.Close();
|
||||
}
|
||||
return xmlString;
|
||||
}
|
||||
|
||||
public object FromMessage(Message messageToConvert)
|
||||
{
|
||||
if (messageToConvert == null)
|
||||
{
|
||||
throw new MessageConversionException("Can't convert null message");
|
||||
}
|
||||
try
|
||||
{
|
||||
string converterId = messageToConvert.GetStringProperty(typeMapper.TypeIdFieldName);
|
||||
if (converterId == null)
|
||||
{
|
||||
return defaultMessageConverter.FromMessage(messageToConvert);
|
||||
}
|
||||
else
|
||||
{
|
||||
TextMessage textMessage = messageToConvert as TextMessage;
|
||||
if (textMessage == null)
|
||||
{
|
||||
throw new MessageConversionException("Can't convert message of type " +
|
||||
messageToConvert.GetType());
|
||||
}
|
||||
|
||||
using (MemoryStream memoryStream = new MemoryStream(StringToUTF8ByteArray(textMessage.Text)))
|
||||
{
|
||||
|
||||
XmlSerializer xs = new XmlSerializer(GetTargetType(textMessage));
|
||||
XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
|
||||
return xs.Deserialize(memoryStream);
|
||||
}
|
||||
}
|
||||
} catch (Exception e)
|
||||
{
|
||||
throw new MessageConversionException("Can't convert message of type " + messageToConvert.GetType(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private Type GetTargetType(TextMessage message)
|
||||
{
|
||||
return typeMapper.ToType(message.GetStringProperty(typeMapper.TypeIdFieldName));
|
||||
}
|
||||
|
||||
|
||||
private String UTF8ByteArrayToString(Byte[] characters)
|
||||
{
|
||||
UTF8Encoding encoding = new UTF8Encoding();
|
||||
|
||||
String constructedString = encoding.GetString(characters);
|
||||
|
||||
return (constructedString);
|
||||
}
|
||||
|
||||
|
||||
private Byte[] StringToUTF8ByteArray(String pXmlString)
|
||||
{
|
||||
UTF8Encoding encoding = new UTF8Encoding();
|
||||
|
||||
Byte[] byteArray = encoding.GetBytes(pXmlString);
|
||||
|
||||
return byteArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.1433
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// This source code was auto-generated by xsd, Version=2.0.50727.42.
|
||||
//
|
||||
namespace Spring.EmsQuickStart.Common.Data {
|
||||
using System.Xml.Serialization;
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
|
||||
[System.SerializableAttribute()]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.springframework.net/nms/common/2008-08-05")]
|
||||
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.springframework.net/nms/common/2008-08-05", IsNullable=false)]
|
||||
public partial class TradeRequest {
|
||||
|
||||
private string tickerField;
|
||||
|
||||
private long quantityField;
|
||||
|
||||
private decimal priceField;
|
||||
|
||||
private string orderTypeField;
|
||||
|
||||
private string accountNameField;
|
||||
|
||||
private bool buyRequestField;
|
||||
|
||||
private string userNameField;
|
||||
|
||||
private string requestIDField;
|
||||
|
||||
/// <remarks/>
|
||||
public string Ticker {
|
||||
get {
|
||||
return this.tickerField;
|
||||
}
|
||||
set {
|
||||
this.tickerField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public long Quantity {
|
||||
get {
|
||||
return this.quantityField;
|
||||
}
|
||||
set {
|
||||
this.quantityField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public decimal Price {
|
||||
get {
|
||||
return this.priceField;
|
||||
}
|
||||
set {
|
||||
this.priceField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public string OrderType {
|
||||
get {
|
||||
return this.orderTypeField;
|
||||
}
|
||||
set {
|
||||
this.orderTypeField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public string AccountName {
|
||||
get {
|
||||
return this.accountNameField;
|
||||
}
|
||||
set {
|
||||
this.accountNameField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public bool BuyRequest {
|
||||
get {
|
||||
return this.buyRequestField;
|
||||
}
|
||||
set {
|
||||
this.buyRequestField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public string UserName {
|
||||
get {
|
||||
return this.userNameField;
|
||||
}
|
||||
set {
|
||||
this.userNameField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public string RequestID {
|
||||
get {
|
||||
return this.requestIDField;
|
||||
}
|
||||
set {
|
||||
this.requestIDField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.springframework.net/nms/common/2008-08-05">
|
||||
<xs:element name="TradeRequest">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Ticker" type="xs:string"/>
|
||||
<xs:element name="Quantity" type="xs:long"/>
|
||||
<xs:element name="Price" type="xs:decimal"/>
|
||||
<xs:element name="OrderType" type="xs:string"/>
|
||||
<xs:element name="AccountName" type="xs:string"/>
|
||||
<xs:element name="BuyRequest" type="xs:boolean"/>
|
||||
<xs:element name="UserName" type="xs:string"/>
|
||||
<xs:element name="RequestID" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
|
||||
<XSDDesignerLayout Style="LeftRight" />
|
||||
@@ -0,0 +1,111 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:2.0.50727.1433
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// This source code was auto-generated by xsd, Version=2.0.50727.42.
|
||||
//
|
||||
namespace Spring.EmsQuickStart.Common.Data {
|
||||
using System.Xml.Serialization;
|
||||
|
||||
|
||||
/// <remarks/>
|
||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42")]
|
||||
[System.SerializableAttribute()]
|
||||
[System.Diagnostics.DebuggerStepThroughAttribute()]
|
||||
[System.ComponentModel.DesignerCategoryAttribute("code")]
|
||||
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.springframework.net/nms/common/2008-08-05")]
|
||||
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.springframework.net/nms/common/2008-08-05", IsNullable=false)]
|
||||
public partial class TradeResponse {
|
||||
|
||||
private string tickerField;
|
||||
|
||||
private long quantityField;
|
||||
|
||||
private decimal priceField;
|
||||
|
||||
private string orderTypeField;
|
||||
|
||||
private string confirmationNumberField;
|
||||
|
||||
private bool errorField;
|
||||
|
||||
private string errorMessageField;
|
||||
|
||||
/// <remarks/>
|
||||
public string Ticker {
|
||||
get {
|
||||
return this.tickerField;
|
||||
}
|
||||
set {
|
||||
this.tickerField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public long Quantity {
|
||||
get {
|
||||
return this.quantityField;
|
||||
}
|
||||
set {
|
||||
this.quantityField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public decimal Price {
|
||||
get {
|
||||
return this.priceField;
|
||||
}
|
||||
set {
|
||||
this.priceField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public string OrderType {
|
||||
get {
|
||||
return this.orderTypeField;
|
||||
}
|
||||
set {
|
||||
this.orderTypeField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public string ConfirmationNumber {
|
||||
get {
|
||||
return this.confirmationNumberField;
|
||||
}
|
||||
set {
|
||||
this.confirmationNumberField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public bool Error {
|
||||
get {
|
||||
return this.errorField;
|
||||
}
|
||||
set {
|
||||
this.errorField = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks/>
|
||||
public string ErrorMessage {
|
||||
get {
|
||||
return this.errorMessageField;
|
||||
}
|
||||
set {
|
||||
this.errorMessageField = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://www.springframework.net/nms/common/2008-08-05">
|
||||
<xs:element name="TradeResponse">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="Ticker" type="xs:string"/>
|
||||
<xs:element name="Quantity" type="xs:long"/>
|
||||
<xs:element name="Price" type="xs:decimal"/>
|
||||
<xs:element name="OrderType" type="xs:string"/>
|
||||
<xs:element name="ConfirmationNumber" type="xs:string"/>
|
||||
<xs:element name="Error" type="xs:boolean"/>
|
||||
<xs:element name="ErrorMessage" type="xs:string"/>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
</xs:schema>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--This file is auto-generated by the XML Schema Designer. It holds layout information for components on the designer surface.-->
|
||||
<XSDDesignerLayout Style="LeftRight" />
|
||||
@@ -0,0 +1,2 @@
|
||||
xsd.exe -c -l:c# -n:Spring.NmsQuickStart.Common.Data TradeResponse.xsd
|
||||
xsd.exe -c -l:c# -n:Spring.NmsQuickStart.Common.Data TradeRequest.xsd
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Spring.EmsQuickStart.Common")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Spring.EmsQuickStart.Common")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0d2c3d0f-af2f-47aa-9441-c3bd966f94f7")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,91 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AC5A3035-75DD-48E5-ABCA-38FBC8193F22}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.EmsQuickStart.Common</RootNamespace>
|
||||
<AssemblyName>Spring.EmsQuickStart.Common</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="TIBCO.EMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b83db8ff05c64ba, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\lib\Net\2.0\TIBCO.EMS.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Converters\ITypeMapper.cs" />
|
||||
<Compile Include="Converters\TypeMapper.cs" />
|
||||
<Compile Include="Converters\XmlMessageConverter.cs" />
|
||||
<Compile Include="Data\TradeResponse.cs">
|
||||
<DependentUpon>TradeResponse.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Data\TradeRequest.cs">
|
||||
<DependentUpon>TradeRequest.xsd</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Aop\Spring.Aop.2005.csproj">
|
||||
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
|
||||
<Name>Spring.Aop.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Data\Spring.Data.2005.csproj">
|
||||
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
|
||||
<Name>Spring.Data.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Messaging.Ems\Spring.Messaging.Ems.2005.csproj">
|
||||
<Project>{900E3839-301E-48B1-BAEB-B6645620ACFF}</Project>
|
||||
<Name>Spring.Messaging.Ems.2005</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Data\TradeResponse.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Data\TradeResponse.xsx">
|
||||
<DependentUpon>TradeResponse.xsd</DependentUpon>
|
||||
</None>
|
||||
<None Include="Data\TradeRequest.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="Data\TradeRequest.xsx">
|
||||
<DependentUpon>TradeRequest.xsd</DependentUpon>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
|
||||
<sectionGroup name="spring">
|
||||
<section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
|
||||
<section name="parsers" type="Spring.Context.Support.NamespaceParsersSectionHandler, Spring.Core"/>
|
||||
</sectionGroup>
|
||||
|
||||
<sectionGroup name="common">
|
||||
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
|
||||
</sectionGroup>
|
||||
|
||||
</configSections>
|
||||
|
||||
<spring>
|
||||
|
||||
<context>
|
||||
<resource uri="~/Config/Messaging.xml"/>
|
||||
<resource uri="~/Config/Handlers.xml"/>
|
||||
<resource uri="~/Config/ServiceStubs.xml"/>
|
||||
</context>
|
||||
|
||||
<parsers>
|
||||
|
||||
<parser type="Spring.Messaging.Ems.Config.EmsNamespaceParser, Spring.Messaging.Ems" />
|
||||
|
||||
</parsers>
|
||||
|
||||
|
||||
</spring>
|
||||
|
||||
<common>
|
||||
<logging>
|
||||
<factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging">
|
||||
<arg key="showLogName" value="true" />
|
||||
<arg key="showDataTime" value="true" />
|
||||
<arg key="level" value="INFO" />
|
||||
<arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
|
||||
</factoryAdapter>
|
||||
</logging>
|
||||
</common>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net">
|
||||
|
||||
<object name="StockAppHandler" type="Spring.EmsQuickStart.Server.Handlers.StockAppHandler, Spring.EmsQuickStart.Server">
|
||||
<constructor-arg ref="CreditCheckService"/>
|
||||
<constructor-arg ref="ExecutionVenueService"/>
|
||||
<constructor-arg ref="TradingService"/>
|
||||
</object>
|
||||
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net"
|
||||
xmlns:ems="http://www.springframework.net/ems">
|
||||
|
||||
<object id="ConnectionFactory" type="Spring.Messaging.Ems.Common.EmsConnectionFactory, Spring.Messaging.Ems">
|
||||
<constructor-arg index="0" value="tcp://localhost:7222"/>
|
||||
</object>
|
||||
|
||||
<object name="EmsTemplate" type="Spring.Messaging.Ems.Core.EmsTemplate, Spring.Messaging.Ems">
|
||||
<property name="ConnectionFactory" ref="ConnectionFactory"/>
|
||||
<property name="PubSubDomain" value="true"/>
|
||||
<property name="DefaultDestinationName" value="APP.STOCK.MARKETDATA"/>
|
||||
<property name="MessageConverter" ref="XmlMessageConverter"/>
|
||||
</object>
|
||||
|
||||
|
||||
<object name="MarketDataGateway" type="Spring.EmsQuickStart.Server.Gateways.MarketDataServiceGateway, Spring.EmsQuickStart.Server">
|
||||
<property name="EmsTemplate" ref="EmsTemplate"/>
|
||||
</object>
|
||||
|
||||
<!-- Consume messages on queue APP.STOCK.REQUEST -->
|
||||
<ems:listener-container connection-factory="ConnectionFactory" concurrency="10">
|
||||
<ems:listener ref="MessageListenerAdapter" destination="APP.STOCK.REQUEST" />
|
||||
</ems:listener-container>
|
||||
|
||||
<!-- Plain object message handler -->
|
||||
<object id="MessageListenerAdapter" type="Spring.Messaging.Ems.Listener.Adapter.MessageListenerAdapter, Spring.Messaging.Ems">
|
||||
<property name="HandlerObject" ref="StockAppHandler"/>
|
||||
<property name="DefaultHandlerMethod" value="Handle"/>
|
||||
<!-- converter from JMS object to plain object -->
|
||||
<property name="MessageConverter" ref="XmlMessageConverter"/>
|
||||
</object>
|
||||
|
||||
|
||||
<object name="XmlMessageConverter" type="Spring.EmsQuickStart.Common.Converters.XmlMessageConverter, Spring.EmsQuickStart.Common">
|
||||
<property name="TypeMapper" ref="TypeMapper"/>
|
||||
</object>
|
||||
|
||||
<object name="TypeMapper" type="Spring.EmsQuickStart.Common.Converters.TypeMapper, Spring.EmsQuickStart.Common">
|
||||
<!-- use simple configuation style -->
|
||||
<property name="DefaultNamespace" value="Spring.EmsQuickStart.Common.Data"/>
|
||||
<property name="DefaultAssemblyName" value="Spring.EmsQuickStart.Common"/>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<objects xmlns="http://www.springframework.net">
|
||||
|
||||
<object name="CreditCheckService" type="Spring.EmsQuickStart.Server.Services.Stubs.CreditCheckServiceStub, Spring.EmsQuickStart.Server"/>
|
||||
|
||||
<object name="ExecutionVenueService" type="Spring.EmsQuickStart.Server.Services.Stubs.ExecutionVenueServiceStub, Spring.EmsQuickStart.Server"/>
|
||||
|
||||
<object name="TradingService" type="Spring.EmsQuickStart.Server.Services.Stubs.TradingServiceStub, Spring.EmsQuickStart.Server"/>
|
||||
|
||||
</objects>
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Spring.EmsQuickStart.Server.Gateways
|
||||
{
|
||||
public interface IMarketDataService
|
||||
{
|
||||
void SendMarketData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
using Common.Logging;
|
||||
using Spring.Messaging.Ems.Core;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Gateways
|
||||
{
|
||||
public class MarketDataServiceGateway : EmsGatewaySupport, IMarketDataService
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof (MarketDataServiceGateway));
|
||||
|
||||
private readonly Random random;
|
||||
private TimeSpan sleepTimeInSeconds = new TimeSpan(0,0,0,10,0);
|
||||
|
||||
|
||||
public MarketDataServiceGateway()
|
||||
{
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
public TimeSpan SleepTimeInSeconds
|
||||
{
|
||||
set { sleepTimeInSeconds = value; }
|
||||
}
|
||||
|
||||
public void SendMarketData()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
IDictionary data = GenerateFakeMarketData();
|
||||
log.Info("Sending market data.");
|
||||
EmsTemplate.ConvertAndSend(data);
|
||||
log.Info("Sleeping " + sleepTimeInSeconds + " seconds before sending more market data.");
|
||||
Thread.Sleep(sleepTimeInSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
private IDictionary GenerateFakeMarketData()
|
||||
{
|
||||
IDictionary md = new Hashtable();
|
||||
md.Add("TICKER", "CSCO");
|
||||
md.Add("PRICE", string.Format("{0:##.##}", 22+Math.Abs(Gaussian())));
|
||||
return md;
|
||||
}
|
||||
|
||||
private double Gaussian()
|
||||
{
|
||||
double x1, x2, w;
|
||||
|
||||
do
|
||||
{
|
||||
x1 = 2.0*random.NextDouble() - 1.0;
|
||||
x2 = 2.0*random.NextDouble() - 1.0;
|
||||
w = x1*x1 + x2*x2;
|
||||
} while (w >= 1.0);
|
||||
|
||||
w = Math.Sqrt(-2.0*Math.Log(w)/w);
|
||||
|
||||
// two Gaussian random numbers are generated
|
||||
return x1*w;
|
||||
//y2 = x2 * w;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
using System;
|
||||
using Common.Logging;
|
||||
using Spring.Messaging.Ems.Core;
|
||||
using TIBCO.EMS;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Handlers
|
||||
{
|
||||
public class LoggingExceptionListener : IExceptionListener
|
||||
{
|
||||
#region Logging
|
||||
|
||||
private readonly ILog logger = LogManager.GetLogger(typeof(LoggingExceptionListener));
|
||||
|
||||
#endregion
|
||||
|
||||
public void OnException(EMSException exception)
|
||||
{
|
||||
logger.Info("********* Caught exception *************", exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
|
||||
using System.Collections;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
using Spring.EmsQuickStart.Server.Services;
|
||||
using Spring.Util;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Handlers
|
||||
{
|
||||
public class StockAppHandler
|
||||
{
|
||||
private IExecutionVenueService executionVenueService;
|
||||
|
||||
private ICreditCheckService creditCheckService;
|
||||
|
||||
private ITradingService tradingService;
|
||||
|
||||
public StockAppHandler(IExecutionVenueService executionVenueService, ICreditCheckService creditCheckService, ITradingService tradingService)
|
||||
{
|
||||
this.executionVenueService = executionVenueService;
|
||||
this.creditCheckService = creditCheckService;
|
||||
this.tradingService = tradingService;
|
||||
}
|
||||
|
||||
public TradeResponse Handle(TradeRequest tradeRequest)
|
||||
{
|
||||
TradeResponse tradeResponse;
|
||||
ArrayList errors = new ArrayList();
|
||||
if (creditCheckService.CanExecute(tradeRequest, errors))
|
||||
{
|
||||
tradeResponse = executionVenueService.ExecuteTradeRequest(tradeRequest);
|
||||
}
|
||||
else
|
||||
{
|
||||
tradeResponse = new TradeResponse();
|
||||
tradeResponse.Error = true;
|
||||
tradeResponse.ErrorMessage = StringUtils.ArrayToCommaDelimitedString(errors.ToArray());
|
||||
|
||||
}
|
||||
tradingService.ProcessTrade(tradeRequest, tradeResponse);
|
||||
return tradeResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using Spring.Context.Support;
|
||||
using Spring.EmsQuickStart.Server.Gateways;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Using Spring's IoC container
|
||||
ContextRegistry.GetContext(); // Force Spring to load configuration
|
||||
Console.Out.WriteLine("Server listening...");
|
||||
IMarketDataService marketDataService =
|
||||
ContextRegistry.GetContext().GetObject("MarketDataGateway") as MarketDataServiceGateway;
|
||||
ThreadStart job = new ThreadStart(marketDataService.SendMarketData);
|
||||
Thread thread = new Thread(job);
|
||||
thread.Start();
|
||||
Console.Out.WriteLine("--- Press <return> to quit ---");
|
||||
Console.ReadLine();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.Out.WriteLine(e);
|
||||
Console.Out.WriteLine("--- Press <return> to quit ---");
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Spring.EmsQuickStart.Server")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Spring.EmsQuickStart.Server")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2008")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("3e4b803d-86c9-4634-9b38-e29d70a083e0")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Collections;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Services
|
||||
{
|
||||
|
||||
public interface ICreditCheckService
|
||||
{
|
||||
bool CanExecute(TradeRequest tradeRequest, IList errors);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Services
|
||||
{
|
||||
public interface IExecutionVenueService
|
||||
{
|
||||
TradeResponse ExecuteTradeRequest(TradeRequest request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
|
||||
#region License
|
||||
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Services
|
||||
{
|
||||
public interface ITradingService
|
||||
{
|
||||
void ProcessTrade(TradeRequest request, TradeResponse response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
|
||||
using System.Collections;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
using Spring.EmsQuickStart.Server.Services;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Services.Stubs
|
||||
{
|
||||
public class CreditCheckServiceStub : ICreditCheckService
|
||||
{
|
||||
public bool CanExecute(TradeRequest tradeRequest, IList errors)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
|
||||
using System;
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
using Spring.EmsQuickStart.Server.Services;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Services.Stubs
|
||||
{
|
||||
public class ExecutionVenueServiceStub : IExecutionVenueService
|
||||
{
|
||||
public TradeResponse ExecuteTradeRequest(TradeRequest request)
|
||||
{
|
||||
TradeResponse response = new TradeResponse();
|
||||
response.OrderType = request.OrderType;
|
||||
response.Price = CalculatePrice(request.Ticker, request.Quantity, request.OrderType, request.Price, request.UserName);
|
||||
response.Quantity = request.Quantity;
|
||||
response.Ticker = request.Ticker;
|
||||
response.ConfirmationNumber = new Guid().ToString();
|
||||
return response;
|
||||
}
|
||||
|
||||
private decimal CalculatePrice(string ticker, long quantity, string ordertype, decimal limitPrice, string userName)
|
||||
{
|
||||
// provide as sophisticed an impl as testing requires...for now all the same price.
|
||||
if (ordertype.CompareTo("LIMIT") == 0)
|
||||
{
|
||||
return limitPrice;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 27.6m;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
|
||||
using Spring.EmsQuickStart.Common.Data;
|
||||
using Spring.EmsQuickStart.Server.Services;
|
||||
|
||||
namespace Spring.EmsQuickStart.Server.Services.Stubs
|
||||
{
|
||||
public class TradingServiceStub : ITradingService
|
||||
{
|
||||
public void ProcessTrade(TradeRequest request, TradeResponse response)
|
||||
{
|
||||
//do nothing implementation, typical implementations would persist state to the database.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{85E7B947-8153-45E4-B572-BEDB191F1FB2}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring.EmsQuickStart.Server</RootNamespace>
|
||||
<AssemblyName>Spring.EmsQuickStart.Server</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Common.Logging, Version=1.2.0.0, Culture=neutral, PublicKeyToken=af08829b84f0328e">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\lib\Net\2.0\Common.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="TIBCO.EMS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5b83db8ff05c64ba, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\lib\Net\2.0\TIBCO.EMS.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Gateways\IMarketDataService.cs" />
|
||||
<Compile Include="Gateways\MarketDataServiceGateway.cs" />
|
||||
<Compile Include="Handlers\LoggingExceptionListener.cs" />
|
||||
<Compile Include="Handlers\StockAppHandler.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\ICreditCheckService.cs" />
|
||||
<Compile Include="Services\IExecutionVenueService.cs" />
|
||||
<Compile Include="Services\ITradingService.cs" />
|
||||
<Compile Include="Services\Stubs\CreditCheckServiceStub.cs" />
|
||||
<Compile Include="Services\Stubs\ExecutionVenueServiceStub.cs" />
|
||||
<Compile Include="Services\Stubs\TradingServiceStub.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Aop\Spring.Aop.2005.csproj">
|
||||
<Project>{3A3A4E65-45A6-4B20-B460-0BEDC302C02C}</Project>
|
||||
<Name>Spring.Aop.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Core\Spring.Core.2005.csproj">
|
||||
<Project>{710961A3-0DF4-49E4-A26E-F5B9C044AC84}</Project>
|
||||
<Name>Spring.Core.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Data\Spring.Data.2005.csproj">
|
||||
<Project>{AE00E5AB-C39A-436F-86D2-33BFE33E2E40}</Project>
|
||||
<Name>Spring.Data.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\..\..\src\Spring\Spring.Messaging.Ems\Spring.Messaging.Ems.2005.csproj">
|
||||
<Project>{900E3839-301E-48B1-BAEB-B6645620ACFF}</Project>
|
||||
<Name>Spring.Messaging.Ems.2005</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Spring.EmsQuickStart.Common\Spring.EmsQuickStart.Common.csproj">
|
||||
<Project>{AC5A3035-75DD-48E5-ABCA-38FBC8193F22}</Project>
|
||||
<Name>Spring.EmsQuickStart.Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Config\ServiceStubs.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Config\Messaging.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Config\Handlers.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
using System.Reflection;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Integration Tests")]
|
||||
@@ -0,0 +1,44 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E641F51F-1B51-4B94-B419-F902EABCE4D4}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.EmsQuickStart.Integration.Tests</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.NmsQuickStart.Integration.Tests\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.NmsQuickStart.Integration.Tests\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
using System.Reflection;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Unit Tests")]
|
||||
@@ -0,0 +1,44 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{94E4E1B4-D424-4EB9-BF34-2EE8CC3D7048}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Spring</RootNamespace>
|
||||
<AssemblyName>Spring.EmsQuickStart.Tests</AssemblyName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.NmsQuickStart.Tests\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\..\build\VS.NET.2005\Spring.NmsQuickStart.Tests\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NET_2_0</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
Reference in New Issue
Block a user