Class DefaultAgentKeyReader

java.lang.Object
com.seeq.link.agent.DefaultAgentKeyReader
All Implemented Interfaces:
AgentKeyReader, com.seeq.utilities.FileChangeListener

public class DefaultAgentKeyReader extends Object implements AgentKeyReader
Encapsulates the reading of an agent key, including monitoring for modifications or deletions and notifying a listener.
  • Field Details

    • agentKeyModifiedEvent

      public com.seeq.link.sdk.utilities.Event<String> agentKeyModifiedEvent
  • Constructor Details

    • DefaultAgentKeyReader

      public DefaultAgentKeyReader(Path apiKeyPath)
  • Method Details

    • getAgentKeyCredential

      public AgentKeyCredential getAgentKeyCredential()
      Returns the AgentKeyCredential or null if it is not available.
      Specified by:
      getAgentKeyCredential in interface AgentKeyReader
      Returns:
      the AgentKeyCredential or null if it is not available
    • initialize

      public void initialize() throws IOException
      Reads the agent key in (if it exists) and begins watching the file for creation/modification/deletion.
      Specified by:
      initialize in interface AgentKeyReader
      Throws:
      IOException - thrown if setting up the file watcher encounters a problem
    • destroy

      public void destroy()
      Shuts down the file watcher for the agent key file.
      Specified by:
      destroy in interface AgentKeyReader
    • onFileModify

      public void onFileModify(Path filePath)
      Specified by:
      onFileModify in interface com.seeq.utilities.FileChangeListener
    • onFileDelete

      public void onFileDelete(Path filePath)
      Specified by:
      onFileDelete in interface com.seeq.utilities.FileChangeListener