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 enum
class
static 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 TypeMethodDescriptionvoid
addSqlEvent
(com.wisecoders.dbs.dbms.connect.model.SqlEvent event) void
void
void
generateData
(GeneratorTable generatorTable) com.wisecoders.dbs.dbms.driver.model.JdbcUrlTemplate
getHost()
getHTMLMessageAndAdvice
(Throwable ex, String title, String message, ConnectivityTip tip) getName()
int
int
getPort()
int
int
int
getURL()
boolean
importSchema
(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.boolean
boolean
boolean
boolean
isMongo()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
void
void
void
void
loadFromHistory
(String alias) void
boolean
com.jcraft.jsch.Session
void
refresh()
void
void
void
setActiveCliSchema
(String catalogName) boolean
setConnectionProperties
(String prop2) boolean
setCustomUrl
(String customUrl) boolean
setDriverJarClass
(String driverJarFileName, String driverJarClassName) boolean
setDriverUrl
(com.wisecoders.dbs.dbms.driver.model.JdbcUrlTemplate driver) boolean
setEnvironment
(Connector.Environment environment) void
boolean
Set the host to connect toboolean
setInstance
(String instance) void
boolean
boolean
boolean
boolean
boolean
boolean
setPassword
(String password) Set the password for the database userboolean
setPort
(int port) Set the port to connect tovoid
setProxy()
void
setProxyHost
(String proxyHost) void
setProxyPassword
(String proxyPassword) void
setProxyPort
(int proxyPort) void
setProxyType
(Connector.ProxyType proxyType) void
setProxyUser
(String proxyUser) boolean
setReadOnly
(boolean readOnly) boolean
setRememberPassword
(boolean remember) void
setSshEnable
(boolean sshEnable) void
setSshHost
(String sshHost) void
setSshPassphrase
(String sshPassphrase) void
setSshPassword
(String sshPassword) void
setSshPort
(int sshPort) void
setSshPrivateKeyFile
(String sshPrivateKeyFile) void
setSshUseKey
(boolean sshUseKey) void
setSshUser
(String sshUser) boolean
setTimeZone
(String timeZone) com.jcraft.jsch.Session
setupSSHTunnel
(boolean reuse) boolean
setUrlTemplateName
(String templateName) boolean
void
setUseSystemProxy
(boolean useSystemProxy) void
setVisibleInMenu
(boolean visibleInMenu) boolean
com.wisecoders.dbs.dbms.connect.model.envoy.Envoy
startEnvoy
(String envoyName) void
void
transferSqlEventsTo
(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
-