Package gov.usgs.earthquake.distribution
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 Summary
Constructors Constructor Description AdminSocketServer()Initializes socket with default thread pool size and portAdminSocketServer(int port, int threads, ProductClient client)Initializes socket with custom port, threads, and client
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProductClientgetClient()intgetPort()intgetThreads()voidonSocket(java.net.Socket socket)Called with any sockets to be read.protected voidprocessLine(java.lang.String line, java.io.OutputStream out)Process a line of input.voidsetClient(ProductClient client)voidsetPort(int port)voidsetThreads(int threads)voidshutdown()Stop any processing/background threads.voidstartup()Start any processing/background threads.-
Methods inherited from class gov.usgs.util.DefaultConfigurable
configure, getName, setName
-
-
-
-
Constructor Detail
-
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 portthreads- Thread pool sizeclient- Product Client
-
-
Method Detail
-
startup
public void startup() throws java.lang.ExceptionDescription copied from class:DefaultConfigurableStart any processing/background threads.- Specified by:
startupin interfaceConfigurable- Overrides:
startupin classDefaultConfigurable- Throws:
java.lang.Exception- if exceptions occur while starting.
-
shutdown
public void shutdown() throws java.lang.ExceptionDescription copied from class:DefaultConfigurableStop any processing/background threads.- Specified by:
shutdownin interfaceConfigurable- Overrides:
shutdownin classDefaultConfigurable- Throws:
java.lang.Exception- if exceptions occur while starting.
-
processLine
protected void processLine(java.lang.String line, java.io.OutputStream out) throws java.lang.ExceptionProcess a line of input.- Parameters:
line- inputout- write generated output to stream- Throws:
java.lang.Exception- if misconfigured or the client quits.
-
onSocket
public void onSocket(java.net.Socket socket)
Description copied from interface:SocketListenerInterfaceCalled with any sockets to be read.- Specified by:
onSocketin interfaceSocketListenerInterface- 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
-
-