Secure iNet Factory

com.jscape.inet.imapssh
Class ImapSsh

java.lang.Object
  extended by com.jscape.inet.imap.Imap
      extended by com.jscape.inet.imapssh.ImapSsh
All Implemented Interfaces:
java.io.Serializable

public class ImapSsh
extends Imap

Implements the basic functionality of a IMAP client tunnelling data through a secure SSH connection.

Example Usage:

 // connection information for SSH server
 String sshHostname = "imap4.myserver.com";
 String sshUsername = "jsmith";
 String sshPassword = "secret";

 // create new SshParameters instance
 SshParameters sshParams = new SshParameters(sshHostname,sshUsername,sshPassword);

 // new instance with SSH parameters hostname, username and password
 ImapSsh imap = new ImapSsh(sshParams,"imap4.myserver.com","jsmith","secret");
 try {
   // connect to IMAP4 server
   imap.connect();

   // get messages
   int messageCount = imap.getMessageCount();
   for(int i = 1; i <= messageCount(); ++i) {
     EmailMessage em = imap.getMessage(i);
   }

   // disconnect
   imap.disconnect();
 }
 catch(Exception e) {
   System.out.println(e);
 }
 

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jscape.inet.imap.Imap
AUTH_CRAM_MD5, AUTH_LOGIN, FLAG_ANSWERED, FLAG_DELETED, FLAG_DRAFT, FLAG_FLAGGED, FLAG_MODE_ADD, FLAG_MODE_DELETE, FLAG_MODE_REPLACE, FLAG_RECENT, FLAG_SEEN
 
Constructor Summary
ImapSsh()
          Creates a new ImapSsh instance.
ImapSsh(SshParameters sshParameters, java.lang.String hostname, java.lang.String username, java.lang.String password)
          Creates a new ImapSsh instance.
ImapSsh(java.lang.String hostname, java.lang.String username, java.lang.String password)
          Creates a new ImapSsh instance.
 
Method Summary
 void connect()
          Connects to IMAP server tunelling data through SSH server and performs login with IMAP server.
 void disconnect()
          Disconnects from IMAP server.
 SshParameters getSshParameters()
          Gets SSH parameters used in establishing connection with SSH server.
 void setSshParameters(SshParameters parameters)
          Sets SSH parameters used in establishing connection with SSH server.
 
Methods inherited from class com.jscape.inet.imap.Imap
addImapListener, append, append, clearProxySettings, createMailbox, deleteMailbox, deleteMessage, deleteMessages, expunge, getAuthMode, getConnectTimeout, getDebugStream, getHostname, getMailboxes, getMessage, getMessageCount, getMessageHeader, getMessageHeaders, getMessageID, getMessages, getMessages, getMessages, getMessagesWithFlags, getMessagesWithFlags, getMessagesWithFlags, getMessageWithFlags, getNewMessageID, getNewMessages, getNewMessagesWithFlags, getPort, getReadTimeout, getTimeout, getUid, getUid, getUsername, isConnected, isDebug, isDelete, issueCommand, listMailboxes, listMailboxes, removeImapListener, renameMailbox, selectMailbox, setAuthMode, setConnectTimeout, setDebug, setDebugStream, setDelete, setHostname, setPassword, setPort, setProxyAuthentication, setProxyHost, setProxyType, setReadTimeout, setTimeout, setUsername, store, store
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImapSsh

public ImapSsh()
Creates a new ImapSsh instance.


ImapSsh

public ImapSsh(java.lang.String hostname,
               java.lang.String username,
               java.lang.String password)
Creates a new ImapSsh instance.

Parameters:
hostname - the IMAP hostname
username - the IMAP username
password - the IMAP password

ImapSsh

public ImapSsh(SshParameters sshParameters,
               java.lang.String hostname,
               java.lang.String username,
               java.lang.String password)
Creates a new ImapSsh instance.

Parameters:
hostname - the IMAP hostname
username - the IMAP username
password - the IMAP password
sshParameters - the SSH parameters used in establishing a secure connection
Method Detail

connect

public void connect()
             throws ImapException
Connects to IMAP server tunelling data through SSH server and performs login with IMAP server.

Overrides:
connect in class Imap
Throws:
ImapException - if I/O or IMAP related error occurs

disconnect

public void disconnect()
                throws ImapException
Disconnects from IMAP server. Issues CLOSE and LOGOUT commands to IMAP server and closes connection with SSH server.

Overrides:
disconnect in class Imap
Throws:
ImapException - if I/O or IMAP related error occurs
See Also:
Imap.connect()

getSshParameters

public SshParameters getSshParameters()
Gets SSH parameters used in establishing connection with SSH server.

Returns:
the SSH parameters
See Also:
SshParameters

setSshParameters

public void setSshParameters(SshParameters parameters)
Sets SSH parameters used in establishing connection with SSH server.

Parameters:
parameters - the SSH parameters
See Also:
SshParameters

Secure iNet Factory

Copyright © JSCAPE LLC. 1999-2011. All Rights Reserved