Class Ssh
- java.lang.Object
-
- org.opennms.netmgt.provision.support.ssh.AbstractPoll
-
- org.opennms.netmgt.provision.support.ssh.Ssh
-
- All Implemented Interfaces:
Poll
public class Ssh extends AbstractPoll
Ssh class.
- Version:
- $Id: $
- Author:
- Benjamin Reed
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_CLIENT_BANNERConstantDEFAULT_CLIENT_BANNER="SSH-1.99-OpenNMS_1.5"static intDEFAULT_PORTConstantDEFAULT_PORT=22protected InetAddressm_addressprotected Stringm_bannerprotected Throwablem_errorprotected Stringm_passwordprotected intm_portprotected Stringm_serverBannerprotected Stringm_username-
Fields inherited from class org.opennms.netmgt.provision.support.ssh.AbstractPoll
m_timeout
-
-
Constructor Summary
Constructors Constructor Description Ssh()Constructor for Ssh.Ssh(InetAddress address)Constructor for Ssh.Ssh(InetAddress address, int port)Constructor for Ssh.Ssh(InetAddress address, int port, int timeout)Constructor for Ssh.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddisconnect()disconnectInetAddressgetAddress()Get the address to connect to.StringgetClientBanner()Get the banner string used when connectingprotected ThrowablegetError()getErrorStringgetPassword()Get the password to connect with.intgetPort()Get the port to connect to.StringgetServerBanner()Get the SSH server version banner.StringgetUsername()Get the username to connect as.PollStatuspoll(TimeoutTracker tracker)pollvoidsetAddress(InetAddress address)Set the address to connect to.voidsetClientBanner(String banner)Set the banner string to use when connectingprotected voidsetError(Throwable t)setErrorvoidsetPassword(String password)Set the password to connect with.voidsetPort(int port)Set the port to connect to.voidsetUsername(String username)Set the username to connect as.protected booleantryConnect()Attempt to connect, based on the parameters which have been set in the object.-
Methods inherited from class org.opennms.netmgt.provision.support.ssh.AbstractPoll
getTimeout, poll, setTimeout
-
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
ConstantDEFAULT_PORT=22- See Also:
- Constant Field Values
-
DEFAULT_CLIENT_BANNER
public static final String DEFAULT_CLIENT_BANNER
ConstantDEFAULT_CLIENT_BANNER="SSH-1.99-OpenNMS_1.5"- See Also:
- Constant Field Values
-
m_port
protected int m_port
-
m_username
protected String m_username
-
m_password
protected String m_password
-
m_banner
protected String m_banner
-
m_serverBanner
protected String m_serverBanner
-
m_address
protected InetAddress m_address
-
m_error
protected Throwable m_error
-
-
Constructor Detail
-
Ssh
public Ssh()
Constructor for Ssh.
-
Ssh
public Ssh(InetAddress address)
Constructor for Ssh.
- Parameters:
address- aInetAddressobject.
-
Ssh
public Ssh(InetAddress address, int port)
Constructor for Ssh.
- Parameters:
address- aInetAddressobject.port- a int.
-
Ssh
public Ssh(InetAddress address, int port, int timeout)
Constructor for Ssh.
- Parameters:
address- aInetAddressobject.port- a int.timeout- a int.
-
-
Method Detail
-
setAddress
public void setAddress(InetAddress address)
Set the address to connect to.- Parameters:
address- the address
-
getAddress
public InetAddress getAddress()
Get the address to connect to.- Returns:
- the address
-
setPort
public void setPort(int port)
Set the port to connect to.- Parameters:
port- the port
-
getPort
public int getPort()
Get the port to connect to.- Returns:
- the port
-
setUsername
public void setUsername(String username)
Set the username to connect as.- Parameters:
username- the username
-
getUsername
public String getUsername()
Get the username to connect as.- Returns:
- the username
-
setPassword
public void setPassword(String password)
Set the password to connect with.- Parameters:
password- the password
-
getPassword
public String getPassword()
Get the password to connect with.- Returns:
- the password
-
setClientBanner
public void setClientBanner(String banner)
Set the banner string to use when connecting- Parameters:
banner- the banner
-
getClientBanner
public String getClientBanner()
Get the banner string used when connecting- Returns:
- the banner
-
getServerBanner
public String getServerBanner()
Get the SSH server version banner.- Returns:
- the version string
-
tryConnect
protected boolean tryConnect() throws InsufficientParametersExceptionAttempt to connect, based on the parameters which have been set in the object.- Returns:
- true if it is able to connect
- Throws:
InsufficientParametersException- if any.
-
disconnect
protected void disconnect()
disconnect
-
poll
public PollStatus poll(TimeoutTracker tracker) throws InsufficientParametersException
poll
- Specified by:
pollin classAbstractPoll- Parameters:
tracker- aTimeoutTrackerobject.- Returns:
- a
PollStatusobject. - Throws:
InsufficientParametersException- if any.
-
-