Class AdminSocketServer

java.lang.Object
gov.usgs.util.DefaultConfigurable
gov.usgs.earthquake.distribution.AdminSocketServer
All Implemented Interfaces:
Configurable, SocketListenerInterface

public class AdminSocketServer extends DefaultConfigurable implements SocketListenerInterface
Telnet to this socket to get a "command prompt".
  • Constructor Details

    • AdminSocketServer

      public AdminSocketServer()
      Initializes socket with default thread pool size and port
    • AdminSocketServer

      public AdminSocketServer(int port, int threads, ProductClient client)
      Initializes socket with custom port, threads, and client
      Parameters:
      port - Admind port
      threads - Thread pool size
      client - Product Client
  • Method Details

    • startup

      public void startup() throws Exception
      Description copied from class: DefaultConfigurable
      Start any processing/background threads.
      Specified by:
      startup in interface Configurable
      Overrides:
      startup in class DefaultConfigurable
      Throws:
      Exception - if exceptions occur while starting.
    • shutdown

      public void shutdown() throws Exception
      Description copied from class: DefaultConfigurable
      Stop any processing/background threads.
      Specified by:
      shutdown in interface Configurable
      Overrides:
      shutdown in class DefaultConfigurable
      Throws:
      Exception - if exceptions occur while starting.
    • processLine

      protected void processLine(String line, OutputStream out) throws Exception
      Process a line of input.
      Parameters:
      line - input
      out - write generated output to stream
      Throws:
      Exception - if misconfigured or the client quits.
    • onSocket

      public void onSocket(Socket socket)
      Description copied from interface: SocketListenerInterface
      Called with any sockets to be read.
      Specified by:
      onSocket in interface SocketListenerInterface
      Parameters:
      socket - socket to be processed.
    • getPort

      public int getPort()
      Returns:
      port
    • setPort

      public void setPort(int port)
      Parameters:
      port - port number
    • getThreads

      public int getThreads()
      Returns:
      threads
    • setThreads

      public void setThreads(int threads)
      Parameters:
      threads - set number of threads
    • getClient

      public ProductClient getClient()
      Returns:
      product client
    • setClient

      public void setClient(ProductClient client)
      Parameters:
      client - set product client