Secure iNet Factory

com.jscape.inet.popssh
Class PopSsh

java.lang.Object
  extended by com.jscape.inet.pop.Pop
      extended by com.jscape.inet.popssh.PopSsh
All Implemented Interfaces:
java.io.Serializable

public class PopSsh
extends Pop

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

Example Usage:

 // connection parameters for SSH server
 String sshHostname = "pop3.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
 PopSsh pop = new PopSsh(sshParams, "pop3.myserver.com","jsmith","secret");
 try
 {
   // connect to POP3 server
   pop.connect();
    // get messages
   Enumeration e = pop.getMessages();
   while(e.hasMoreElements()) {
     EmailMessage em = (EmailMessage)e.nextElement();
   }
    // disconnect
   pop.disconnect();
 }
 catch(Exception e)
 {
   System.out.println(e);
 }
 

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.jscape.inet.pop.Pop
AUTH_APOP, AUTH_LOGIN, AUTH_PASS
 
Constructor Summary
PopSsh()
          Constructs a new Pop instance.
PopSsh(SshParameters sshParameters, java.lang.String hostname, java.lang.String username, java.lang.String password)
          Constructs a new PopSsh instance.
PopSsh(java.lang.String hostname, java.lang.String username, java.lang.String password)
          Constructs a new PopSsh instance.
 
Method Summary
 void connect()
          Connects to POP3 server tunelling data through SSH server and performs login with POP3 server.
 void disconnect()
          Disconnects from POP3 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.pop.Pop
addPopListener, clearProxySettings, deleteMessage, getAuthMode, getConnectTimeout, getDebugStream, getHostname, getMessage, getMessageCount, getMessageReader, getMessages, getMessageSize, getPort, getReadTimeout, getTimeout, getTop, getUid, getUsername, isConnected, isDebug, isDelete, issueCommand, issueCommand, issueCommandMultiLine, removePopListener, setAuthMode, setConnectTimeout, setDebug, setDebugStream, setDelete, setHostname, setPassword, setPort, setProxyAuthentication, setProxyHost, setProxyType, setReadTimeout, setTimeout, setUsername
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PopSsh

public PopSsh()
Constructs a new Pop instance.


PopSsh

public PopSsh(java.lang.String hostname,
              java.lang.String username,
              java.lang.String password)
Constructs a new PopSsh instance. Sets hostname, username and password for POP3 connection.

Parameters:
hostname - the hostname of POP3 server
username - the username of POP3 user
password - the password of POP3 user

PopSsh

public PopSsh(SshParameters sshParameters,
              java.lang.String hostname,
              java.lang.String username,
              java.lang.String password)
Constructs a new PopSsh instance. Sets hostname, username and password for POP3 connection and parameters for connection to SSH server.

Parameters:
hostname - the hostname of POP3 server
username - the username of POP3 user
password - the password of POP3 user
sshParameters - the SSH parameters used in establishing a secure connection
Method Detail

connect

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

Overrides:
connect in class Pop
Throws:
PopException - if I/O or POP3 related error occurs

disconnect

public void disconnect()
                throws PopException
Disconnects from POP3 server. Issues QUIT command to POP3 server and closes connection with SSH server.

Overrides:
disconnect in class Pop
Throws:
PopException - if I/O or POP3 related error occurs

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