Class Connector

java.lang.Object
com.wisecoders.dbs.schema.Connector

public final class Connector extends Object
The generic connection to the database, stores all parameters required to connect. The effective connection is called Envoy.
  • Field Details

    • dbId

      public final String dbId
    • mapping

      public final SchemaMapping mapping
    • activeCatalogName

      public String activeCatalogName
  • Constructor Details

    • Connector

      public Connector(String dbId, String name)
      Connector always belongs to a project
    • Connector

      public Connector(String alias, String dbId, String driverJarClassName, String driverJarFileName, com.wisecoders.dbs.dbms.driver.model.JdbcUrlTemplate jdbcUrlTemplate, String host, int port, String dbInstance, String userName, boolean readOnly)
      Connector with parameters
      Parameters:
      alias - identifies this connector in project
      dbId - the database name
      driverJarClassName - the JDBC Driver class name
      driverJarFileName - the JDBC Driver jar file
      jdbcUrlTemplate - with details about the URL structure
      host - host to connect to
      port - port to connect to
      dbInstance - the name of the database or the instance
      userName - of the database user
      readOnly - true to read only
  • Method Details

    • startEnvoy

      public com.wisecoders.dbs.dbms.connect.model.envoy.Envoy startEnvoy(String envoyName)
    • setName

      public void setName(String name)
    • getName

      public String getName()
    • getUserName

      public String getUserName()
    • setUser

      public boolean setUser(String user)
    • getPassword

      public String getPassword()
    • setPassword

      public boolean setPassword(String password)
      Set the password for the database user
      Parameters:
      password - to use
      Returns:
      true if password changed
    • setParam

      public boolean setParam(String param)
    • setParam2

      public boolean setParam2(String param2)
    • setParam3

      public boolean setParam3(String param3)
    • setParam4

      public boolean setParam4(String param4)
    • setParam5

      public boolean setParam5(String param5)
    • getParameter

      public String getParameter()
    • getParameter2

      public String getParameter2()
    • getParameter3

      public String getParameter3()
    • getParameter4

      public String getParameter4()
    • getParameter5

      public String getParameter5()
    • getHost

      public String getHost()
    • setHost

      public boolean setHost(String host)
      Set the host to connect to
      Parameters:
      host - to connect to
      Returns:
      true if changed
    • getPort

      public int getPort()
    • setPort

      public boolean setPort(int port)
      Set the port to connect to
      Parameters:
      port - on database host
      Returns:
      true if changed
    • isLocalhost

      public boolean isLocalhost()
      Returns:
      true if the host is the localhost
    • isLocalhostAndDefaultPort

      public boolean isLocalhostAndDefaultPort()
    • getInstance

      public String getInstance()
    • setUrlTemplateName

      public boolean setUrlTemplateName(String templateName)
    • getUrlTemplateName

      public String getUrlTemplateName()
    • setInstance

      public boolean setInstance(String instance)
    • closeAllEnvoysAndSsh

      public void closeAllEnvoysAndSsh()
    • setReadOnly

      public boolean setReadOnly(boolean readOnly)
    • isReadOnly

      public boolean isReadOnly()
    • throwSQLExceptionIfReadOnly

      public void throwSQLExceptionIfReadOnly() throws SQLException
      Throws:
      SQLException
    • getPhysicalConnectedCount

      public int getPhysicalConnectedCount()
    • isProcessing

      public boolean isProcessing()
    • setRememberPassword

      public boolean setRememberPassword(boolean remember)
    • isRememberPassword

      public boolean isRememberPassword()
    • setDriverJarClass

      public boolean setDriverJarClass(String driverJarFileName, String driverJarClassName)
    • setDriverUrl

      public boolean setDriverUrl(com.wisecoders.dbs.dbms.driver.model.JdbcUrlTemplate driver)
    • getDriverJarClassName

      public String getDriverJarClassName()
    • getDriverJarFileName

      public String getDriverJarFileName()
    • getDriverUrl

      public com.wisecoders.dbs.dbms.driver.model.JdbcUrlTemplate getDriverUrl()
    • needsEdit

      public boolean needsEdit()
      Returns:
      true if it cannot connect until a password is given
    • loadDriverForSampleProject

      public void loadDriverForSampleProject()
    • getURL

      public String getURL()
    • setConnectionProperties

      public boolean setConnectionProperties(String prop2)
    • getConnectionProperties

      public String getConnectionProperties()
    • getProperties

      public Properties getProperties()
    • markForDeletion

      public void markForDeletion()
    • isMarkedForDeletion

      public boolean isMarkedForDeletion()
    • refresh

      public void refresh()
    • setCustomUrl

      public boolean setCustomUrl(String customUrl)
    • getCustomUrl

      public String getCustomUrl()
    • learnDbmsIfRequired

      public void learnDbmsIfRequired()
    • learnDbmsTemplate

      public void learnDbmsTemplate() throws Exception
      Throws:
      Exception
    • setHasConnected

      public void setHasConnected()
    • shouldAutoSynchronize

      public boolean shouldAutoSynchronize()
    • resetResyncFlag

      public void resetResyncFlag()
    • getSshHost

      public String getSshHost()
    • setSshHost

      public void setSshHost(String sshHost)
    • getSshUser

      public String getSshUser()
    • setSshUser

      public void setSshUser(String sshUser)
    • getSshPassword

      public String getSshPassword()
    • setSshPassword

      public void setSshPassword(String sshPassword)
    • getSshPrivateKeyFile

      public String getSshPrivateKeyFile()
    • setSshPrivateKeyFile

      public void setSshPrivateKeyFile(String sshPrivateKeyFile)
    • getSshPassphrase

      public String getSshPassphrase()
    • setSshPassphrase

      public void setSshPassphrase(String sshPassphrase)
    • getSshPort

      public int getSshPort()
    • setSshPort

      public void setSshPort(int sshPort)
    • isSshEnable

      public boolean isSshEnable()
    • setSshEnable

      public void setSshEnable(boolean sshEnable)
    • isSshUseKey

      public boolean isSshUseKey()
    • setSshUseKey

      public void setSshUseKey(boolean sshUseKey)
    • setupSSHTunnel

      public com.jcraft.jsch.Session setupSSHTunnel(boolean reuse) throws com.jcraft.jsch.JSchException
      Throws:
      com.jcraft.jsch.JSchException
    • pingSSHTunnel

      public com.jcraft.jsch.Session pingSSHTunnel() throws com.jcraft.jsch.JSchException
      Throws:
      com.jcraft.jsch.JSchException
    • getSSHLocalPort

      public int getSSHLocalPort()
    • schemaChanged

      public void schemaChanged()
    • delaySchemaChanged

      public void delaySchemaChanged()
    • addSqlEvent

      public void addSqlEvent(com.wisecoders.dbs.dbms.connect.model.SqlEvent event)
    • transferSqlEventsTo

      public void transferSqlEventsTo(List<com.wisecoders.dbs.dbms.connect.model.SqlEvent> other)
    • importSchema

      public Schema importSchema(Project project, String catalogDotSchemaName) throws Exception
      Reverse engineer given schema from database. Schema name can be simply the schmema name or catalog dot schema name if multiple catalogs (databases) are available. METHOD EXPOSED FOR GROOVY.
      Parameters:
      catalogDotSchemaName - to reverse engineer.
      Returns:
      imported schema
      Throws:
      Exception - during exception
    • importSchemes

      public List<Schema> importSchemes(Project project, String... catalogDotSchemaName) throws Exception
      Throws:
      Exception
    • importSchemes

      public List<Schema> importSchemes(Project project, javafx.util.Callback<TreeSelection,Void> selectionCallback, String... catalogDotSchemaName) throws Exception
      Reverse engineer given schema from database. Each entry can be a catalog.schema if there are multiple databases(catalogs) available METHOD EXPOSED FOR GROOVY.
      Parameters:
      selectionCallback - for selective import. The callback receives a TreeSelection, where you can specify schemes, tables, etc. to import or not.
      catalogDotSchemaName - to reverse engineer.
      Returns:
      list of schemas
      Throws:
      Exception - during exception
    • isMongo

      public boolean isMongo()
    • getTimeZone

      public String getTimeZone()
    • setTimeZone

      public boolean setTimeZone(String timeZone)
    • setEnvironment

      public boolean setEnvironment(Connector.Environment environment)
    • getEnvironment

      public Connector.Environment getEnvironment()
    • getProxyHost

      public String getProxyHost()
    • setProxyHost

      public void setProxyHost(String proxyHost)
    • getProxyPort

      public int getProxyPort()
    • setProxyPort

      public void setProxyPort(int proxyPort)
    • getProxyUser

      public String getProxyUser()
    • setProxyUser

      public void setProxyUser(String proxyUser)
    • getProxyPassword

      public String getProxyPassword()
    • setProxyPassword

      public void setProxyPassword(String proxyPassword)
    • getProxyType

      public Connector.ProxyType getProxyType()
    • setProxyType

      public void setProxyType(Connector.ProxyType proxyType)
    • isUseSystemProxy

      public boolean isUseSystemProxy()
    • setUseSystemProxy

      public void setUseSystemProxy(boolean useSystemProxy)
    • setProxy

      public void setProxy()
    • getStatusString

      public String getStatusString()
    • hasActiveEnvoys

      public boolean hasActiveEnvoys()
    • getStatistics

      public String getStatistics()
    • getHTMLMessageAndAdvice

      public String getHTMLMessageAndAdvice(Throwable ex, String title, String message, ConnectivityTip tip)
    • getPlainMessageAndAdvice

      public String getPlainMessageAndAdvice(Throwable ex)
    • generateData

      public void generateData(GeneratorTable generatorTable) throws Exception
      Throws:
      Exception
    • loadFromHistory

      public void loadFromHistory(String alias)
    • setVisibleInMenu

      public void setVisibleInMenu(boolean visibleInMenu)
    • isVisibleInMenu

      public boolean isVisibleInMenu()
    • getCliProject

      public Project getCliProject()
    • getActiveCliSchema

      public Schema getActiveCliSchema()
    • setActiveCliSchema

      public void setActiveCliSchema(String catalogName)