Class SearchServerSocket

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

public class SearchServerSocket extends DefaultConfigurable implements SocketListenerInterface
Server side of socket search interface.
  • Field Details

    • SEARCH_PORT_PROPERTY

      public static final String SEARCH_PORT_PROPERTY
      The configuration property used for listen port.
      See Also:
    • DEFAULT_SEARCH_PORT

      public static final String DEFAULT_SEARCH_PORT
      The default listen port, as a string.
      See Also:
    • THREAD_POOL_SIZE_PROPERTY

      public static final String THREAD_POOL_SIZE_PROPERTY
      The configuration property used for listen thread count.
      See Also:
    • DEFAULT_THREAD_POOL_SIZE

      public static final String DEFAULT_THREAD_POOL_SIZE
      The default number of threads, as a string.
      See Also:
    • PRODUCT_INDEXER_PROPERTY

      public static final String PRODUCT_INDEXER_PROPERTY
      The configuration property used to reference a ProductIndex.
      See Also:
    • PRODUCT_STORAGE_PROPERTY

      public static final String PRODUCT_STORAGE_PROPERTY
      The configuration property used to reference a URLProductStorage.
      See Also:
  • Constructor Details

    • SearchServerSocket

      public SearchServerSocket()
      Construct a new SearchServerSocket using defaults.
  • Method Details

    • search

      protected SearchResponse search(SearchRequest request) throws Exception
      Method to perform search. Calls Indexer.search(SearchRequest). Simplifies testing.
      Parameters:
      request - the search to execute.
      Returns:
      the search response.
      Throws:
      Exception - if error occurs
    • onSocket

      public void onSocket(Socket socket)
      This method is called each time a SearchSocket connects.
      Specified by:
      onSocket in interface SocketListenerInterface
      Parameters:
      socket - socket to be processed.
    • configure

      public void configure(Config config) throws Exception
      Description copied from class: DefaultConfigurable
      Process configuration settings. Called before startup().
      Specified by:
      configure in interface Configurable
      Overrides:
      configure in class DefaultConfigurable
      Parameters:
      config - the Config object with settings.
      Throws:
      Exception - if configuration exceptions occur.
    • 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.
    • 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.
    • getPort

      public int getPort()
      Returns:
      int port
    • setPort

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

      public int getThreads()
      Returns:
      int threads
    • setThreads

      public void setThreads(int threads)
      Parameters:
      threads - into to set
    • getIndexer

      public Indexer getIndexer()
      Returns:
      indexer
    • setIndex

      public void setIndex(Indexer indexer)
      Parameters:
      indexer - to set