Package com.wisecoders.dbs.schema
Class Connector
java.lang.Object
com.wisecoders.dbs.schema.Connector
The generic connection to the database, stores all parameters required to connect. The effective connection is called Envoy.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumclassstatic enum -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConnector always belongs to a projectConnector(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 -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSqlEvent(com.wisecoders.dbs.dbms.connect.model.SqlEvent event) voidvoidvoidgenerateData(GeneratorTable generatorTable) com.wisecoders.dbs.dbms.driver.model.JdbcUrlTemplategetHost()getHTMLMessageAndAdvice(Throwable ex, String title, String message, ConnectivityTip tip) getName()intintgetPort()intintintgetURL()booleanimportSchema(Project project, String catalogDotSchemaName) Reverse engineer given schema from database.importSchemes(Project project, String... catalogDotSchemaName) importSchemes(Project project, javafx.util.Callback<TreeSelection, Void> selectionCallback, String... catalogDotSchemaName) Reverse engineer given schema from database.booleanbooleanbooleanbooleanisMongo()booleanbooleanbooleanbooleanbooleanbooleanbooleanvoidvoidvoidvoidloadFromHistory(String alias) voidbooleancom.jcraft.jsch.Sessionvoidrefresh()voidvoidvoidsetActiveCliSchema(String catalogName) booleansetConnectionProperties(String prop2) booleansetCustomUrl(String customUrl) booleansetDriverJarClass(String driverJarFileName, String driverJarClassName) booleansetDriverUrl(com.wisecoders.dbs.dbms.driver.model.JdbcUrlTemplate driver) booleansetEnvironment(Connector.Environment environment) voidbooleanSet the host to connect tobooleansetInstance(String instance) voidbooleanbooleanbooleanbooleanbooleanbooleansetPassword(String password) Set the password for the database userbooleansetPort(int port) Set the port to connect tovoidsetProxy()voidsetProxyHost(String proxyHost) voidsetProxyPassword(String proxyPassword) voidsetProxyPort(int proxyPort) voidsetProxyType(Connector.ProxyType proxyType) voidsetProxyUser(String proxyUser) booleansetReadOnly(boolean readOnly) booleansetRememberPassword(boolean remember) voidsetSshEnable(boolean sshEnable) voidsetSshHost(String sshHost) voidsetSshPassphrase(String sshPassphrase) voidsetSshPassword(String sshPassword) voidsetSshPort(int sshPort) voidsetSshPrivateKeyFile(String sshPrivateKeyFile) voidsetSshUseKey(boolean sshUseKey) voidsetSshUser(String sshUser) booleansetTimeZone(String timeZone) com.jcraft.jsch.SessionsetupSSHTunnel(boolean reuse) booleansetUrlTemplateName(String templateName) booleanvoidsetUseSystemProxy(boolean useSystemProxy) voidsetVisibleInMenu(boolean visibleInMenu) booleancom.wisecoders.dbs.dbms.connect.model.envoy.EnvoystartEnvoy(String envoyName) voidvoidtransferSqlEventsTo(List<com.wisecoders.dbs.dbms.connect.model.SqlEvent> other)
-
Field Details
-
dbId
-
mapping
-
activeCatalogName
-
-
Constructor Details
-
Connector
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 projectdbId- the database namedriverJarClassName- the JDBC Driver class namedriverJarFileName- the JDBC Driver jar filejdbcUrlTemplate- with details about the URL structurehost- host to connect toport- port to connect todbInstance- the name of the database or the instanceuserName- of the database userreadOnly- true to read only
-
-
Method Details
-
startEnvoy
-
setName
-
getName
-
getUserName
-
setUser
-
getPassword
-
setPassword
Set the password for the database user- Parameters:
password- to use- Returns:
- true if password changed
-
setParam
-
setParam2
-
setParam3
-
setParam4
-
setParam5
-
getParameter
-
getParameter2
-
getParameter3
-
getParameter4
-
getParameter5
-
getHost
-
setHost
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
-
setUrlTemplateName
-
getUrlTemplateName
-
setInstance
-
closeAllEnvoysAndSsh
public void closeAllEnvoysAndSsh() -
setReadOnly
public boolean setReadOnly(boolean readOnly) -
isReadOnly
public boolean isReadOnly() -
throwSQLExceptionIfReadOnly
- Throws:
SQLException
-
getPhysicalConnectedCount
public int getPhysicalConnectedCount() -
isProcessing
public boolean isProcessing() -
setRememberPassword
public boolean setRememberPassword(boolean remember) -
isRememberPassword
public boolean isRememberPassword() -
setDriverJarClass
-
setDriverUrl
public boolean setDriverUrl(com.wisecoders.dbs.dbms.driver.model.JdbcUrlTemplate driver) -
getDriverJarClassName
-
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
-
setConnectionProperties
-
getConnectionProperties
-
getProperties
-
markForDeletion
public void markForDeletion() -
isMarkedForDeletion
public boolean isMarkedForDeletion() -
refresh
public void refresh() -
setCustomUrl
-
getCustomUrl
-
learnDbmsIfRequired
public void learnDbmsIfRequired() -
learnDbmsTemplate
- Throws:
Exception
-
setHasConnected
public void setHasConnected() -
shouldAutoSynchronize
public boolean shouldAutoSynchronize() -
resetResyncFlag
public void resetResyncFlag() -
getSshHost
-
setSshHost
-
getSshUser
-
setSshUser
-
getSshPassword
-
setSshPassword
-
getSshPrivateKeyFile
-
setSshPrivateKeyFile
-
getSshPassphrase
-
setSshPassphrase
-
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
-
importSchema
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
- Throws:
Exception
-
importSchemes
public List<Schema> importSchemes(Project project, javafx.util.Callback<TreeSelection, Void> selectionCallback, String... catalogDotSchemaName) throws ExceptionReverse 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
-
setTimeZone
-
setEnvironment
-
getEnvironment
-
getProxyHost
-
setProxyHost
-
getProxyPort
public int getProxyPort() -
setProxyPort
public void setProxyPort(int proxyPort) -
getProxyUser
-
setProxyUser
-
getProxyPassword
-
setProxyPassword
-
getProxyType
-
setProxyType
-
isUseSystemProxy
public boolean isUseSystemProxy() -
setUseSystemProxy
public void setUseSystemProxy(boolean useSystemProxy) -
setProxy
public void setProxy() -
getStatusString
-
hasActiveEnvoys
public boolean hasActiveEnvoys() -
getStatistics
-
getHTMLMessageAndAdvice
public String getHTMLMessageAndAdvice(Throwable ex, String title, String message, ConnectivityTip tip) -
getPlainMessageAndAdvice
-
generateData
- Throws:
Exception
-
loadFromHistory
-
setVisibleInMenu
public void setVisibleInMenu(boolean visibleInMenu) -
isVisibleInMenu
public boolean isVisibleInMenu() -
getCliProject
-
getActiveCliSchema
-
setActiveCliSchema
-