Class AbstractSimpleServer
- java.lang.Object
-
- org.opennms.netmgt.provision.server.AbstractSimpleServer
-
public abstract class AbstractSimpleServer extends java.lang.Object
Abstract AbstractSimpleServer class.
- Version:
- $Id: $
- Author:
- ranger
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractSimpleServer.BannerExchange
static interface
AbstractSimpleServer.Exchange
static interface
AbstractSimpleServer.RequestMatcher
static class
AbstractSimpleServer.SimpleServerExchange
-
Constructor Summary
Constructors Constructor Description AbstractSimpleServer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addRequestResponse(java.lang.String request, java.lang.String response)
addRequestResponseprotected boolean
attemptConversation(java.io.BufferedReader in, java.io.OutputStream out)
attemptConversationjava.net.InetAddress
getInetAddress()
getInetAddressint
getLocalPort()
getLocalPortjava.lang.Runnable
getRunnable()
getRunnableint
getTimeout()
getTimeoutvoid
init()
initprotected void
onInit()
onInitprotected AbstractSimpleServer.RequestMatcher
regexpMatches(java.lang.String regex)
regexpMatchesprotected void
setExpectedBanner(java.lang.String banner)
setExpectedBannervoid
setTimeout(int timeout)
setTimeoutvoid
startServer()
startServer
-
-
-
Method Detail
-
getTimeout
public int getTimeout()
getTimeout
- Returns:
- a int.
-
setTimeout
public void setTimeout(int timeout)
setTimeout
- Parameters:
timeout
- a int.
-
getInetAddress
public java.net.InetAddress getInetAddress()
getInetAddress
- Returns:
- InetAddress returns the inetaddress from the serversocket.
-
getLocalPort
public int getLocalPort()
getLocalPort
- Returns:
- a int.
-
init
public final void init() throws java.lang.Exception
init
- Throws:
java.lang.Exception
- if any.
-
onInit
protected void onInit()
onInit
-
startServer
public void startServer() throws java.lang.Exception
startServer
- Throws:
java.lang.Exception
- if any.
-
getRunnable
public java.lang.Runnable getRunnable() throws java.lang.Exception
getRunnable
- Returns:
- a
Runnable
object. - Throws:
java.lang.Exception
- if any.
-
attemptConversation
protected boolean attemptConversation(java.io.BufferedReader in, java.io.OutputStream out) throws java.io.IOException
attemptConversation
- Parameters:
in
- aBufferedReader
object.out
- aOutputStream
object.- Returns:
- a boolean.
- Throws:
java.io.IOException
- if any.
-
setExpectedBanner
protected void setExpectedBanner(java.lang.String banner)
setExpectedBanner
- Parameters:
banner
- aString
object.
-
addRequestResponse
protected void addRequestResponse(java.lang.String request, java.lang.String response)
addRequestResponse
- Parameters:
request
- aString
object.response
- aString
object.
-
regexpMatches
protected AbstractSimpleServer.RequestMatcher regexpMatches(java.lang.String regex)
regexpMatches
- Parameters:
regex
- aString
object.- Returns:
- a
AbstractSimpleServer.RequestMatcher
object.
-
-