Class EIDSClient

  • All Implemented Interfaces:
    EIDSListener

    public class EIDSClient
    extends java.lang.Object
    implements EIDSListener
    An EIDS client that is a java event source.
    • Field Detail

      • EIDS_SERVER_HOST_PROPERTY

        public static final java.lang.String EIDS_SERVER_HOST_PROPERTY
        Property name for eids server host address.
        See Also:
        Constant Field Values
      • EIDS_SERVER_PORT

        public static final java.lang.String EIDS_SERVER_PORT
        Property name for eids server port.
        See Also:
        Constant Field Values
      • EIDS_ALTERNATE_SERVERS

        public static final java.lang.String EIDS_ALTERNATE_SERVERS
        Property name for eids server alternate servers list.
        See Also:
        Constant Field Values
      • EIDS_LISTENERS

        public static final java.lang.String EIDS_LISTENERS
        Property name for objects to load and add as EIDSListeners.
        See Also:
        Constant Field Values
      • PROGRAM_VERSION

        public static final java.lang.String PROGRAM_VERSION
        Version string for program.
        See Also:
        Constant Field Values
      • PROGRAM_NAME

        public static final java.lang.String PROGRAM_NAME
        Name string for program.
        See Also:
        Constant Field Values
      • DEFAULT_SERVER_HOST

        public static final java.lang.String DEFAULT_SERVER_HOST
        Default server host.
        See Also:
        Constant Field Values
      • DEFAULT_SERVER_PORT

        public static final java.lang.Integer DEFAULT_SERVER_PORT
        Default server port number.
      • DEFAULT_MAX_SERVER_EVENT_AGE_DAYS

        public static final java.lang.Double DEFAULT_MAX_SERVER_EVENT_AGE_DAYS
        Default maxServerEventAgeDays parameter.
      • DEFAULT_TRACKING_FILE_NAME

        public static final java.lang.String DEFAULT_TRACKING_FILE_NAME
        Default Tracking filename.
        See Also:
        Constant Field Values
      • DEFAULT_CLIENT_RESTART_INTERVAL

        public static final java.lang.Long DEFAULT_CLIENT_RESTART_INTERVAL
        Default client restart interval
    • Constructor Detail

      • EIDSClient

        public EIDSClient()
        Constructor using default host and port
      • EIDSClient

        public EIDSClient​(java.lang.String serverHost,
                          java.lang.Integer serverPort)
        Construct an EIDSClient using only server host and port. Calls other constructor with null values for other parameters.
        Parameters:
        serverHost - Specific host
        serverPort - Specific port
      • EIDSClient

        public EIDSClient​(java.lang.String serverHost,
                          java.lang.Integer serverPort,
                          java.lang.String alternateServersList)
        Construct an EIDSClient using serverHost, serverPort, and alternateServersList.
        Parameters:
        serverHost - Host
        serverPort - Port
        alternateServersList - a comma delimited list of host:port that are used when unable to connect to the primary serverHost and serverPort.
      • EIDSClient

        public EIDSClient​(java.lang.String serverHost,
                          java.lang.Integer serverPort,
                          java.lang.String alternateServersList,
                          java.lang.Double maxServerEventAgeDays,
                          java.lang.String trackingFileName,
                          java.lang.Long clientRestartInterval)
        Constructor with all options.
        Parameters:
        serverHost - the eids server host or ip address.
        serverPort - the eids server port.
        alternateServersList - a comma delimited list of host:port that are used when unable to connect to the primary serverHost and serverPort.
        maxServerEventAgeDays - number of days worth of messages to retrieve on first connect.
        trackingFileName - location where tracking file is stored. This file is used to track which messages have been received.
        clientRestartInterval - How often to periodically restart the client, in milliseconds
    • Method Detail

      • startup

        public void startup()
        Runs the client. Any listeners should be added before calling this method.
      • shutdown

        public void shutdown()
        Shuts down a running client. Does not call system.exit.
      • addListener

        public void addListener​(EIDSListener listener)
        Add a listener.
        Parameters:
        listener - the listener to add.
      • removeListener

        public void removeListener​(EIDSListener listener)
        Remove a listener.
        Parameters:
        listener - the listener to remove.
      • onEIDSMessage

        public void onEIDSMessage​(EIDSMessageEvent event)
        Description copied from interface: EIDSListener
        Receive a message from an EIDSClient.
        Specified by:
        onEIDSMessage in interface EIDSListener
        Parameters:
        event - an event object representing the message that was received.
      • getServerHost

        public java.lang.String getServerHost()
        Returns:
        the serverHost
      • setServerHost

        public void setServerHost​(java.lang.String serverHost)
        Parameters:
        serverHost - the serverHost to set
      • getServerPort

        public java.lang.Integer getServerPort()
        Returns:
        the serverPort
      • setServerPort

        public void setServerPort​(java.lang.Integer serverPort)
        Parameters:
        serverPort - the serverPort to set
      • getAlternateServersList

        public java.lang.String getAlternateServersList()
        Returns:
        the alternateServersList
      • setAlternateServersList

        public void setAlternateServersList​(java.lang.String alternateServersList)
        Parameters:
        alternateServersList - the alternateServersList to set
      • getMaxServerEventAgeDays

        public java.lang.Double getMaxServerEventAgeDays()
        Returns:
        the maxServerEventAgeDays
      • setMaxServerEventAgeDays

        public void setMaxServerEventAgeDays​(java.lang.Double maxServerEventAgeDays)
        Parameters:
        maxServerEventAgeDays - the maxServerEventAgeDays to set
      • getTrackingFileName

        public java.lang.String getTrackingFileName()
        Returns:
        the trackingFileName
      • setTrackingFileName

        public void setTrackingFileName​(java.lang.String trackingFileName)
        Parameters:
        trackingFileName - the trackingFileName to set
      • getClientRestartInterval

        public java.lang.Long getClientRestartInterval()
        Returns:
        clientRestartInterval
      • setClientRestartInterval

        public void setClientRestartInterval​(java.lang.Long clientRestartInterval)
        Parameters:
        clientRestartInterval - the clientRestartInterval to set
      • setDebug

        public void setDebug​(boolean debug)
        Parameters:
        debug - to set
      • isDebug

        public boolean isDebug()
        Returns:
        debug boolean
      • reinitConnection

        public boolean reinitConnection()
        Returns:
        result of reinitialzing the client connection
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        A method to test the EIDSClient.
        Parameters:
        args - arguments
        Throws:
        java.lang.Exception - if error occurs