- All Implemented Interfaces:
AttachmentProperties
,BaseProperties
,ServiceConnectionProperties
,ServiceManager
- Direct Known Subclasses:
FBBackupManagerBase
,FBMaintenanceManager
,FBNBackupManager
,FBStatisticsManager
,FBTraceManager
,FBUserManager
- Author:
- Roman Rokytskyy, Mark Rotteveel
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance ofFBServiceManager
based on the default GDSType.FBServiceManager
(String gdsType) Create a new instance ofFBServiceManager
based on a given GDSType.FBServiceManager
(GDSType gdsType) Create a new instance ofFBServiceManager
based on a given GDSType. -
Method Summary
Modifier and TypeMethodDescriptionprotected FbDatabase
An unmodifiable view on the connection properties held by this BaseProperties implementation.protected ServiceRequestBuffer
createRequestBuffer
(FbService service, int operation, int options) protected final void
executeServicesOperation
(FbService service, ServiceRequestBuffer srb) Execute a Services API operation in the database.Get the list of authentication plugins to try.getBooleanProperty
(String name) Retrieves aboolean
property value by name.Java character set configured for the connection.Returns the database path for the connection to the service manager.Get the database encryption plugin configuration.Gets the expected db (isc_spb_expected_db
; defaults tonull
).getHost()
Deprecated, for removal: This API element is subject to removal in a future version.getIntProperty
(String name) Retrieves anint
property value by name.Returns the logger for the connection to the service manager.int
getPort()
Deprecated, for removal: This API element is subject to removal in a future version.int
Get the port number of the server.getProperty
(String name) Retrieves a string property value by name.Get the hostname or IP address of the Firebird server.Obtains the server version through a service call.Gets the service name (defaults to"service_mgr"
).getUser()
Get the wire encryption level.Get the wire encryption level.boolean
Get if wire compression should be enabled.void
queueService
(FbService service) void
setAuthPlugins
(String authPlugins) Sets the authentication plugins to try.void
setBooleanProperty
(String name, Boolean value) Sets aboolean
property by name.void
setCharSet
(String charSet) Set the Java character set for the connection.void
setDatabase
(String database) Sets the database path for the connection to the service manager.void
setDbCryptConfig
(String dbCryptConfig) Sets the database encryption plugin configuration.void
setExpectedDb
(String expectedDb) Filename or alias of the database expected to be accessed by the service operation (isc_spb_expected_db
).void
Deprecated, for removal: This API element is subject to removal in a future version.void
setIntProperty
(String name, Integer value) Sets anint
property by name.void
setLogger
(OutputStream logger) Sets the logger for the connection to the service manager.void
setPassword
(String password) void
setPort
(int port) Deprecated, for removal: This API element is subject to removal in a future version.void
setPortNumber
(int portNumber) Set the port number of the server.void
setProperty
(String name, String value) Sets a property by name.void
setServerName
(String serverName) Set the hostname or IP address of the Firebird server.void
setServiceName
(String serviceName) Sets the service namefinal void
void
void
setWireCompression
(boolean wireCompression) Sets if the connection should try to enable wire compression.void
setWireCryptAsEnum
(WireCrypt wireCrypt) Set the wire encryption level.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentProperties
getConnectTimeout, getEnableProtocol, getEncoding, getParallelWorkers, getProcessId, getProcessName, getRoleName, getSocketBufferSize, getSocketFactory, getSoTimeout, getType, setConnectTimeout, setEnableProtocol, setEncoding, setParallelWorkers, setProcessId, setProcessName, setRoleName, setSocketBufferSize, setSocketFactory, setSoTimeout, setWireCrypt
Methods inherited from interface org.firebirdsql.jaybird.props.BaseProperties
getBooleanProperty, getIntProperty, getProperty
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZE- See Also:
-
-
Constructor Details
-
FBServiceManager
public FBServiceManager()Create a new instance ofFBServiceManager
based on the default GDSType. -
FBServiceManager
Create a new instance ofFBServiceManager
based on a given GDSType.- Parameters:
gdsType
- type must be PURE_JAVA, EMBEDDED, or NATIVE
-
FBServiceManager
Create a new instance ofFBServiceManager
based on a given GDSType.- Parameters:
gdsType
- The GDS implementation type to use
-
-
Method Details
-
setType
- Specified by:
setType
in interfaceAttachmentProperties
- Parameters:
type
- type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS implementations installed in the system.
-
setCharSet
Description copied from interface:AttachmentProperties
Set the Java character set for the connection.It is possible to set both the
charSet
andencoding
to achieve a character set conversion effect, but in general only one of both properties should be set.- Specified by:
setCharSet
in interfaceAttachmentProperties
- Parameters:
charSet
- Character set for the connection. Similar toencoding
property, but accepts Java names instead of Firebird ones.- See Also:
-
getCharSet
Description copied from interface:AttachmentProperties
Java character set configured for the connection.After connect, the actual Java character set applied can be obtained from
FbAttachment.getEncoding()
(propertycharsetName
), orFbAttachment.getEncodingFactory()
(propertiesdefaultEncoding.charsetName
or {code defaultEncodingDefinition.javaCharset}).- Specified by:
getCharSet
in interfaceAttachmentProperties
- Returns:
- Java character set for the connection (
null
when not explicitly configured).
-
setUser
- Specified by:
setUser
in interfaceAttachmentProperties
- Parameters:
user
- Name of the user to authenticate to the server.
-
getUser
- Specified by:
getUser
in interfaceAttachmentProperties
- Returns:
- Name of the user to authenticate to the server.
-
setPassword
- Specified by:
setPassword
in interfaceAttachmentProperties
- Parameters:
password
- Password to authenticate to the server.
-
getPassword
- Specified by:
getPassword
in interfaceAttachmentProperties
- Returns:
- Password to authenticate to the server.
-
getServerName
Description copied from interface:AttachmentProperties
Get the hostname or IP address of the Firebird server.- Specified by:
getServerName
in interfaceAttachmentProperties
- Returns:
- Hostname or IP address of the server
- See Also:
-
setServerName
Description copied from interface:AttachmentProperties
Set the hostname or IP address of the Firebird server.When set to
null
(the default), thedatabaseName
orserviceName
is used as the full identification of the database host, port and database path/alias. Protocol implementations, for examplePURE_JAVA
, may default tolocalhost
when this property isnull
, butdatabaseName
/serviceName
does not (seem to) contain a host name.- Specified by:
setServerName
in interfaceAttachmentProperties
- Parameters:
serverName
- Hostname or IP address of the server
-
getPortNumber
public int getPortNumber()Description copied from interface:AttachmentProperties
Get the port number of the server.- Specified by:
getPortNumber
in interfaceAttachmentProperties
- Returns:
- Port number of the server
- See Also:
-
setPortNumber
public void setPortNumber(int portNumber) Description copied from interface:AttachmentProperties
Set the port number of the server.Defaults to
3050
. This property value will be ignored ifserverName
isnull
, unless the protocol implementation needs a hostname, but cannot find a hostname indatabaseName
/serviceName
.- Specified by:
setPortNumber
in interfaceAttachmentProperties
- Parameters:
portNumber
- Port number of the server- See Also:
-
getServiceName
Description copied from interface:ServiceConnectionProperties
Gets the service name (defaults to"service_mgr"
).- Specified by:
getServiceName
in interfaceServiceConnectionProperties
- Returns:
- database name
- See Also:
-
setServiceName
Description copied from interface:ServiceConnectionProperties
Sets the service nameWhen
serverName
isnull
, then the value is taken as the URL of the service, and exact interpretation depends on the protocol implementation (type
). Examples:- //localhost/ — PURE_JAVA, NATIVE (for NATIVE, this format is parsed and transformed to the next example; will fail on Firebird 2.5 and earlier)
- localhost — NATIVE, PURE_JAVA,
- //localhost:3051/ — PURE_JAVA, NATIVE (for NATIVE, this format is parsed and transformed to the next example; will fail on Firebird 2.5 and earlier)
- //localhost/service_mgr — PURE_JAVA, NATIVE (for NATIVE, this format is parsed and transformed to the next example)
- localhost:service_mgr — NATIVE, PURE_JAVA
- //localhost:3051/service_mgr — PURE_JAVA, NATIVE (for NATIVE, this format is parsed and transformed to the next example)
- localhost/3051:service_mgr — NATIVE, PURE_JAVA
- service_mgr — NATIVE, EMBEDDED, PURE_JAVA (PURE_JAVA will use localhost
as
serverName
, depending on the Firebird version and platform, NATIVE may use Firebird Embedded) - xnet://service_mgr — NATIVE (EMBEDDED will behave as NATIVE, protocols like PURE_JAVA may
attempt to connect to a server called
xnet
) - other Firebird
fbclient
connection URLs — NATIVE, (EMBEDDED will behave as NATIVE, protocols like PURE_JAVA may interpret the protocol name as a host name - Custom
type
implementations may support other URL formats
Some protocols, for example PURE_JAVA, when
serverName
is not set, butserviceName
doesn't seem to contain a host name, may default to attempting to connect to localhost withserviceName
as the service.When
serverName
is set, the value is taken as the database path or alias. Examples:- service_mgr
- empty string
null
- Specified by:
setServiceName
in interfaceServiceConnectionProperties
- Parameters:
serviceName
- service name
-
setExpectedDb
Filename or alias of the database expected to be accessed by the service operation (isc_spb_expected_db
).For Firebird 3.0 and higher when using a non-default security database, so Firebird knows which database to use to authenticate. When using the default security database, this property does not need to be set.
Some service implementations (e.g.
BackupManager
) may explicitly set this as part of their operation when its current value isnull
.NOTE: The
setDatabase(String)
property will also set this property, so in general this property doesn't need to be set explicitly.- Specified by:
setExpectedDb
in interfaceServiceConnectionProperties
- Parameters:
expectedDb
- Expected database
-
getExpectedDb
Description copied from interface:ServiceConnectionProperties
Gets the expected db (isc_spb_expected_db
; defaults tonull
).- Specified by:
getExpectedDb
in interfaceServiceConnectionProperties
- Returns:
- expected database
- See Also:
-
setDatabase
Description copied from interface:ServiceManager
Sets the database path for the connection to the service manager.Will also set the
expectedDb
property. If a different value must be used, it must be set after calling this method.- Specified by:
setDatabase
in interfaceServiceManager
- Parameters:
database
- path for the connection to the service manager.
-
getDatabase
Description copied from interface:ServiceManager
Returns the database path for the connection to the service manager.- Specified by:
getDatabase
in interfaceServiceManager
- Returns:
- the database path for the connection to the service manager.
-
getHost
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ServiceManager
Returns the host for the connection to the service manager.- Specified by:
getHost
in interfaceServiceManager
- Returns:
- the host for the connection to the service manager.
-
setHost
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ServiceManager
Sets the host for the connection to the service manager.See
AttachmentProperties.setServerName(String)
for details.- Specified by:
setHost
in interfaceServiceManager
- Parameters:
host
- for the connection to the service manager.
-
getPort
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ServiceManager
Returns the port for the connection to the service manager.- Specified by:
getPort
in interfaceServiceManager
- Returns:
- the port for the connection to the service manager.
-
setPort
Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:ServiceManager
Sets the port for the connection to the service manager.- Specified by:
setPort
in interfaceServiceManager
- Parameters:
port
- for the connection to the service manager.
-
getWireCrypt
Description copied from interface:AttachmentProperties
Get the wire encryption level.- Specified by:
getWireCrypt
in interfaceAttachmentProperties
- Returns:
- Wire encryption level
-
getWireCryptAsEnum
Description copied from interface:ServiceManager
Get the wire encryption level.- Specified by:
getWireCryptAsEnum
in interfaceServiceManager
- Returns:
- Wire encryption level
-
setWireCryptAsEnum
Description copied from interface:ServiceManager
Set the wire encryption level.- Specified by:
setWireCryptAsEnum
in interfaceServiceManager
- Parameters:
wireCrypt
- Wire encryption level (null
not allowed)
-
getDbCryptConfig
Description copied from interface:AttachmentProperties
Get the database encryption plugin configuration.- Specified by:
getDbCryptConfig
in interfaceAttachmentProperties
- Returns:
- Database encryption plugin configuration, meaning plugin specific
-
setDbCryptConfig
Description copied from interface:AttachmentProperties
Sets the database encryption plugin configuration.- Specified by:
setDbCryptConfig
in interfaceAttachmentProperties
- Parameters:
dbCryptConfig
- Database encryption plugin configuration, meaning plugin specific
-
getAuthPlugins
Description copied from interface:AttachmentProperties
Get the list of authentication plugins to try.- Specified by:
getAuthPlugins
in interfaceAttachmentProperties
- Returns:
- comma-separated list of authentication plugins
-
setAuthPlugins
Description copied from interface:AttachmentProperties
Sets the authentication plugins to try.Invalid names are skipped during authentication.
- Specified by:
setAuthPlugins
in interfaceAttachmentProperties
- Parameters:
authPlugins
- comma-separated list of authentication plugins
-
isWireCompression
public boolean isWireCompression()Description copied from interface:AttachmentProperties
Get if wire compression should be enabled.Wire compression requires Firebird 3 or higher, and the server must have the zlib library. If compression cannot be negotiated, the connection will be made without wire compression.
This property will be ignored for native connections. For native connections, the configuration in
firebird.conf
read by the client library will be used.- Specified by:
isWireCompression
in interfaceAttachmentProperties
- Returns:
true
wire compression enabled
-
setWireCompression
public void setWireCompression(boolean wireCompression) Description copied from interface:AttachmentProperties
Sets if the connection should try to enable wire compression.- Specified by:
setWireCompression
in interfaceAttachmentProperties
- Parameters:
wireCompression
-true
enable wire compression,false
disable wire compression (the default)- See Also:
-
getProperty
Description copied from interface:BaseProperties
Retrieves a string property value by name.For properties with an explicit default, this method should return the string presentation of that default, not
null
. Forint
orboolean
the string equivalent is returned.- Specified by:
getProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Value of the property, or
null
when not set or not a known property
-
setProperty
Description copied from interface:BaseProperties
Sets a property by name.This method can be used to set all defined properties, but also properties not known by Jaybird. When setting
int
orboolean
properties, the appropriate conversions are applied. Usingnull
will reset to the default value. Forboolean
properties, an empty string is taken to meantrue
.- Specified by:
setProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
getIntProperty
Description copied from interface:BaseProperties
Retrieves anint
property 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
int
instead of checking if something is actually anint
property- Specified by:
getIntProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Integer with value of the property, or
null
when not set
-
setIntProperty
Description copied from interface:BaseProperties
Sets anint
property by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
- Specified by:
setIntProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
getBooleanProperty
Description copied from interface:BaseProperties
Retrieves aboolean
property 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
boolean
instead of checking if something is actually aboolean
property- Specified by:
getBooleanProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)- Returns:
- Integer with value of the property, or
null
when not set
-
setBooleanProperty
Description copied from interface:BaseProperties
Sets aboolean
property by name.For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
- Specified by:
setBooleanProperty
in interfaceBaseProperties
- Parameters:
name
- Property name (notnull
or empty)value
- Property value (usenull
to apply default)
-
connectionPropertyValues
Description copied from interface:BaseProperties
An 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:
connectionPropertyValues
in interfaceBaseProperties
- Returns:
- An unmodifiable view on the property values held in this properties instance
-
getLogger
Description copied from interface:ServiceManager
Returns the logger for the connection to the service manager.- Specified by:
getLogger
in interfaceServiceManager
- Returns:
- Returns the out.
-
setLogger
Description copied from interface:ServiceManager
Sets the logger for the connection to the service manager.- Specified by:
setLogger
in interfaceServiceManager
- Parameters:
logger
- The out to set.
-
attachServiceManager
- Throws:
SQLException
-
attachDatabase
- Throws:
SQLException
-
queueService
- Throws:
SQLException
IOException
-
executeServicesOperation
protected final void executeServicesOperation(FbService service, ServiceRequestBuffer srb) throws SQLException Execute a Services API operation in the database. All output from the operation is sent to thisServiceManager
's logger.- Parameters:
service
- service instance to execute onsrb
- The buffer containing the task request- Throws:
SQLException
- if a database access error occurs or incorrect parameters are supplied
-
createRequestBuffer
-
getServerVersion
Description copied from interface:ServiceManager
Obtains the server version through a service call.- Specified by:
getServerVersion
in interfaceServiceManager
- Returns:
- Parsed server version, or
GDSServerVersion.INVALID_VERSION
if parsing failed. - Throws:
SQLException
- For errors connecting to the service manager.
-