Results 1 to 5 of 5

Hybrid View

  1. #1
    Member
    Join Date
    Nov 2006
    Location
    Belfast
    Posts
    15
    Forgive me if I misunderstand, but would this design not mean that multiple instances of the same MetaAdapter would overwrite eachother's stored data provider instance through MyDataProviderInstances.put(adapter_id,this)?

    I need to communicate with the DataAdapter instance that provides the data to the particular MetaDataAdapter in question. Although all clients will be using the same DataAdapter, they will pass in different parameters through sendMessage that will cause each DataAdapter instance to send data that will differ based on this. I'm not sure that is possible with what you have suggested?

  2. #2
    Power Member
    Join Date
    Jul 2006
    Location
    Cesano Maderno, Italy
    Posts
    784
    Each Adapter is made with 2 object's instances. A DataProvider instance and a MetadataProvider one.
    To configure an Adapter you must create an adapters.xml file and put it under the adapters folder (refer to LS_HOME/DOCS-SDKs/sdk_adapter_java/examples/StockListDemo/Deployment_LS/README.TXT. for further details on how to deploy an adapter) In this file you choose the DataProvider class, the MetadaProvider class and it's also possible to set parameters to be passed to the class's instances.

    Obviously you can use a class to create more Adapters. eg you have 2 adapters. Just set the 2 adapters.xml as follows:
    The first one will use MyDataProvider as DataProvider and MyMetadataProvider as MetadataProvider.
    Code xml:
    1. <?xml version="1.0"?>
    2.  
    3. <adapters_conf id="ADAPTER_1">
    4.    <metadata_provider>
    5.       <adapter_class>my_package.MyMetadataProvider</adapter_class>
    6.       <param name="match_id">ADAPTER_1</param>
    7.    </metadata_provider>
    8.  
    9.    <data_provider>
    10.       <adapter_class>my_package.MyDataProvider</adapter_class>
    11.       <param name="match_id">ADAPTER_1</param>
    12.    </data_provider>
    13. </adapters_conf>

    The other use MyDataProvider2 as DataProvider and MyMetadataProvider as MetadataProvider.
    Code xml:
    1. <?xml version="1.0"?>
    2.  
    3. <adapters_conf id="ADAPTER_2">
    4.    <metadata_provider>
    5.       <adapter_class>my_package.MyMetadataProvider</adapter_class>
    6.       <param name="match_id">ADAPTER_2</param>
    7.    </metadata_provider>
    8.  
    9.    <data_provider>
    10.       <adapter_class>my_package.MyDataProvider2</adapter_class>
    11.       <param name="match_id">ADAPTER_2</param>
    12.    </data_provider>
    13. </adapters_conf>

    At this point you have 2 MyMetadaProvider instances and each one receives its match_id parameter.
    Code java:
    1. String adapter_id = (String) params.get("match_id");
    so adapter_id is "ADAPTER_1" for the first instance and "ADAPTER_2" for the other.

    Now with this call
    Code java:
    1. MyDataProviderInstances.put(adapter_id,this);
    each MyMetadataProvider instance puts in the MyDataProviderInstances HashMap its reference with a different key (equals to the match_id received).

    From the other side MyDataProvider an MyDataProvider2 instances get each one a different MyMetadataProvider instance.
    Code java:
    1. String adapter_id = (String) params.get("match_id");
    Code java:
    1. metadataAdapter = (MyMetadataProvider) MyMetadataProvider.MyDataProviderInstances.get(adapter_id);

    Mone.

    PS: I saw that on my previous post i fogot to instantiate MyDataProviderInstances. Sorry.

  3. #3
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521

    Exclamation

    With the release of Lightstreamer Server v.3.5, the current thread has been replaced by this new thread: http://www.lightstreamer.com/vb/showthread.php?t=422

 

 

Similar Threads

  1. Multiple Data/Metadata Adapters
    By odeheurles in forum Adapter SDKs
    Replies: 6
    Last Post: January 26th, 2015, 09:50 AM
  2. Replies: 3
    Last Post: November 14th, 2011, 09:33 AM
  3. Replies: 1
    Last Post: July 21st, 2011, 10:16 AM
  4. multiple data adapters
    By rd2008 in forum Client SDKs
    Replies: 2
    Last Post: January 7th, 2009, 02:28 PM
  5. Replies: 2
    Last Post: March 26th, 2008, 09:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 08:16 AM.