- All Implemented Interfaces:
AutoCloseable,AttachmentProperties,BaseProperties,FBManagerMBean
In particular, they can be created and dropped using the jboss service lifecycle operations start and stop.
See FBManagerMBean for documentation.
- Author:
- David Jencks
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Alias forFBManagerMBean.stop()final Map<ConnectionProperty,Object> An unmodifiable view on the connection properties held by this BaseProperties implementation.voidcreateDatabase(String fileName, String user, String password) Create a database with the specified file name, username and password on the specifiedserverandport.voidcreateDatabase(String fileName, String user, String password, String roleName) Create a database with the specified file name, username, password and role on the specifiedserverandport.voiddropDatabase(String fileName, String user, String password) Drop a database with the specified file name, username and password on the specifiedserverandport.voiddropDatabase(String fileName, String user, String password, String roleName) Drop a database with the specified file name, username, password and role on the specifiedserverandport.Get the list of authentication plugins to try.final BooleangetBooleanProperty(String name) Retrieves abooleanproperty value by name.intComma-separated list of additionally enabled protocols.final IntegergetIntProperty(String name) Retrieves anintproperty value by name.getName()intintgetPort()intGet the port number of the server.final StringgetProperty(String name) Retrieves a string property value by name.Get the hostname or IP address of the Firebird server.getState()getType()getUser()booleanGet if the database will be created when callingFBManagerMBean.start().booleanisDatabaseExists(String fileName, String user, String password) Check if a database exists with the specified file name, username and password on the specifiedserverandport.booleanGet if the database will be created when callingFBManagerMBean.stop().booleanGet if the database will be dropped if exists when creating a database.voidsetAuthPlugins(String authPlugins) Sets the authentication plugins to try.final voidsetBooleanProperty(String name, Boolean value) Sets abooleanproperty by name.voidsetCreateOnStart(boolean createOnStart) Set if the database will be created when callingFBManagerMBean.start().voidsetDefaultCharacterSet(String firebirdCharsetName) Set the default database character set to use when creating a new database.voidsetDialect(int dialect) Set the database dialect to use when creating a new database.voidsetDropOnStop(boolean dropOnStop) Set if the database will be created when callingFBManagerMBean.stop().voidsetEnableProtocol(String enableProtocol) Comma-separated list of additionally enabled protocols.voidsetFileName(String fileName) Set the file name or alias of the database.voidsetForceCreate(boolean forceCreate) Set if the database will be dropped if exists when creating a database.voidsetForceWrite(Boolean forceWrite) Control force write behaviour of the created database.final voidsetIntProperty(String name, Integer value) Sets anintproperty by name.voidsetPageSize(int pageSize) Set the page size to use when creating a new database.voidsetPassword(String password) voidsetPort(int port) Set the port of the Firebird server.voidsetPortNumber(int portNumber) Set the port number of the server.final voidsetProperty(String name, String value) Sets a property by name.voidsetRoleName(String roleName) voidSet the hostname of the Firebird server.voidsetServerName(String serverName) Set the hostname or IP address of the Firebird server.voidvoidvoidsetUserName(String userName) Set the username.voidstart()Start this manager.voidstop()Stop this manager.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.firebirdsql.jaybird.props.AttachmentProperties
getCharSet, getConnectTimeout, getDbCryptConfig, getEncoding, getParallelWorkers, getProcessId, getProcessName, getSocketBufferSize, getSocketFactory, getSoTimeout, getWireCrypt, isWireCompression, setCharSet, setConnectTimeout, setDbCryptConfig, setEncoding, setParallelWorkers, setProcessId, setProcessName, setSocketBufferSize, setSocketFactory, setSoTimeout, setWireCompression, setWireCryptMethods inherited from interface org.firebirdsql.jaybird.props.BaseProperties
getBooleanProperty, getIntProperty, getProperty
-
Constructor Details
-
FBManager
public FBManager() -
FBManager
-
FBManager
-
-
Method Details
-
start
Description copied from interface:FBManagerMBeanStart this manager.If
FBManagerMBean.isCreateOnStart()istrue, will attempt to create a new database specified using theserver,port,fileNameand related properties. If the specified already exists, nothing will be created unlessFBManagerMBean.isForceCreate()istrue. WhenforceCreateistruean attempt will be made to drop the database.- Specified by:
startin interfaceFBManagerMBean- Throws:
IllegalStateException- If this manager is not startedException- For failures to start or create the database
-
stop
Description copied from interface:FBManagerMBeanStop this manager.If
FBManagerMBean.isDropOnStop()istrue, will attempt to drop the database specified using theserver,port,fileNameand related properties,If the manager is currently stopped, this method will do nothing.
- Specified by:
stopin interfaceFBManagerMBean- Throws:
Exception- For failures to drop the database.
-
close
Description copied from interface:FBManagerMBeanAlias forFBManagerMBean.stop()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceFBManagerMBean- Throws:
Exception
-
getState
- Specified by:
getStatein interfaceFBManagerMBean- Returns:
- Current state (
"Stopped"or"Started"
-
getName
- Specified by:
getNamein interfaceFBManagerMBean- Returns:
- Descriptive name of this manager
-
setServerName
Description copied from interface:AttachmentPropertiesSet the hostname or IP address of the Firebird server.When set to
null(the default), thedatabaseNameorserviceNameis used as the full identification of the database host, port and database path/alias. Protocol implementations, for examplePURE_JAVA, may default tolocalhostwhen this property isnull, butdatabaseName/serviceNamedoes not (seem to) contain a host name.- Specified by:
setServerNamein interfaceAttachmentProperties- Parameters:
serverName- Hostname or IP address of the server
-
getServerName
Description copied from interface:AttachmentPropertiesGet the hostname or IP address of the Firebird server.- Specified by:
getServerNamein interfaceAttachmentProperties- Returns:
- Hostname or IP address of the server
- See Also:
-
setServer
Description copied from interface:FBManagerMBeanSet the hostname of the Firebird server.- Specified by:
setServerin interfaceFBManagerMBean- Parameters:
host- hostname- See Also:
-
getServer
- Specified by:
getServerin interfaceFBManagerMBean- Returns:
- hostname of the Firebird server (default is
"localhost") - See Also:
-
setPortNumber
public void setPortNumber(int portNumber) Description copied from interface:AttachmentPropertiesSet the port number of the server.Defaults to
3050. This property value will be ignored ifserverNameisnull, unless the protocol implementation needs a hostname, but cannot find a hostname indatabaseName/serviceName.- Specified by:
setPortNumberin interfaceAttachmentProperties- Parameters:
portNumber- Port number of the server- See Also:
-
getPortNumber
public int getPortNumber()Description copied from interface:AttachmentPropertiesGet the port number of the server.- Specified by:
getPortNumberin interfaceAttachmentProperties- Returns:
- Port number of the server
- See Also:
-
setPort
public void setPort(int port) Description copied from interface:FBManagerMBeanSet the port of the Firebird server.- Specified by:
setPortin interfaceFBManagerMBean- Parameters:
port- port of the Firebird server- See Also:
-
getPort
public int getPort()- Specified by:
getPortin interfaceFBManagerMBean- Returns:
- port of the Firebird server (default is
3050) - See Also:
-
getFileName
- Specified by:
getFileNamein interfaceFBManagerMBean- Returns:
- File name or alias of the database
-
setFileName
Description copied from interface:FBManagerMBeanSet the file name or alias of the database.- Specified by:
setFileNamein interfaceFBManagerMBean- Parameters:
fileName- File name or alias of the database
-
getType
- Specified by:
getTypein interfaceAttachmentProperties- Returns:
- type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS implementations installed in the system.
-
setType
- Specified by:
setTypein interfaceAttachmentProperties- Parameters:
type- type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS implementations installed in the system.
-
getUser
- Specified by:
getUserin interfaceAttachmentProperties- Returns:
- Name of the user to authenticate to the server.
-
setUser
- Specified by:
setUserin interfaceAttachmentProperties- Parameters:
user- Name of the user to authenticate to the server.
-
getUserName
- Specified by:
getUserNamein interfaceFBManagerMBean- Returns:
- username
- See Also:
-
setUserName
Description copied from interface:FBManagerMBeanSet the username.- Specified by:
setUserNamein interfaceFBManagerMBean- Parameters:
userName- username- See Also:
-
getPassword
- Specified by:
getPasswordin interfaceAttachmentProperties- Returns:
- Password to authenticate to the server.
-
setPassword
- Specified by:
setPasswordin interfaceAttachmentProperties- Parameters:
password- Password to authenticate to the server.
-
getRoleName
- Specified by:
getRoleNamein interfaceAttachmentProperties- Returns:
- SQL role to use.
-
setRoleName
- Specified by:
setRoleNamein interfaceAttachmentProperties- Parameters:
roleName- SQL role to use.
-
getAuthPlugins
Description copied from interface:AttachmentPropertiesGet the list of authentication plugins to try.- Specified by:
getAuthPluginsin interfaceAttachmentProperties- Returns:
- comma-separated list of authentication plugins
-
setAuthPlugins
Description copied from interface:AttachmentPropertiesSets the authentication plugins to try.Invalid names are skipped during authentication.
- Specified by:
setAuthPluginsin interfaceAttachmentProperties- Parameters:
authPlugins- comma-separated list of authentication plugins
-
setEnableProtocol
Description copied from interface:AttachmentPropertiesComma-separated list of additionally enabled protocols.- Specified by:
setEnableProtocolin interfaceAttachmentProperties- Parameters:
enableProtocol- List of unsupported protocol versions to try in addition to the supported protocols.- See Also:
-
getEnableProtocol
Description copied from interface:AttachmentPropertiesComma-separated list of additionally enabled protocols.By default, pure Java connections of Jaybird only supports the protocol versions of supported Firebird versions. This property lists the additionally enabled unsupported protocol versions. If Jaybird does not have a listed protocol, it is silently ignored.
This property is ignored for native connections.
- Specified by:
getEnableProtocolin interfaceAttachmentProperties- Returns:
- List of unsupported protocol versions to try in addition to the supported protocols. Comma-separated
using only the version number (e.g.
"10,11"). Both the unmasked and masked version are supported (e.g.32780for protocol12), but we recommend to use the unmasked version. The value"*"will try all available protocols.
-
setDialect
public void setDialect(int dialect) Description copied from interface:FBManagerMBeanSet the database dialect to use when creating a new database.- Specified by:
setDialectin interfaceFBManagerMBean- Parameters:
dialect- Database dialect (1 or 3)- See Also:
-
getDialect
public int getDialect()- Specified by:
getDialectin interfaceFBManagerMBean- Returns:
- Database dialect (either 1 or 3), default is 3.
-
setPageSize
public void setPageSize(int pageSize) Description copied from interface:FBManagerMBeanSet the page size to use when creating a new database.The value for
pageSizemust be one ofPageSizeConstants. The default value depends on the Firebird version.Some values are not valid on all Firebird versions.
- Specified by:
setPageSizein interfaceFBManagerMBean- Parameters:
pageSize- The page size to be used in the created database, seePageSizeConstants- See Also:
-
getPageSize
public int getPageSize()- Specified by:
getPageSizein interfaceFBManagerMBean- Returns:
- The page size to be used when creating a database, or
-1if the database default is used.
-
setDefaultCharacterSet
Description copied from interface:FBManagerMBeanSet the default database character set to use when creating a new database.- Specified by:
setDefaultCharacterSetin interfaceFBManagerMBean- Parameters:
firebirdCharsetName- Character set name, use Firebird names only;nullwill use Firebird default (NONE). Specifying an invalid name will result in an exception during database creation.
-
getDefaultCharacterSet
- Specified by:
getDefaultCharacterSetin interfaceFBManagerMBean- Returns:
- The default character set name,
nullmeans not set. - See Also:
-
setForceWrite
Description copied from interface:FBManagerMBeanControl force write behaviour of the created database.Only use this method if you know what you're doing, and if you can live with data loss and database corruption. In general it is advisable to use the Firebird default (
nullfor this method).- Specified by:
setForceWritein interfaceFBManagerMBean- Parameters:
forceWrite-null- default behaviour (force write enabled after database creation and initialization),true- enable force write at database creation,false- disable force write
-
getForceWrite
- Specified by:
getForceWritein interfaceFBManagerMBean- Returns:
- The forced writes configuration
- See Also:
-
isCreateOnStart
public boolean isCreateOnStart()Description copied from interface:FBManagerMBeanGet if the database will be created when callingFBManagerMBean.start().- Specified by:
isCreateOnStartin interfaceFBManagerMBean- Returns:
truewhen the database will be created on start,falseotherwise.
-
setCreateOnStart
public void setCreateOnStart(boolean createOnStart) Description copied from interface:FBManagerMBeanSet if the database will be created when callingFBManagerMBean.start().- Specified by:
setCreateOnStartin interfaceFBManagerMBean- Parameters:
createOnStart-trueto create the database on start,falseto not create on start (default)
-
isDropOnStop
public boolean isDropOnStop()Description copied from interface:FBManagerMBeanGet if the database will be created when callingFBManagerMBean.stop().- Specified by:
isDropOnStopin interfaceFBManagerMBean- Returns:
trueto drop the database on stop,falseotherwise
-
setDropOnStop
public void setDropOnStop(boolean dropOnStop) Description copied from interface:FBManagerMBeanSet if the database will be created when callingFBManagerMBean.stop().- Specified by:
setDropOnStopin interfaceFBManagerMBean- Parameters:
dropOnStop-trueto drop the database on stop,falseto not drop on stop (default)
-
isForceCreate
public boolean isForceCreate()Description copied from interface:FBManagerMBeanGet if the database will be dropped if exists when creating a database.- Specified by:
isForceCreatein interfaceFBManagerMBean- Returns:
trueto drop existing database on create,falseto not create a database if it exists.
-
setForceCreate
public void setForceCreate(boolean forceCreate) Description copied from interface:FBManagerMBeanSet if the database will be dropped if exists when creating a database.- Specified by:
setForceCreatein interfaceFBManagerMBean- Parameters:
forceCreate-trueto drop existing database on create,falseto not create a database if it exists.
-
createDatabase
Description copied from interface:FBManagerMBeanCreate a database with the specified file name, username and password on the specifiedserverandport.On creation, the following properties will used to configure the database:
dialect,pageSize,defaultCharacterSet.If the database already exists, and
forceCreateistrue, the database will be dropped. Iffalse, no database will be created.- Specified by:
createDatabasein interfaceFBManagerMBean- Parameters:
fileName- Database file name or aliasuser- User namepassword- Password- Throws:
IllegalStateException- If this manager is not startedException- If database creation fails.
-
createDatabase
public void createDatabase(String fileName, String user, String password, String roleName) throws Exception Description copied from interface:FBManagerMBeanCreate a database with the specified file name, username, password and role on the specifiedserverandport.On creation, the following properties will used to configure the database:
dialect,pageSize,defaultCharacterSet.If the database already exists, and
forceCreateistrue, the database will be dropped. Iffalse, no database will be created.- Specified by:
createDatabasein interfaceFBManagerMBean- Parameters:
fileName- Database file name or aliasuser- User namepassword- PasswordroleName- Role name (ornullfor no role)- Throws:
IllegalStateException- If this manager is not startedException- If database creation fails.
-
dropDatabase
Description copied from interface:FBManagerMBeanDrop a database with the specified file name, username and password on the specifiedserverandport.- Specified by:
dropDatabasein interfaceFBManagerMBean- Parameters:
fileName- Database file name or aliasuser- User namepassword- Password- Throws:
Exception- If this manager is not started or database drop fails.
-
dropDatabase
public void dropDatabase(String fileName, String user, String password, String roleName) throws Exception Description copied from interface:FBManagerMBeanDrop a database with the specified file name, username, password and role on the specifiedserverandport.- Specified by:
dropDatabasein interfaceFBManagerMBean- Parameters:
fileName- Database file name or aliasuser- User namepassword- PasswordroleName- Role name (ornullfor no role)- Throws:
Exception- If this manager is not started or database drop fails.
-
isDatabaseExists
Description copied from interface:FBManagerMBeanCheck if a database exists with the specified file name, username and password on the specifiedserverandport.Existence is checked by connecting to the database, so any connection error, including invalid credentials, will report the database as not existing.
- Specified by:
isDatabaseExistsin interfaceFBManagerMBean- Parameters:
fileName- Database file name or aliasuser- User namepassword- Password- Returns:
trueif the database exists and can be connected,falseif the database does not exist or any other error occurred.- Throws:
Exception- Currently no other exception is thrown, this may change in the future
-
getProperty
Description copied from interface:BasePropertiesRetrieves a string property value by name.For properties with an explicit default, this method should return the string presentation of that default, not
null. Forintorbooleanthe string equivalent is returned.- Specified by:
getPropertyin interfaceBaseProperties- Parameters:
name- Property name (notnullor empty)- Returns:
- Value of the property, or
nullwhen not set or not a known property
-
setProperty
Description copied from interface:BasePropertiesSets a property by name.This method can be used to set all defined properties, but also properties not known by Jaybird. When setting
intorbooleanproperties, the appropriate conversions are applied. Usingnullwill reset to the default value. Forbooleanproperties, an empty string is taken to meantrue.- Specified by:
setPropertyin interfaceBaseProperties- Parameters:
name- Property name (notnullor empty)value- Property value (usenullto apply default)
-
getIntProperty
Description copied from interface:BasePropertiesRetrieves anintproperty value by name.For properties with an explicit default, this method should return the integer presentation of that default. For implementation simplicity, it is allowed to convert any string property to
intinstead of checking if something is actually anintproperty- Specified by:
getIntPropertyin interfaceBaseProperties- Parameters:
name- Property name (notnullor empty)- Returns:
- Integer with value of the property, or
nullwhen not set
-
setIntProperty
Description copied from interface:BasePropertiesSets anintproperty by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
- Specified by:
setIntPropertyin interfaceBaseProperties- Parameters:
name- Property name (notnullor empty)value- Property value (usenullto apply default)
-
getBooleanProperty
Description copied from interface:BasePropertiesRetrieves abooleanproperty value by name.For properties with an explicit default, this method should return the boolean presentation of that default. For implementation simplicity, it is allowed to convert any string property to
booleaninstead of checking if something is actually abooleanproperty- Specified by:
getBooleanPropertyin interfaceBaseProperties- Parameters:
name- Property name (notnullor empty)- Returns:
- Integer with value of the property, or
nullwhen not set
-
setBooleanProperty
Description copied from interface:BasePropertiesSets abooleanproperty by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
- Specified by:
setBooleanPropertyin interfaceBaseProperties- Parameters:
name- Property name (notnullor empty)value- Property value (usenullto apply default)
-
connectionPropertyValues
Description copied from interface:BasePropertiesAn unmodifiable view on the connection properties held by this BaseProperties implementation.Be aware, implementations can have additional properties that are not mapped from
ConnectionProperty. Such properties will need to be retrieved in an implementation-specific manner.- Specified by:
connectionPropertyValuesin interfaceBaseProperties- Returns:
- An unmodifiable view on the property values held in this properties instance
-