Class NrpeClient
- java.lang.Object
-
- org.opennms.netmgt.provision.detector.simple.client.NrpeClient
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,SocketWrapper
,Client<NrpeRequest,NrpePacket>
public class NrpeClient extends Object implements Client<NrpeRequest,NrpePacket>, SocketWrapper
NrpeClient class.
- Version:
- $Id: $
- Author:
- Donald Desloge
-
-
Constructor Summary
Constructors Constructor Description NrpeClient()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
closevoid
connect(InetAddress address, int port, int timeout)
connectInputStream
getInput()
getInputOutputStream
getOutput()
getOutputint
getPadding()
getPaddingprotected Socket
getWrappedSocket(InetAddress address, int port, int timeout)
getWrappedSocketboolean
isUseSsl()
isUseSslNrpePacket
receiveBanner()
receiveBannerNrpePacket
sendRequest(NrpeRequest request)
sendRequestvoid
setInput(InputStream in)
setInputvoid
setOutput(OutputStream out)
setOutputvoid
setPadding(int padding)
setPaddingvoid
setUseSsl(boolean useSsl)
setUseSslSocket
wrapSocket(Socket socket)
wrapSocket
-
-
-
Method Detail
-
close
public void close()
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceClient<NrpeRequest,NrpePacket>
- Specified by:
close
in interfaceCloseable
-
connect
public void connect(InetAddress address, int port, int timeout) throws IOException, Exception
connect
- Specified by:
connect
in interfaceClient<NrpeRequest,NrpePacket>
- Parameters:
address
- aInetAddress
object.port
- a int.timeout
- a int.- Throws:
IOException
- if any.Exception
- if any.
-
getWrappedSocket
protected Socket getWrappedSocket(InetAddress address, int port, int timeout) throws IOException
getWrappedSocket
- Parameters:
address
- aInetAddress
object.port
- a int.timeout
- a int.- Returns:
- a
Socket
object. - Throws:
IOException
- if any.
-
wrapSocket
public Socket wrapSocket(Socket socket) throws IOException
wrapSocket
- Specified by:
wrapSocket
in interfaceSocketWrapper
- Parameters:
socket
- aSocket
object.hostAddress
- aString
object.port
- a int.- Returns:
- a
Socket
object. - Throws:
Exception
- if any.IOException
-
receiveBanner
public NrpePacket receiveBanner() throws IOException, Exception
receiveBanner
- Specified by:
receiveBanner
in interfaceClient<NrpeRequest,NrpePacket>
- Returns:
- a
NrpePacket
object. - Throws:
IOException
- if any.Exception
- if any.
-
sendRequest
public NrpePacket sendRequest(NrpeRequest request) throws IOException, Exception
sendRequest
- Specified by:
sendRequest
in interfaceClient<NrpeRequest,NrpePacket>
- Parameters:
request
- aNrpeRequest
object.- Returns:
- a
NrpePacket
object. - Throws:
IOException
- if any.Exception
- if any.
-
setPadding
public void setPadding(int padding)
setPadding
- Parameters:
padding
- a int.
-
getPadding
public int getPadding()
getPadding
- Returns:
- a int.
-
setUseSsl
public void setUseSsl(boolean useSsl)
setUseSsl
- Parameters:
useSsl
- a boolean.
-
isUseSsl
public boolean isUseSsl()
isUseSsl
- Returns:
- a boolean.
-
setOutput
public void setOutput(OutputStream out)
setOutput
- Parameters:
out
- aOutputStream
object.
-
getOutput
public OutputStream getOutput()
getOutput
- Returns:
- a
OutputStream
object.
-
setInput
public void setInput(InputStream in)
setInput
- Parameters:
in
- aInputStream
object.
-
getInput
public InputStream getInput()
getInput
- Returns:
- a
InputStream
object.
-
-