Results 1 to 2 of 2
  1. #1
    Member
    Join Date
    Jan 2010
    Location
    Buenos Aires
    Posts
    1

    User specific data example

    Is there any user-specific data example?
    Something like a logging console and one client sees DEBUG messages and another Error messages?

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    972
    I'm afraid there is no direct example.
    The instant messenger demo could be suitable for a used-based data filter,
    but we opted for requesting different item names directly from the clients, to keep it simple.

    You could achieve the behavior you describe through small changes on the MonitorDemo Metadata Adapter in
    DOCS-SDKs\sdk_adapter_java\examples\Monitor_MetadataAda pter.
    Suppose that you want that the "msgs" item yields ERROR messages for some users and INFO messages for other users (DEBUG messages are not available in this example), you should extend getItems to become like:
    Code:
    public String[] getItems(String user, String session, String id) throws ItemsException {
        String[] broken = super.getItems(user, session, id);
        for (int i=0; i < broken.length; i++) {
            if (broken[i].equalsIgnoreCase("msgs")) {
                if (myTest(user)) {
                    broken[i] = "monitor_log_error";
                } else {
                    broken[i] = "monitor_log_info";
                }
            }
            broken[i] = convertMonitorName(broken[i],session);
        }
        return broken;
    }
    Then you can change the front-end in pages\demos\MonitorDemo to request the "msgs" item in place, for instance, of "monitor_log_warning".
    The user name has now to be supplied to Lightstreamer by the front-end at Engine creation. Hence, you can add something like:
    Code:
    lsEngine.connection.setUserName("myName");
    lsEngine.connection.setPassword("myPassword");
    in onEngineCreation.
    The default configuration of the demos does not perform credential checks, so all user names can be used. Of course, you should also extend the Metadata Adapter with a suitable implementation of notifyUser.

    Note that the DOCS-SDKs\sdk_adapter_java\examples\Monitor_MetadataAda pter Adapter is not the predeployed one. You can achieve the same by working on the predeployed but more complicated one in
    DOCS-SDKs\sdk_adapter_java\examples\Mixed_MetadataAdapt er.

    Final note: I haven't tested the code.

 

 

Similar Threads

  1. Get data specific to each User by passing parameters
    By leonardodar in forum Adapter APIs
    Replies: 3
    Last Post: March 16th, 2011, 09:45 AM
  2. User data into XML ?
    By quantri_vn87 in forum Adapter APIs
    Replies: 3
    Last Post: October 29th, 2009, 02:16 PM
  3. General data and User specific data
    By mnenchev in forum Adapter APIs
    Replies: 5
    Last Post: September 1st, 2009, 09:36 AM
  4. User Specific Response
    By vishnugs in forum General
    Replies: 4
    Last Post: April 6th, 2007, 11:06 AM
  5. User-specific push
    By rmusco in forum General
    Replies: 8
    Last Post: February 2nd, 2007, 05:29 PM

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 06:12 PM.