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 long
DEFAULT_MESSAGE_POLL_FREQUENCY
Default value for "agent-client-message-poll-time"static String
MESSAGE_POLL_FREQUENCY
Time 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 void
close()
String
getAuthSocket()
FactoryManager
getFactoryManager()
boolean
isOpen()
protected void
messageReceived(Buffer buffer)
protected Buffer
request(Buffer buffer)
void
run()
protected void
throwException(int code)
transform an APR error number in a more fancy exceptionString
toString()
protected Buffer
waitForMessageBuffer()
-
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:
getFactoryManager
in interfaceFactoryManagerHolder
- Returns:
- The currently associated
FactoryManager
-
getAuthSocket
public String getAuthSocket()
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classAbstractAgentProxy
- Throws:
IOException
-
request
protected Buffer request(Buffer buffer) throws IOException
- Specified by:
request
in classAbstractAgentProxy
- Throws:
IOException
-
waitForMessageBuffer
protected Buffer waitForMessageBuffer() throws IOException
- Throws:
IOException
-
throwException
protected void throwException(int code) throws IOException
transform 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
-
-