Class LoggerService

java.lang.Object
xal.service.pvlogger.LoggerService
All Implemented Interfaces:
RemoteLogging

public class LoggerService extends Object implements RemoteLogging
LoggerService is the implementation of LoggerPortal that responds to requests from remote clients on behalf of the logger model.
Author:
tap
  • Field Details

  • Constructor Details

    • LoggerService

      public LoggerService(LoggerModel model)
      LoggerService constructor
  • Method Details

    • broadcast

      public void broadcast()
      Begin broadcasting the service
    • setLoggingPeriod

      public void setLoggingPeriod(String groupType, double period)
      Set the period between events where we take and store machine snapshots.
      Specified by:
      setLoggingPeriod in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      period - The period in seconds between events where we take and store machine snapshots.
    • getLoggingPeriod

      public double getLoggingPeriod(String groupType)
      Get the logging period.
      Specified by:
      getLoggingPeriod in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      Returns:
      The period in seconds between events where we take and store machine snapshots.
    • takeAndPublishSnapshot

      public int takeAndPublishSnapshot(String groupID, String comment)
      Take a snapshot and publish it.
      Specified by:
      takeAndPublishSnapshot in interface RemoteLogging
      Parameters:
      groupID - ID of the group for which to take the snapshot
      comment - snapshot comment
      Returns:
      machine snapshot ID or an error code (less than 0) if the attempt fails
    • publishSnapshots

      public void publishSnapshots()
      publish snapshots in the snapshot buffer
      Specified by:
      publishSnapshots in interface RemoteLogging
    • hasLoggerSession

      public boolean hasLoggerSession(String groupID)
      Determine if a logger session exists for the specified group
      Specified by:
      hasLoggerSession in interface RemoteLogging
      Parameters:
      groupID - group ID of the logger session for which to look
      Returns:
      true if a session exists for the group and false if not
    • isLogging

      public boolean isLogging(String groupType)
      Determine if the logger is presently logging
      Specified by:
      isLogging in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      Returns:
      true if the logger is logging and false if not
    • reloadLoggerSession

      public boolean reloadLoggerSession(String groupType)
      reload the logger session identified by the group type
      Specified by:
      reloadLoggerSession in interface RemoteLogging
    • restartLogger

      public void restartLogger()
      Stop logging, reload groups from the database and resume logging.
      Specified by:
      restartLogger in interface RemoteLogging
    • resumeLogging

      public void resumeLogging()
      Resume the logger logging.
      Specified by:
      resumeLogging in interface RemoteLogging
    • stopLogging

      public void stopLogging()
      Stop the logger.
      Specified by:
      stopLogging in interface RemoteLogging
    • shutdown

      public void shutdown(int code)
      Shutdown the process.
      Specified by:
      shutdown in interface RemoteLogging
      Parameters:
      code - The shutdown code which is normally just 0.
    • getHostName

      public String getHostName()
      Get the name of the host where the application is running.
      Specified by:
      getHostName in interface RemoteLogging
      Returns:
      The name of the host where the application is running.
    • getLaunchTime

      public Date getLaunchTime()
      Get the launch time of the service.
      Specified by:
      getLaunchTime in interface RemoteLogging
      Returns:
      the launch time in seconds since the Java epoch of January 1, 1970.
    • getHeartbeat

      public Date getHeartbeat()
      Get a heartbeat from the service.
      Specified by:
      getHeartbeat in interface RemoteLogging
      Returns:
      the time measured from the service at which the heartbeat was sent
    • getLastChannelEventTime

      public Date getLastChannelEventTime(String groupType)
      Get the timestamp of the last channel event (e.g. channel connected/disconnected event)
      Specified by:
      getLastChannelEventTime in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      Returns:
      the wall clock timestamp of the last channel event
    • getLastLoggerEventTime

      public Date getLastLoggerEventTime(String groupType)
      Get the timestamp of the last logger event
      Specified by:
      getLastLoggerEventTime in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      Returns:
      the wall clock timestamp of the last logger event
    • getGroupTypes

      public List<String> getGroupTypes()
      Get the list of group types
      Specified by:
      getGroupTypes in interface RemoteLogging
      Returns:
      a list of the group types
    • getChannelCount

      public int getChannelCount(String groupType)
      Get the number of channels we wish to log.
      Specified by:
      getChannelCount in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      Returns:
      the number of channels we wish to log
    • getChannels

      public List<Map<String,Object>> getChannels(String groupType)
      Get the list of channel info tables. Each channel info table contains the PV signal name and the channel connection status.
      Specified by:
      getChannels in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      Returns:
      The list channel info tables corresponding to the channels we wish to log
    • getTimestampOfLastPublishedSnapshot

      public Date getTimestampOfLastPublishedSnapshot(String groupType)
      Get the timestamp of the last published snapshot
      Specified by:
      getTimestampOfLastPublishedSnapshot in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      Returns:
      the timestamp of the last published snapshot
    • getLastPublishedSnapshotDump

      public String getLastPublishedSnapshotDump(String groupType)
      Get the textual dump of the last published snapshot
      Specified by:
      getLastPublishedSnapshotDump in interface RemoteLogging
      Parameters:
      groupType - identifies the group by type
      Returns:
      the textual dump of the last published snapshot or null if none exists