- 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 ofFBServiceManagerbased on the default GDSType.FBServiceManager(String gdsType) Create a new instance ofFBServiceManagerbased on a given GDSType.FBServiceManager(GDSType gdsType) Create a new instance ofFBServiceManagerbased on a given GDSType. -
Method Summary
Modifier and TypeMethodDescriptionprotected FbDatabaseAn unmodifiable view on the connection properties held by this BaseProperties implementation.protected ServiceRequestBuffercreateRequestBuffer(FbService service, int operation, int options) protected final voidexecuteServicesOperation(FbService service, ServiceRequestBuffer srb) Execute a Services API operation in the database.Get the list of authentication plugins to try.getBooleanProperty(String name) Retrieves abooleanproperty 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 anintproperty value by name.Returns the logger for the connection to the service manager.intgetPort()Deprecated, for removal: This API element is subject to removal in a future version.intGet 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.booleanGet if wire compression should be enabled.voidqueueService(FbService service) voidsetAuthPlugins(String authPlugins) Sets the authentication plugins to try.voidsetBooleanProperty(String name, Boolean value) Sets abooleanproperty by name.voidsetCharSet(String charSet) Set the Java character set for the connection.voidsetDatabase(String database) Sets the database path for the connection to the service manager.voidsetDbCryptConfig(String dbCryptConfig) Sets the database encryption plugin configuration.voidsetExpectedDb(String expectedDb) Filename or alias of the database expected to be accessed by the service operation (isc_spb_expected_db).voidDeprecated, for removal: This API element is subject to removal in a future version.voidsetIntProperty(String name, Integer value) Sets anintproperty by name.voidsetLogger(OutputStream logger) Sets the logger for the connection to the service manager.voidsetPassword(String password) voidsetPort(int port) Deprecated, for removal: This API element is subject to removal in a future version.voidsetPortNumber(int portNumber) Set the port number of the server.voidsetProperty(String name, String value) Sets a property by name.voidsetServerName(String serverName) Set the hostname or IP address of the Firebird server.voidsetServiceName(String serviceName) Sets the service namefinal voidvoidvoidsetWireCompression(boolean wireCompression) Sets if the connection should try to enable wire compression.voidsetWireCryptAsEnum(WireCrypt wireCrypt) Set the wire encryption level.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
getConnectTimeout, getEnableProtocol, getEncoding, getParallelWorkers, getProcessId, getProcessName, getRoleName, getSocketBufferSize, getSocketFactory, getSoTimeout, getType, setConnectTimeout, setEnableProtocol, setEncoding, setParallelWorkers, setProcessId, setProcessName, setRoleName, setSocketBufferSize, setSocketFactory, setSoTimeout, setWireCryptMethods 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 ofFBServiceManagerbased on the default GDSType. -
FBServiceManager
Create a new instance ofFBServiceManagerbased on a given GDSType.- Parameters:
gdsType- type must be PURE_JAVA, EMBEDDED, or NATIVE
-
FBServiceManager
Create a new instance ofFBServiceManagerbased on a given GDSType.- Parameters:
gdsType- The GDS implementation type to use
-
-
Method Details
-
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.
-
setCharSet
Description copied from interface:AttachmentPropertiesSet the Java character set for the connection.It is possible to set both the
charSetandencodingto achieve a character set conversion effect, but in general only one of both properties should be set.- Specified by:
setCharSetin interfaceAttachmentProperties- Parameters:
charSet- Character set for the connection. Similar toencodingproperty, but accepts Java names instead of Firebird ones.- See Also:
-
getCharSet
Description copied from interface:AttachmentPropertiesJava character set configured for the connection.After connect, the actual Java character set applied can be obtained from
FbAttachment.getEncoding()(propertycharsetName), orFbAttachment.getEncodingFactory()(propertiesdefaultEncoding.charsetNameor {code defaultEncodingDefinition.javaCharset}).- Specified by:
getCharSetin interfaceAttachmentProperties- Returns:
- Java character set for the connection (
nullwhen not explicitly configured).
-
setUser
- Specified by:
setUserin interfaceAttachmentProperties- Parameters:
user- Name of the user to authenticate to the server.
-
getUser
- Specified by:
getUserin interfaceAttachmentProperties- Returns:
- Name of the user to authenticate to the server.
-
setPassword
- Specified by:
setPasswordin interfaceAttachmentProperties- Parameters:
password- Password to authenticate to the server.
-
getPassword
- Specified by:
getPasswordin interfaceAttachmentProperties- Returns:
- Password to authenticate to 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:
-
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
-
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:
-
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:
-
getServiceName
Description copied from interface:ServiceConnectionPropertiesGets the service name (defaults to"service_mgr").- Specified by:
getServiceNamein interfaceServiceConnectionProperties- Returns:
- database name
- See Also:
-
setServiceName
Description copied from interface:ServiceConnectionPropertiesSets the service nameWhen
serverNameisnull, 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
fbclientconnection URLs — NATIVE, (EMBEDDED will behave as NATIVE, protocols like PURE_JAVA may interpret the protocol name as a host name - Custom
typeimplementations may support other URL formats
Some protocols, for example PURE_JAVA, when
serverNameis not set, butserviceNamedoesn't seem to contain a host name, may default to attempting to connect to localhost withserviceNameas the service.When
serverNameis set, the value is taken as the database path or alias. Examples:- service_mgr
- empty string
null
- Specified by:
setServiceNamein 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:
setExpectedDbin interfaceServiceConnectionProperties- Parameters:
expectedDb- Expected database
-
getExpectedDb
Description copied from interface:ServiceConnectionPropertiesGets the expected db (isc_spb_expected_db; defaults tonull).- Specified by:
getExpectedDbin interfaceServiceConnectionProperties- Returns:
- expected database
- See Also:
-
setDatabase
Description copied from interface:ServiceManagerSets the database path for the connection to the service manager.Will also set the
expectedDbproperty. If a different value must be used, it must be set after calling this method.- Specified by:
setDatabasein interfaceServiceManager- Parameters:
database- path for the connection to the service manager.
-
getDatabase
Description copied from interface:ServiceManagerReturns the database path for the connection to the service manager.- Specified by:
getDatabasein 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:ServiceManagerReturns the host for the connection to the service manager.- Specified by:
getHostin 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:ServiceManagerSets the host for the connection to the service manager.See
AttachmentProperties.setServerName(String)for details.- Specified by:
setHostin 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:ServiceManagerReturns the port for the connection to the service manager.- Specified by:
getPortin 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:ServiceManagerSets the port for the connection to the service manager.- Specified by:
setPortin interfaceServiceManager- Parameters:
port- for the connection to the service manager.
-
getWireCrypt
Description copied from interface:AttachmentPropertiesGet the wire encryption level.- Specified by:
getWireCryptin interfaceAttachmentProperties- Returns:
- Wire encryption level
-
getWireCryptAsEnum
Description copied from interface:ServiceManagerGet the wire encryption level.- Specified by:
getWireCryptAsEnumin interfaceServiceManager- Returns:
- Wire encryption level
-
setWireCryptAsEnum
Description copied from interface:ServiceManagerSet the wire encryption level.- Specified by:
setWireCryptAsEnumin interfaceServiceManager- Parameters:
wireCrypt- Wire encryption level (nullnot allowed)
-
getDbCryptConfig
Description copied from interface:AttachmentPropertiesGet the database encryption plugin configuration.- Specified by:
getDbCryptConfigin interfaceAttachmentProperties- Returns:
- Database encryption plugin configuration, meaning plugin specific
-
setDbCryptConfig
Description copied from interface:AttachmentPropertiesSets the database encryption plugin configuration.- Specified by:
setDbCryptConfigin interfaceAttachmentProperties- Parameters:
dbCryptConfig- Database encryption plugin configuration, meaning plugin specific
-
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
-
isWireCompression
public boolean isWireCompression()Description copied from interface:AttachmentPropertiesGet 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.confread by the client library will be used.- Specified by:
isWireCompressionin interfaceAttachmentProperties- Returns:
truewire compression enabled
-
setWireCompression
public void setWireCompression(boolean wireCompression) Description copied from interface:AttachmentPropertiesSets if the connection should try to enable wire compression.- Specified by:
setWireCompressionin interfaceAttachmentProperties- Parameters:
wireCompression-trueenable wire compression,falsedisable wire compression (the default)- See Also:
-
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
-
getLogger
Description copied from interface:ServiceManagerReturns the logger for the connection to the service manager.- Specified by:
getLoggerin interfaceServiceManager- Returns:
- Returns the out.
-
setLogger
Description copied from interface:ServiceManagerSets the logger for the connection to the service manager.- Specified by:
setLoggerin interfaceServiceManager- Parameters:
logger- The out to set.
-
attachServiceManager
- Throws:
SQLException
-
attachDatabase
- Throws:
SQLException
-
queueService
- Throws:
SQLExceptionIOException
-
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:ServiceManagerObtains the server version through a service call.- Specified by:
getServerVersionin interfaceServiceManager- Returns:
- Parsed server version, or
GDSServerVersion.INVALID_VERSIONif parsing failed. - Throws:
SQLException- For errors connecting to the service manager.
-