-
February 1st, 2008, 01:27 PM
#1
Adding dll of modified classes ExternalFeed.cs ,StockList.cs to reflect the changes
Hi,
I altered the code of class files (ExternalFeed.cs & StockList.cs) which are available under following path
\LightStreamer\Lightstreamer\DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\src_data_adapter
and I can build the project successfully, Now my question is where should I add the built dll to get the changes according to my requirements.
(I tried by adding the dll into path:LightStreamer\Lightstreamer\DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\lib\dotnet_1.1, but changes are not reflecting and even I checked by removing all the files from the directory: LightStreamer\Lightstreamer\DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\lib\dotnet_1.1 but the sample is working fine with out any errors: )
can any one help me regarding this.
Thanks,
-
February 4th, 2008, 09:55 AM
#2
In the provided
DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo
example, we mix (perhaps misleadingly) development-related subdirectories and deployment-related subdirectories.
We then tried to clarify things in the included
DOCS-SDKs\sdk_adapter_dotnet\doc\DotNet Adapters.pdf
To summarize:
- the bin and lib subdirectories only contain the resources compiled from the src_* directories;
- the Deployment subdirectory contains the deployment of the demo; in particular, the Lightstreamer-Server-side part and the Remote-Server-side part. The latter is reported in two different versions, namely "Deployment_DotNet_Server" and "Deployment_DotNet_Server(custom)".
Your modified libraries should be copied in one of
Deployment\Deployment_DotNet_Server\dotnet_1.1
Deployment\Deployment_DotNet_Server(custom)\dotnet _1.1
depending on the deployment version you prefer.
Dario
-
February 11th, 2008, 11:39 AM
#3
Thanks Dario,
I tried as u said by copying my changed code dll into path LightStreamer\Lightstreamer\DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_DotNet_Server(custom)\dot net_1.1
but no changes are reflecting (according to changed code) when i run the stocklist demo adapter, in the front end it is showing the same old data of stocllist demo.
Even I checked by removing the files :
DotNetStockListDemo.dll
DotNetStockListDemo.pdb
DotNetStockListDemoLauncher.exe.config
DotNetStockListDemoLauncher.pdb
DotNetAdapter.pdb
from path: LightStreamer\Lightstreamer\DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_DotNet_Server(custom)\dot net_1.1
and when I run the stock list demo adpter, it is running successfully in the browser with the same old data (I am not getting how it is happening).
actually I built a solution called DotNetStockListDemo and to the solution i added ExternalFeed.cs , StockList.cs classes & i took the reference of DotNetAdapter from path : LightStreamer\Lightstreamer\DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_DotNet_Server(custom)\dot net_1.1
and i made following changes to the added clases
ExternalFeed.cs[/COLOR]
namespace Lightstreamer.Adapters.Data.StockListDemo {
public interface IExternalFeedListener {
void OnEvent(string itemName, IDictionary currentValues, bool isSnapshot);
}
public class ExternalFeedSimulator {
private IDictionary _stockGenerators;
private IExternalFeedListener _listener;
private IList _snapshotQueue;
private Thread _snapshotSender;
public ExternalFeedSimulator() {
_stockGenerators= new Hashtable();
_snapshotQueue= new ArrayList();
public void Start() {
if (_snapshotSender != null) return;
for (int i = 0; i < 10; i++) {
string itemName= "item" + (i + 1);
ExternalFeedProducer myProducer = new ExternalFeedProducer(itemName);
//End of Inder
_stockGenerators[itemName]= myProducer;
myProducer.SetFeedListener(_listener);
myProducer.Start();
}
_snapshotSender= new Thread(new ThreadStart(Run));
_snapshotSender.Start();
}
private void Run() {
IList snapshots= new ArrayList();
do {
lock (_snapshotQueue) {
if (_snapshotQueue.Count == 0)
Monitor.Wait(_snapshotQueue);
snapshots.Clear();
while (_snapshotQueue.Count > 0) {
ExternalFeedProducer myProducer= (ExternalFeedProducer) _snapshotQueue[0];
snapshots.Add(myProducer);
_snapshotQueue.RemoveAt(0);
}
}
foreach (ExternalFeedProducer myProducer in snapshots) {
_listener.OnEvent(myProducer.GetItemName(), myProducer.GetCurrentValues(true), true);
}
} while (true);
}
public void SetFeedListener(IExternalFeedListener listener) {
_listener= listener;
foreach (ExternalFeedProducer myProducer in _stockGenerators.Values) {
myProducer.SetFeedListener(listener);
}
}
public void SendCurrentValues(string itemName) {
ExternalFeedProducer myProducer= (ExternalFeedProducer) _stockGenerators[itemName];
if (myProducer == null) return;
lock (_snapshotQueue) {
_snapshotQueue.Add(myProducer);
Monitor.Pulse(_snapshotQueue);
}
}
}
public class ExternalFeedProducer {
public string _itemName;
private IExternalFeedListener _listener;
private Thread _thread;
#region [Indrajit - Variables]
private string b1;
private string b2;
private string b3;
private string b4;
#endregion
public ExternalFeedProducer(string name)
{
_itemName = name;
b1 = "b1";
b2 = "b2";
b3 = "b3";
b4 = "b4";
}
public string GetItemName() {
return _itemName;
}
public void SetFeedListener(IExternalFeedListener listener) {
lock (this) {
_listener = listener;
}
}
public void Start() {
lock (this) {
if (_thread != null) return;
_thread = new Thread(new ThreadStart(Run));
_thread.Start();
}
}
private void Run() {
do {
int waitMillis= 1000;
Thread.Sleep(waitMillis);
//ComputeNewValues();
if (_listener != null)
_listener.OnEvent(_itemName, GetCurrentValues(false), false);
} while (true);
}
public IDictionary GetCurrentValues(bool fullData) {
lock (this) {
IDictionary eventData = new Hashtable();
eventData.Add("IMAGE-1", b1);
eventData.Add("IMAGE-2", b2);
if (fullData)
{
eventData.Add("IMAGE-3", b3);
eventData.Add("IMAGE-4", b4);
}
return eventData;
}
}
}
}
StockList.CS
namespace Lightstreamer.Adapters.Data {
public class StockListDemoAdapter : IDataProvider, IExternalFeedListener {
private IDictionary _subscribedItems;
private ExternalFeedSimulator _myFeed;
private IItemEventListener _listener;
public StockListDemoAdapter() {
_subscribedItems= new Hashtable();
_myFeed= new ExternalFeedSimulator();
}
// ////////////////////////////////////////////////////////////////////////
// IDataProvider methos
public void Init(IDictionary parameters, string configFile) {
_myFeed.SetFeedListener(this);
_myFeed.Start();
}
public void SetListener(IItemEventListener eventListener) {
_listener= eventListener;
}
public void Subscribe(string itemName) {
if (!itemName.StartsWith("item"))
throw new SubscriptionException("Unexpected item: " + itemName);
lock (_subscribedItems) {
if (_subscribedItems.Contains(itemName)) return;
_subscribedItems[itemName]= false;
}
_myFeed.SendCurrentValues(itemName);
}
public void Unsubscribe(string itemName) {
if (!itemName.StartsWith("item"))
throw new SubscriptionException("Unexpected item: " + itemName);
lock (_subscribedItems) {
_subscribedItems.Remove(itemName);
}
}
public bool IsSnapshotAvailable(string itemName) {
if (!itemName.StartsWith("item"))
throw new SubscriptionException("Unexpected item: " + itemName);
return true;
}
// ////////////////////////////////////////////////////////////////////////
// IExternalFeedListener methods
public void OnEvent(string itemName,
IDictionary currentValues,
bool isSnapshot) {
lock (_subscribedItems) {
if (!_subscribedItems.Contains(itemName)) return;
bool started = (bool) _subscribedItems[itemName];
if (!started) {
if (!isSnapshot)
return;
_subscribedItems[itemName]= true;
}
else {
if (isSnapshot) {
isSnapshot = false;
}
}
_listener.Update(itemName, currentValues, isSnapshot);
}
}
}
}
I want my changes to be reflected in front end (means after launching lightstreamer server when I browse to the adapter the chages should be reflected there).
for that what should I do ?
can any one help by giving the sequence of steps to achieve the specified task above.
Thanks,
-
February 12th, 2008, 09:53 AM
#4
This is quite strange, so it's worth checking all the preconditions.
Please ensure that, before launching the Server, you followed the steps described in chapter 1.5 in
DOCS-SDKs\sdk_adapter_dotnet\doc\DotNet Adapters.pdf
which I resume below:
- The files in
DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_DotNet_Server(custom)\dot net_1.1
make up the Remote Server and the mounted Remote Adapters. The Remote Server should be launched manually, through the
DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_DotNet_Server(custom)\Dot NetCustomServer.bat
script. - In order to communicate with the Remote Server, Lightstreamer Server should mount the so-called Proxy Adapter. This is accomplished by copying the contents of the
DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_LS
directory in the Server's "adapters" subdirectory. - The client should be modified in order to ask for data from the Proxy Adapter rather than from the preinstalled StockListDemo adapter. To make this step simpler, the Proxy Adapter is preconfigured with the same name as the preinstalled StockListDemo adapter, so that no changes on the client are needed. However, the preinstalled StockListDemo adapter must be removed, to avoid conflicts; hence the directory should be removed.
Dario
-
February 13th, 2008, 07:04 AM
#5
Thanks Dario,
I removed LS from my machine and reconfigured it again and I followed each and every step explained by you but it of no use I am still getting the default stocklist demo data when I run and if I remove the same files which I posted in my previous post still it is behaving in the same way.
Dario if you have any working sample that is built on .net (may be a small one--like pushing a string Hello world or pushing numbers randomely) with steps to be followed to implement it on LightStreamer.
Thanks,
-
February 13th, 2008, 09:00 AM
#6
Unfortunately, we haven't simpler examples available.
I would like to simplify the case and ensure that there are no misunderstandings. Please, try again with an incremental approach.
- Start from a working installation of Lightstreamer. You should see the standard StockListDemo working. Your current configuration seems to be at this stage.
- Remove all contents from the "adapters" directory and relaunch Lightstreamer Server. The StockListDemo should not display any data.
- Copy the
DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_LS\StockList_sockets
directory and all its contents into the "adapters" directory and relaunch Lightstreamer Server. The Server should block in the startup phase, trying to connect to the Remote Server and, of course, the StockListDemo should not be able to connect to Lightstreamer Server.
Only once the above steps are respected, we can move to the constructive phase.
-
February 13th, 2008, 10:17 AM
#7
Yes Dario,
you are correct I tried those things previously, after launching the Deployment_DotNet_Server only we can launch the LS server. But my question here is where should I implement my custom DotnetStockListDemo.dll to reflect the changes.
-
February 14th, 2008, 10:07 AM
#8
Ok, the next thing to clarify is that your dll is being used.
If you remove it from
DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\Deployment\Deployment_DotNet_Server(custom)\dot net_1.1
does the Remote Server still start successfully?
If yes, because some caching by the .NET environment is in action under the hood, then you should at least change the names of your modified classes.
-
May 22nd, 2008, 05:01 AM
#9
Hi,
I had the same problem. I didn't find it anything to do with .net in the end, but it is related to whether its using _your_ dll or not.
When you compile DotNetStockListDemoLauncher.exe, it contains a reference to the DotNetStockListDemo.dll . You need to make sure when you add this reference you browse to the folder containing your compiled .dll. Do not use the one contained in the DOCS-SDK etc lib folder. This is also why I think deleting the file from the sample deployment directory does not work as once again, its not looking at that dll.
Hope that helps
Michael
Similar Threads
-
By sharathbabuk in forum General
Replies: 8
Last Post: July 30th, 2010, 03:18 PM
-
By webfg in forum Client SDKs
Replies: 2
Last Post: June 30th, 2010, 12:28 PM
-
By mohamida in forum Adapter SDKs
Replies: 2
Last Post: November 17th, 2009, 02:46 PM
-
By hungn in forum Adapter SDKs
Replies: 8
Last Post: May 7th, 2008, 09:53 AM
-
By tuongkha in forum Client SDKs
Replies: 4
Last Post: March 19th, 2008, 10:10 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 04:16 PM.
Bookmarks