Class SimpleServer
- java.lang.Object
-
- org.opennms.netmgt.provision.server.exchange.SimpleConversationEndPoint
-
- org.opennms.netmgt.provision.server.SimpleServer
-
- Direct Known Subclasses:
Pop3Server
,SSLServer
public class SimpleServer extends SimpleConversationEndPoint
SimpleServer class.
- Version:
- $Id: $
- Author:
- ranger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SimpleServer.ServerErrorExchange
-
Nested classes/interfaces inherited from class org.opennms.netmgt.provision.server.exchange.SimpleConversationEndPoint
SimpleConversationEndPoint.SimpleExchange
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_stopped
-
Fields inherited from class org.opennms.netmgt.provision.server.exchange.SimpleConversationEndPoint
m_conversation
-
-
Constructor Summary
Constructors Constructor Description SimpleServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addErrorHandler(RequestHandler requestHandler)
addErrorHandlerprotected boolean
attemptConversation(BufferedReader in, OutputStream out)
attemptConversationvoid
dispose()
disposeprotected RequestHandler
errorString(String error)
errorStringString
getBanner()
getBannerInetAddress
getInetAddress()
getInetAddressint
getLocalPort()
getLocalPortprotected SimpleServerRunnable
getRunnable()
getRunnableServerSocket
getServerSocket()
getServerSocketprotected Thread
getServerThread()
getServerThreadSocket
getSocket()
getSocketint
getThreadSleepLength()
getThreadSleepLengthvoid
init()
initprotected void
onInit()
onInitprotected void
sendBanner(OutputStream out)
sendBannervoid
setBanner(String banner)
setBannervoid
setBannerDelay(int delay)
Slow down transmission of the banner by a specified number of milliseconds.void
setServerSocket(ServerSocket serverSocket)
setServerSocketprotected void
setServerThread(Thread serverThread)
setServerThreadvoid
setSocket(Socket socket)
setSocketvoid
setThreadSleepLength(int timeout)
setThreadSleepLengthprotected RequestHandler
shutdownServer(String response)
shutdownServervoid
startServer()
startServervoid
stopServer()
stopServer-
Methods inherited from class org.opennms.netmgt.provision.server.exchange.SimpleConversationEndPoint
addResponseHandler, contains, getTimeout, matches, multilineLineRequest, setTimeout, singleLineRequest, startsWith
-
-
-
-
Method Detail
-
setBannerDelay
public void setBannerDelay(int delay)
Slow down transmission of the banner by a specified number of milliseconds.
-
getInetAddress
public InetAddress getInetAddress()
getInetAddress
- Returns:
- InetAddress returns the inetaddress from the serversocket.
-
getLocalPort
public int getLocalPort()
getLocalPort
- Returns:
- a int.
-
setThreadSleepLength
public void setThreadSleepLength(int timeout)
setThreadSleepLength
- Parameters:
timeout
- a int.
-
getThreadSleepLength
public int getThreadSleepLength()
getThreadSleepLength
- Returns:
- a int.
-
init
public void init() throws Exception
init
- Overrides:
init
in classSimpleConversationEndPoint
- Throws:
Exception
- if any.
-
onInit
protected void onInit()
onInit
-
startServer
public void startServer() throws IOException
startServer
- Throws:
Exception
- if any.IOException
-
stopServer
public void stopServer() throws IOException
stopServer
- Throws:
IOException
- if any.
-
dispose
public void dispose()
dispose
-
getRunnable
protected SimpleServerRunnable getRunnable() throws IOException
getRunnable
- Returns:
- a
Runnable
object. - Throws:
Exception
- if any.IOException
-
sendBanner
protected void sendBanner(OutputStream out) throws IOException
sendBanner
- Parameters:
out
- aOutputStream
object.- Throws:
IOException
- if any.
-
attemptConversation
protected boolean attemptConversation(BufferedReader in, OutputStream out) throws Exception
attemptConversation
- Parameters:
in
- aBufferedReader
object.out
- aOutputStream
object.- Returns:
- a boolean.
- Throws:
Exception
- if any.
-
addErrorHandler
protected void addErrorHandler(RequestHandler requestHandler)
addErrorHandler
- Parameters:
requestHandler
- aRequestHandler
object.
-
errorString
protected RequestHandler errorString(String error)
errorString
- Parameters:
error
- aString
object.- Returns:
- a
RequestHandler
object.
-
shutdownServer
protected RequestHandler shutdownServer(String response)
shutdownServer
- Parameters:
response
- aString
object.- Returns:
- a
RequestHandler
object.
-
setServerSocket
public void setServerSocket(ServerSocket serverSocket)
setServerSocket
- Parameters:
serverSocket
- aServerSocket
object.
-
getServerSocket
public ServerSocket getServerSocket()
getServerSocket
- Returns:
- a
ServerSocket
object.
-
setServerThread
protected void setServerThread(Thread serverThread)
setServerThread
- Parameters:
serverThread
- aThread
object.
-
-