DatabaseAccessInfo.java

Go to the documentation of this file.
00001 package edu.rice.cs.hpc.traceviewer.db;
00002 
00003 /************************************************
00004  * 
00005  * Info needed for remote connection
00006  * This class acts as a hub between RemoteDBOpener and OpenDatabaseDialog
00007  *  
00008  * We need to reorganize the classes to make it more modular
00009  *
00010  ************************************************/
00011 public class DatabaseAccessInfo 
00012 {
00013   // general info
00014   public String serverName = null, databasePath = null, serverPort = null;
00015   
00016   // info needed for SSH tunneling
00017   public String sshTunnelUsername = null, sshTunnelHostname = null, sshTunnelPassword = null;
00018   
00019   
00020   /************
00021    * check if ssh tunnel is enabled.
00022    * Currently we define an SSH tunnel is enabled if the hostname is defined.
00023    * This is not a perfect definition, but we can avoid redundant variables.
00024    * 
00025    * @return true if ssh tunnel should be enabled
00026    */
00027   public boolean isTunnelEnabled()
00028   {
00029       return sshTunnelHostname != null;
00030   }
00031   
00032   /*
00033    * (non-Javadoc)
00034    * @see java.lang.Object#toString()
00035    */
00036   public String toString() 
00037   {
00038       return "Hostname: " + sshTunnelHostname + ", "
00039               + "Hostname user: " + sshTunnelUsername ;
00040   }
00041   
00042   public boolean isLocal() 
00043   {
00044       if (serverName == null) {
00045           if (databasePath != null)
00046               return true;
00047           
00048           // both local database and remote information cannot be null
00049           // if this is the case, it should be error in code design ! 
00050           
00051           throw new RuntimeException("Path to the local database is null");
00052       }
00053       return false;
00054   }
00055 }

Generated on 5 May 2015 for HPCVIEWER by  doxygen 1.6.1