home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / TUTORIAL.BIN / ClientSession.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-01-30  |  2.7 KB  |  82 lines

  1. package symantec.itools.db.net;
  2.  
  3. import java.awt.Frame;
  4. import java.net.InetAddress;
  5. import java.net.UnknownHostException;
  6. import java.util.Vector;
  7. import symjava.sql.SQLException;
  8.  
  9. public class ClientSession {
  10.    MPlex _mplex;
  11.    // $FF: renamed from: _f java.awt.Frame
  12.    private Frame field_0;
  13.  
  14.    public ClientSession(InetAddress host, int port, String repos, boolean shareSocket) throws NetException {
  15.       this.init(host, port, shareSocket);
  16.    }
  17.  
  18.    public ClientSession(String hostname, int port, String repos, boolean shareSocket) throws UnknownHostException, NetException {
  19.       InetAddress host = InetAddress.getByName(hostname);
  20.       this.init(host, port, shareSocket);
  21.    }
  22.  
  23.    private void init(InetAddress host, int port, boolean shareSocket) throws NetException {
  24.       this.field_0 = new Frame("SCALE errors");
  25.       this._mplex = new MPlex(host, port, shareSocket, this);
  26.       this._mplex.connect();
  27.    }
  28.  
  29.    public void loginPublic(String username, String password) throws SQLException {
  30.       SessionRequest s;
  31.       try {
  32.          s = new SessionRequest(this);
  33.       } catch (Exception var4) {
  34.          throw new SQLException("Login Failure");
  35.       }
  36.  
  37.       s.loginPublic(username, password);
  38.    }
  39.  
  40.    public void loginPrivate(String key, String username, String password) throws SQLException {
  41.       SessionRequest s;
  42.       try {
  43.          s = new SessionRequest(this);
  44.       } catch (Exception var5) {
  45.          throw new SQLException("Login Failure");
  46.       }
  47.  
  48.       s.loginPrivate(key, username, password);
  49.    }
  50.  
  51.    public Vector getRepositoryList() throws SQLException {
  52.       SessionRequest s;
  53.       try {
  54.          s = new SessionRequest(this);
  55.       } catch (Exception var2) {
  56.          throw new SQLException("Login Failure");
  57.       }
  58.  
  59.       return s.getRepositoryList();
  60.    }
  61.  
  62.    void DisplayError(String caption, String error) {
  63.    }
  64.  
  65.    public void close() {
  66.       if (this._mplex != null) {
  67.          this._mplex.disconnect();
  68.          this._mplex.close();
  69.          this._mplex = null;
  70.       }
  71.  
  72.    }
  73.  
  74.    public void finalize() {
  75.       this.close();
  76.    }
  77.  
  78.    void lostConnection() {
  79.       this._mplex = null;
  80.    }
  81. }
  82.