org.apache.sshd.client.session
Class ClientSessionImpl

java.lang.Object
  extended by org.apache.sshd.common.session.AbstractSession
      extended by org.apache.sshd.client.session.ClientSessionImpl
All Implemented Interfaces:
ClientSession, Session

public class ClientSessionImpl
extends AbstractSession
implements ClientSession

TODO Add javadoc

Author:
Apache MINA SSHD Project

Nested Class Summary
static class ClientSessionImpl.State
           
 
Nested classes/interfaces inherited from interface org.apache.sshd.common.Session
Session.AttributeKey<T>
 
Field Summary
 
Fields inherited from class org.apache.sshd.common.session.AbstractSession
attributes, authed, channels, clientProposal, clientVersion, closeFuture, closing, decodeLock, decoderBuffer, decoderLength, decoderState, encodeLock, factoryManager, I_C, I_S, inCipher, inCipherSize, inCompression, inMac, inMacResult, ioSession, kex, listeners, lock, log, negociated, nextChannelId, outCipher, outCipherSize, outCompression, outMac, random, seqi, seqo, serverProposal, serverVersion, SESSION, sessionId, uncompressBuffer, username
 
Fields inherited from interface org.apache.sshd.ClientSession
AUTHED, CLOSED, TIMEOUT, WAIT_AUTH
 
Constructor Summary
ClientSessionImpl(FactoryManager client, org.apache.mina.core.session.IoSession session)
           
 
Method Summary
 AuthFuture authAgent(String username)
           
 AuthFuture authPassword(String username, String password)
           
 AuthFuture authPublicKey(String username, KeyPair key)
           
 CloseFuture close(boolean immediately)
          Close this session.
 ClientChannel createChannel(String type)
           
 ClientChannel createChannel(String type, String subType)
           
 ChannelExec createExecChannel(String command)
           
 ChannelShell createShellChannel()
           
 ChannelSubsystem createSubsystemChannel(String subsystem)
           
protected  void doHandleMessage(Buffer buffer)
           
 ClientFactoryManager getClientFactoryManager()
           
 KeyExchange getKex()
           
 Map<Object,Object> getMetadataMap()
           
protected  void handleMessage(Buffer buffer)
          Abstract method for processing incoming decoded packets.
protected  boolean readIdentification(Buffer buffer)
          Read the other side identification.
 void setState(ClientSessionImpl.State newState)
           
 int waitFor(int mask, long timeout)
           
 
Methods inherited from class org.apache.sshd.common.session.AbstractSession
addListener, attachSession, channelClose, channelData, channelEof, channelExtendedData, channelFailure, channelOpenConfirmation, channelOpenFailure, channelRequest, channelWindowAdjust, createBuffer, createProposal, decode, disconnect, doReadIdentification, exceptionCaught, getAttribute, getChannel, getFactoryManager, getIntProperty, getIoSession, getNextChannelId, getSession, getSession, getUsername, messageReceived, negociate, notImplemented, receiveKexInit, receiveNewKeys, registerChannel, removeListener, sendIdentification, sendKexInit, sendNewKeys, setAttribute, unregisterChannel, writePacket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientSessionImpl

public ClientSessionImpl(FactoryManager client,
                         org.apache.mina.core.session.IoSession session)
                  throws Exception
Throws:
Exception
Method Detail

getClientFactoryManager

public ClientFactoryManager getClientFactoryManager()

getKex

public KeyExchange getKex()

authAgent

public AuthFuture authAgent(String username)
                     throws IOException
Specified by:
authAgent in interface ClientSession
Throws:
IOException

authPassword

public AuthFuture authPassword(String username,
                               String password)
                        throws IOException
Specified by:
authPassword in interface ClientSession
Throws:
IOException

authPublicKey

public AuthFuture authPublicKey(String username,
                                KeyPair key)
                         throws IOException
Specified by:
authPublicKey in interface ClientSession
Throws:
IOException

createChannel

public ClientChannel createChannel(String type)
                            throws Exception
Specified by:
createChannel in interface ClientSession
Throws:
Exception

createChannel

public ClientChannel createChannel(String type,
                                   String subType)
                            throws Exception
Specified by:
createChannel in interface ClientSession
Throws:
Exception

createShellChannel

public ChannelShell createShellChannel()
                                throws Exception
Specified by:
createShellChannel in interface ClientSession
Throws:
Exception

createExecChannel

public ChannelExec createExecChannel(String command)
                              throws Exception
Specified by:
createExecChannel in interface ClientSession
Throws:
Exception

createSubsystemChannel

public ChannelSubsystem createSubsystemChannel(String subsystem)
                                        throws Exception
Specified by:
createSubsystemChannel in interface ClientSession
Throws:
Exception

close

public CloseFuture close(boolean immediately)
Description copied from class: AbstractSession
Close this session. This method will close all channels, then close the underlying MINA session. The call will not block until the mina session is actually closed.

Specified by:
close in interface ClientSession
Overrides:
close in class AbstractSession

handleMessage

protected void handleMessage(Buffer buffer)
                      throws Exception
Description copied from class: AbstractSession
Abstract method for processing incoming decoded packets. The given buffer will hold the decoded packet, starting from the command byte at the read position. Packets must be processed within this call or be copied because the given buffer is meant to be changed and updated when this method returns.

Specified by:
handleMessage in class AbstractSession
Parameters:
buffer - the buffer containing the packet
Throws:
Exception - if an exeption occurs while handling this packet.

doHandleMessage

protected void doHandleMessage(Buffer buffer)
                        throws Exception
Throws:
Exception

waitFor

public int waitFor(int mask,
                   long timeout)
Specified by:
waitFor in interface ClientSession

setState

public void setState(ClientSessionImpl.State newState)

readIdentification

protected boolean readIdentification(Buffer buffer)
                              throws IOException
Description copied from class: AbstractSession
Read the other side identification. This method is specific to the client or server side, but both should call AbstractSession.doReadIdentification(org.apache.sshd.common.util.Buffer) and store the result in the needed property.

Specified by:
readIdentification in class AbstractSession
Parameters:
buffer - the buffer containing the remote identification
Returns:
true if the identification has been fully read or false if more data is needed
Throws:
IOException - if an error occurs such as a bad protocol version

getMetadataMap

public Map<Object,Object> getMetadataMap()
Specified by:
getMetadataMap in interface ClientSession


Copyright © 2008-2012 Apache Software Foundation. All Rights Reserved.