- All Implemented Interfaces:
AutoCloseable
,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 TypeMethodDescriptionvoid
close()
Alias forFBManagerMBean.stop()
void
createDatabase
(String fileName, String user, String password) Create a database with the specified file name, username and password on the specifiedserver
andport
.void
createDatabase
(String fileName, String user, String password, String roleName) Create a database with the specified file name, username, password and role on the specifiedserver
andport
.void
dropDatabase
(String fileName, String user, String password) Drop a database with the specified file name, username and password on the specifiedserver
andport
.void
dropDatabase
(String fileName, String user, String password, String roleName) Drop a database with the specified file name, username, password and role on the specifiedserver
andport
.int
getName()
int
int
getPort()
getState()
getType()
boolean
Get if the database will be created when callingFBManagerMBean.start()
.boolean
isDatabaseExists
(String fileName, String user, String password) Check if a database exists with the specified file name, username and password on the specifiedserver
andport
.boolean
Get if the database will be created when callingFBManagerMBean.stop()
.boolean
Get if the database will be dropped if exists when creating a database.void
setCreateOnStart
(boolean createOnStart) Set if the database will be created when callingFBManagerMBean.start()
.void
setDefaultCharacterSet
(String firebirdCharsetName) Set the default database character set to use when creating a new database.void
setDialect
(int dialect) Set the database dialect to use when creating a new database.void
setDropOnStop
(boolean dropOnStop) Set if the database will be created when callingFBManagerMBean.stop()
.void
setEnableProtocol
(String enableProtocol) Sets the enable protocol value.void
setFileName
(String fileName) Set the file name or alias of the database.void
setForceCreate
(boolean forceCreate) Set if the database will be dropped if exists when creating a database.void
setForceWrite
(Boolean forceWrite) Control force write behaviour of the created database.void
setPageSize
(int pageSize) Set the page size to use when creating a new database.void
setPassword
(String password) Set the password.void
setPort
(int port) Set the port of the Firebird server.void
setRoleName
(String roleName) void
Set the host name of the Firebird server.void
Set the GDS plugin type to use.void
setUserName
(String userName) Set the username.void
start()
Start this manager.void
stop()
Stop this manager.
-
Constructor Details
-
FBManager
public FBManager() -
FBManager
-
FBManager
-
-
Method Details
-
start
Description copied from interface:FBManagerMBean
Start this manager.If
FBManagerMBean.isCreateOnStart()
istrue
, will attempt to create a new database specified using theserver
,port
,fileName
and related properties. If the specified already exists, nothing will be created unlessFBManagerMBean.isForceCreate()
istrue
. WhenforceCreate
istrue
an attempt will be made to drop the database.- Specified by:
start
in interfaceFBManagerMBean
- Throws:
IllegalStateException
- If this manager is not startedException
- For failures to start or create the database
-
stop
Description copied from interface:FBManagerMBean
Stop this manager.If
FBManagerMBean.isDropOnStop()
istrue
, will attempt to drop the database specified using theserver
,port
,fileName
and related properties,If the manager is currently stopped, this method will do nothing.
- Specified by:
stop
in interfaceFBManagerMBean
- Throws:
Exception
- For failures to drop the database.
-
close
Description copied from interface:FBManagerMBean
Alias forFBManagerMBean.stop()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceFBManagerMBean
- Throws:
Exception
-
getState
- Specified by:
getState
in interfaceFBManagerMBean
- Returns:
- Current state (
"Stopped"
or"Started"
-
getName
- Specified by:
getName
in interfaceFBManagerMBean
- Returns:
- Descriptive name of this manager
-
setServer
Description copied from interface:FBManagerMBean
Set the host name of the Firebird server.- Specified by:
setServer
in interfaceFBManagerMBean
- Parameters:
host
- Hostname
-
getServer
- Specified by:
getServer
in interfaceFBManagerMBean
- Returns:
- The host name of the Firebird server (default is
"localhost"
)
-
setPort
public void setPort(int port) Description copied from interface:FBManagerMBean
Set the port of the Firebird server.- Specified by:
setPort
in interfaceFBManagerMBean
- Parameters:
port
- Port of the Firebird server
-
getPort
public int getPort()- Specified by:
getPort
in interfaceFBManagerMBean
- Returns:
- The port of the Firebird server (default is
3050
)
-
getFileName
- Specified by:
getFileName
in interfaceFBManagerMBean
- Returns:
- File name or alias of the database
-
setFileName
Description copied from interface:FBManagerMBean
Set the file name or alias of the database.- Specified by:
setFileName
in interfaceFBManagerMBean
- Parameters:
fileName
- File name or alias of the database
-
getType
- Specified by:
getType
in interfaceFBManagerMBean
- Returns:
- GDS plugin type name (default is
GDSFactory.getDefaultGDSType()
)
-
setType
Description copied from interface:FBManagerMBean
Set the GDS plugin type to use.- Specified by:
setType
in interfaceFBManagerMBean
- Parameters:
type
- GDS plugin type name (PURE_JAVA
,NATIVE
,EMBEDDED
)
-
getUserName
- Specified by:
getUserName
in interfaceFBManagerMBean
- Returns:
- User name
-
setUserName
Description copied from interface:FBManagerMBean
Set the username.- Specified by:
setUserName
in interfaceFBManagerMBean
- Parameters:
userName
- Username
-
getPassword
- Specified by:
getPassword
in interfaceFBManagerMBean
- Returns:
- password
-
setPassword
Description copied from interface:FBManagerMBean
Set the password.- Specified by:
setPassword
in interfaceFBManagerMBean
- Parameters:
password
- Password
-
getRoleName
- Specified by:
getRoleName
in interfaceFBManagerMBean
- Returns:
- SQL role to use.
-
setRoleName
- Specified by:
setRoleName
in interfaceFBManagerMBean
- Parameters:
roleName
- SQL role to use.
-
setEnableProtocol
Description copied from interface:FBManagerMBean
Sets the enable protocol value.- Specified by:
setEnableProtocol
in interfaceFBManagerMBean
- Parameters:
enableProtocol
- enable protocol value
-
getEnableProtocol
- Specified by:
getEnableProtocol
in interfaceFBManagerMBean
- Returns:
- enable protocol value (see also
AttachmentProperties.getEnableProtocol()
.
-
setDialect
public void setDialect(int dialect) Description copied from interface:FBManagerMBean
Set the database dialect to use when creating a new database.- Specified by:
setDialect
in interfaceFBManagerMBean
- Parameters:
dialect
- Database dialect (1 or 3)- See Also:
-
getDialect
public int getDialect()- Specified by:
getDialect
in interfaceFBManagerMBean
- Returns:
- Database dialect (either 1 or 3), default is 3.
-
setPageSize
public void setPageSize(int pageSize) Description copied from interface:FBManagerMBean
Set the page size to use when creating a new database.The value for
pageSize
must be one ofPageSizeConstants
. The default value depends on the Firebird version.Some values are not valid on all Firebird versions.
- Specified by:
setPageSize
in interfaceFBManagerMBean
- Parameters:
pageSize
- The page size to be used in the created database, seePageSizeConstants
- See Also:
-
getPageSize
public int getPageSize()- Specified by:
getPageSize
in interfaceFBManagerMBean
- Returns:
- The page size to be used when creating a database, or
-1
if the database default is used.
-
setDefaultCharacterSet
Description copied from interface:FBManagerMBean
Set the default database character set to use when creating a new database.- Specified by:
setDefaultCharacterSet
in interfaceFBManagerMBean
- Parameters:
firebirdCharsetName
- Character set name, use Firebird names only;null
will use Firebird default (NONE
). Specifying an invalid name will result in an exception during database creation.
-
getDefaultCharacterSet
- Specified by:
getDefaultCharacterSet
in interfaceFBManagerMBean
- Returns:
- The default character set name,
null
means not set. - See Also:
-
setForceWrite
Description copied from interface:FBManagerMBean
Control 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 (
null
for this method).- Specified by:
setForceWrite
in 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:
getForceWrite
in interfaceFBManagerMBean
- Returns:
- The forced writes configuration
- See Also:
-
isCreateOnStart
public boolean isCreateOnStart()Description copied from interface:FBManagerMBean
Get if the database will be created when callingFBManagerMBean.start()
.- Specified by:
isCreateOnStart
in interfaceFBManagerMBean
- Returns:
true
when the database will be created on start,false
otherwise.
-
setCreateOnStart
public void setCreateOnStart(boolean createOnStart) Description copied from interface:FBManagerMBean
Set if the database will be created when callingFBManagerMBean.start()
.- Specified by:
setCreateOnStart
in interfaceFBManagerMBean
- Parameters:
createOnStart
-true
to create the database on start,false
to not create on start (default)
-
isDropOnStop
public boolean isDropOnStop()Description copied from interface:FBManagerMBean
Get if the database will be created when callingFBManagerMBean.stop()
.- Specified by:
isDropOnStop
in interfaceFBManagerMBean
- Returns:
true
to drop the database on stop,false
otherwise
-
setDropOnStop
public void setDropOnStop(boolean dropOnStop) Description copied from interface:FBManagerMBean
Set if the database will be created when callingFBManagerMBean.stop()
.- Specified by:
setDropOnStop
in interfaceFBManagerMBean
- Parameters:
dropOnStop
-true
to drop the database on stop,false
to not drop on stop (default)
-
isForceCreate
public boolean isForceCreate()Description copied from interface:FBManagerMBean
Get if the database will be dropped if exists when creating a database.- Specified by:
isForceCreate
in interfaceFBManagerMBean
- Returns:
true
to drop existing database on create,false
to not create a database if it exists.
-
setForceCreate
public void setForceCreate(boolean forceCreate) Description copied from interface:FBManagerMBean
Set if the database will be dropped if exists when creating a database.- Specified by:
setForceCreate
in interfaceFBManagerMBean
- Parameters:
forceCreate
-true
to drop existing database on create,false
to not create a database if it exists.
-
createDatabase
Description copied from interface:FBManagerMBean
Create a database with the specified file name, username and password on the specifiedserver
andport
.On creation, the following properties will used to configure the database:
dialect
,pageSize
,defaultCharacterSet
.If the database already exists, and
forceCreate
istrue
, the database will be dropped. Iffalse
, no database will be created.- Specified by:
createDatabase
in 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:FBManagerMBean
Create a database with the specified file name, username, password and role on the specifiedserver
andport
.On creation, the following properties will used to configure the database:
dialect
,pageSize
,defaultCharacterSet
.If the database already exists, and
forceCreate
istrue
, the database will be dropped. Iffalse
, no database will be created.- Specified by:
createDatabase
in interfaceFBManagerMBean
- Parameters:
fileName
- Database file name or aliasuser
- User namepassword
- PasswordroleName
- Role name (ornull
for no role)- Throws:
IllegalStateException
- If this manager is not startedException
- If database creation fails.
-
dropDatabase
Description copied from interface:FBManagerMBean
Drop a database with the specified file name, username and password on the specifiedserver
andport
.- Specified by:
dropDatabase
in 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:FBManagerMBean
Drop a database with the specified file name, username, password and role on the specifiedserver
andport
.- Specified by:
dropDatabase
in interfaceFBManagerMBean
- Parameters:
fileName
- Database file name or aliasuser
- User namepassword
- PasswordroleName
- Role name (ornull
for no role)- Throws:
Exception
- If this manager is not started or database drop fails.
-
isDatabaseExists
Description copied from interface:FBManagerMBean
Check if a database exists with the specified file name, username and password on the specifiedserver
andport
.Existence is checked by connecting to the database, so any connection error, including invalid credentials, will report the database as not existing.
- Specified by:
isDatabaseExists
in interfaceFBManagerMBean
- Parameters:
fileName
- Database file name or aliasuser
- User namepassword
- Password- Returns:
true
if the database exists and can be connected,false
if the database does not exist or any other error occurred.- Throws:
Exception
- Currently no other exception is thrown, this may change in the future
-