Package org.apache.sshd.agent.unix
Class AgentClient
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.agent.common.AbstractAgentProxy
-
- org.apache.sshd.agent.unix.AgentClient
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Runnable,Channel,SshAgent,FactoryManagerHolder,ExecutorServiceCarrier
public class AgentClient extends AbstractAgentProxy implements Runnable, FactoryManagerHolder
A client for a remote SSH agent
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_MESSAGE_POLL_FREQUENCYDefault value for "agent-client-message-poll-time"static StringMESSAGE_POLL_FREQUENCYTime to wait for new incoming messages before checking if the client is still active-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.agent.SshAgent
SSH_AUTHSOCKET_ENV_NAME
-
-
Constructor Summary
Constructors Constructor Description AgentClient(FactoryManager manager, String authSocket)AgentClient(FactoryManager manager, String authSocket, CloseableExecutorService executor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()StringgetAuthSocket()FactoryManagergetFactoryManager()booleanisOpen()protected voidmessageReceived(Buffer buffer)protected Bufferrequest(Buffer buffer)voidrun()protected voidthrowException(int code)transform an APR error number in a more fancy exceptionStringtoString()protected BufferwaitForMessageBuffer()-
Methods inherited from class org.apache.sshd.agent.common.AbstractAgentProxy
addIdentity, createBuffer, createBuffer, getChannelType, getExecutorService, getIdentities, prepare, removeAllIdentities, removeIdentity, setChannelType, sign
-
Methods inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
debug, debug, debug, debug, debug, error, error, error, error, error, getSimplifiedLogger, info, info, warn, warn, warn, warn, warn, warn, warn, warn
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.agent.SshAgent
resolveLocalIdentity
-
-
-
-
Field Detail
-
MESSAGE_POLL_FREQUENCY
public static final String MESSAGE_POLL_FREQUENCY
Time to wait for new incoming messages before checking if the client is still active- See Also:
- Constant Field Values
-
DEFAULT_MESSAGE_POLL_FREQUENCY
public static final long DEFAULT_MESSAGE_POLL_FREQUENCY
Default value for "agent-client-message-poll-time"
-
-
Constructor Detail
-
AgentClient
public AgentClient(FactoryManager manager, String authSocket) throws IOException
- Throws:
IOException
-
AgentClient
public AgentClient(FactoryManager manager, String authSocket, CloseableExecutorService executor) throws IOException
- Throws:
IOException
-
-
Method Detail
-
getFactoryManager
public FactoryManager getFactoryManager()
- Specified by:
getFactoryManagerin interfaceFactoryManagerHolder- Returns:
- The currently associated
FactoryManager
-
getAuthSocket
public String getAuthSocket()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractAgentProxy- Throws:
IOException
-
request
protected Buffer request(Buffer buffer) throws IOException
- Specified by:
requestin classAbstractAgentProxy- Throws:
IOException
-
waitForMessageBuffer
protected Buffer waitForMessageBuffer() throws IOException
- Throws:
IOException
-
throwException
protected void throwException(int code) throws IOExceptiontransform an APR error number in a more fancy exception- Parameters:
code- APR error code- Throws:
IOException- the produced exception for the given APR error number
-
-