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 ProductClient
getClient()
int
getPort()
int
getThreads()
void
onSocket(java.net.Socket socket)
Called with any sockets to be read.protected void
processLine(java.lang.String line, java.io.OutputStream out)
Process a line of input.void
setClient(ProductClient client)
void
setPort(int port)
void
setThreads(int threads)
void
shutdown()
Stop any processing/background threads.void
startup()
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.Exception
Description copied from class:DefaultConfigurable
Start any processing/background threads.- Specified by:
startup
in interfaceConfigurable
- Overrides:
startup
in classDefaultConfigurable
- Throws:
java.lang.Exception
- if exceptions occur while starting.
-
shutdown
public void shutdown() throws java.lang.Exception
Description copied from class:DefaultConfigurable
Stop any processing/background threads.- Specified by:
shutdown
in interfaceConfigurable
- Overrides:
shutdown
in 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.Exception
Process 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:SocketListenerInterface
Called with any sockets to be read.- Specified by:
onSocket
in 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
-
-