public class ConnectionInfo
extends java.lang.Object
implements java.lang.Cloneable
| Constructor and Description |
|---|
ConnectionInfo(java.lang.String name)
Create a connection info object.
|
ConnectionInfo(java.lang.String u,
java.util.Properties info)
Create a connection info object.
|
| Modifier and Type | Method and Description |
|---|---|
ConnectionInfo |
clone() |
DbSettings |
getDbSettings() |
byte[] |
getFilePasswordHash()
Get the file password hash if it is set.
|
java.lang.String |
getName()
Get the unique and normalized database name (excluding settings).
|
java.lang.String |
getOriginalURL()
Get the complete original database URL.
|
boolean |
getProperty(java.lang.String key,
boolean defaultValue)
Get a boolean property if it is set and return the value.
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
Get the value of the given property.
|
java.lang.String |
getURL()
Get the database URL.
|
java.lang.String |
getUserName()
Get the name of the user.
|
boolean |
isPersistent()
Check if the referenced database is persistent.
|
boolean |
isRemote()
Check if this is a remote connection.
|
boolean |
removeProperty(java.lang.String key,
boolean defaultValue)
Remove a boolean property if it is set and return the value.
|
void |
setBaseDir(java.lang.String dir)
Set the base directory of persistent databases, unless the database is in
the user home folder (~).
|
void |
setFileEncryptionKey(byte[] key) |
void |
setFilePasswordHash(byte[] hash)
Set the file password hash.
|
void |
setOriginalURL(java.lang.String url)
Set the original database URL.
|
void |
setProperty(java.lang.String key,
java.lang.String value)
Overwrite a property.
|
void |
setServerKey(java.lang.String serverKey)
Switch to server mode, and set the server name and database key.
|
void |
setUserName(java.lang.String name)
Overwrite the user name.
|
void |
setUserPasswordHash(byte[] hash)
Set the user password hash.
|
public ConnectionInfo(java.lang.String name)
name - the database name (including tags), but without the
"jdbc:h2:" prefixpublic ConnectionInfo(java.lang.String u,
java.util.Properties info)
u - the database URL (must start with jdbc:h2:)info - the connection propertiespublic ConnectionInfo clone() throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic void setBaseDir(java.lang.String dir)
dir - the new base directorypublic boolean isRemote()
public boolean isPersistent()
public boolean getProperty(java.lang.String key,
boolean defaultValue)
key - the property namedefaultValue - the default valuepublic boolean removeProperty(java.lang.String key,
boolean defaultValue)
key - the property namedefaultValue - the default valuepublic java.lang.String getName()
public byte[] getFilePasswordHash()
public java.lang.String getUserName()
public java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
key - the property keydefaultValue - the default valuepublic void setUserName(java.lang.String name)
name - the user namepublic void setUserPasswordHash(byte[] hash)
hash - the new hash valuepublic void setFilePasswordHash(byte[] hash)
hash - the new hash valuepublic void setFileEncryptionKey(byte[] key)
public void setProperty(java.lang.String key,
java.lang.String value)
key - the property namevalue - the valuepublic java.lang.String getURL()
public java.lang.String getOriginalURL()
public void setOriginalURL(java.lang.String url)
url - the database urlpublic void setServerKey(java.lang.String serverKey)
serverKey - the server name, '/', and the security keypublic DbSettings getDbSettings()