Class FBServiceManager
- java.lang.Object
- 
- org.firebirdsql.management.FBServiceManager
 
- 
- All Implemented Interfaces:
- AttachmentProperties,- BaseProperties,- ServiceConnectionProperties,- ServiceManager
 - Direct Known Subclasses:
- FBBackupManagerBase,- FBMaintenanceManager,- FBNBackupManager,- FBStatisticsManager,- FBTraceManager,- FBUserManager
 
 public class FBServiceManager extends java.lang.Object implements ServiceManager An implementation of the basic Firebird Service API functionality.- Author:
- Roman Rokytskyy, Mark Rotteveel
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intBUFFER_SIZE
 - 
Constructor SummaryConstructors Constructor Description FBServiceManager()Create a new instance ofFBServiceManagerbased on the default GDSType.FBServiceManager(java.lang.String gdsType)Create a new instance ofFBServiceManagerbased on a given GDSType.FBServiceManager(GDSType gdsType)Create a new instance ofFBServiceManagerbased on a given GDSType.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected FbDatabaseattachDatabase()FbServiceattachServiceManager()java.util.Map<ConnectionProperty,java.lang.Object>connectionPropertyValues()An unmodifiable view on the connection properties held by this BaseProperties implementation.protected ServiceRequestBuffercreateRequestBuffer(FbService service, int operation, int options)protected voidexecuteServicesOperation(FbService service, ServiceRequestBuffer srb)protected voidexecuteServicesOperation(ServiceRequestBuffer srb)Deprecated.java.lang.StringgetAuthPlugins()Get the list of authentication plugins to try.java.lang.BooleangetBooleanProperty(java.lang.String name)Retrieves abooleanproperty value by name.java.lang.StringgetCharSet()Java character set configured for the connection.java.lang.StringgetDatabase()Returns the database path for the connection to the service manager.java.lang.StringgetDbCryptConfig()Get the database encryption plugin configuration.java.lang.StringgetExpectedDb()Gets the expected db (isc_spb_expected_db; defaults tonull).java.lang.StringgetHost()Deprecated.java.lang.IntegergetIntProperty(java.lang.String name)Retrieves anintproperty value by name.java.io.OutputStreamgetLogger()Returns the logger for the connection to the service manager.java.lang.StringgetPassword()intgetPort()Deprecated.intgetPortNumber()Get the port number of the server.java.lang.StringgetProperty(java.lang.String name)Retrieves a string property value by name.java.lang.StringgetServerName()Get the hostname or IP address of the Firebird server.GDSServerVersiongetServerVersion()Obtains the server version through a service call.java.lang.StringgetServiceName()Gets the service name (defaults to"service_mgr").java.lang.StringgetUser()java.lang.StringgetWireCrypt()Get the wire encryption level.WireCryptgetWireCryptAsEnum()Get the wire encryption level.booleanisWireCompression()Get if wire compression should be enabled.voidqueueService(FbService service)voidsetAuthPlugins(java.lang.String authPlugins)Sets the authentication plugins to try.voidsetBooleanProperty(java.lang.String name, java.lang.Boolean value)Sets abooleanproperty by name.voidsetCharSet(java.lang.String charSet)Set the Java character set for the connection.voidsetDatabase(java.lang.String database)Sets the database path for the connection to the service manager.voidsetDbCryptConfig(java.lang.String dbCryptConfig)Sets the database encryption plugin configuration.voidsetExpectedDb(java.lang.String expectedDb)Filename or alias of the database expected to be accessed by the service operation (isc_spb_expected_db).voidsetHost(java.lang.String host)Deprecated.voidsetIntProperty(java.lang.String name, java.lang.Integer value)Sets anintproperty by name.voidsetLogger(java.io.OutputStream logger)Sets the logger for the connection to the service manager.voidsetPassword(java.lang.String password)voidsetPort(int port)Deprecated.voidsetPortNumber(int portNumber)Set the port number of the server.voidsetProperty(java.lang.String name, java.lang.String value)Sets a property by name.voidsetServerName(java.lang.String serverName)Set the hostname or IP address of the Firebird server.voidsetServiceName(java.lang.String serviceName)Sets the service namevoidsetType(java.lang.String type)voidsetUser(java.lang.String user)voidsetWireCompression(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.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.firebirdsql.jaybird.props.AttachmentPropertiesgetConnectTimeout, getEncoding, getParallelWorkers, getProcessId, getProcessName, getRoleName, getSocketBufferSize, getSoTimeout, getType, setConnectTimeout, setEncoding, setParallelWorkers, setProcessId, setProcessName, setRoleName, setSocketBufferSize, setSoTimeout, setWireCrypt
 - 
Methods inherited from interface org.firebirdsql.jaybird.props.BasePropertiesgetBooleanProperty, getIntProperty, getProperty
 
- 
 
- 
- 
- 
Field Detail- 
BUFFER_SIZEpublic static final int BUFFER_SIZE - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
FBServiceManagerpublic FBServiceManager() Create a new instance ofFBServiceManagerbased on the default GDSType.
 - 
FBServiceManagerpublic FBServiceManager(java.lang.String gdsType) Create a new instance ofFBServiceManagerbased on a given GDSType.- Parameters:
- gdsType- type must be PURE_JAVA, EMBEDDED, or NATIVE
 
 - 
FBServiceManagerpublic FBServiceManager(GDSType gdsType) Create a new instance ofFBServiceManagerbased on a given GDSType.- Parameters:
- gdsType- The GDS implementation type to use
 
 
- 
 - 
Method Detail- 
setTypepublic final void setType(java.lang.String type) - Specified by:
- setTypein interface- AttachmentProperties
- Parameters:
- type- type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS implementations installed in the system.
 
 - 
setCharSetpublic void setCharSet(java.lang.String charSet) 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 interface- AttachmentProperties
- Parameters:
- charSet- Character set for the connection. Similar to- encodingproperty, but accepts Java names instead of Firebird ones.
- See Also:
- AttachmentProperties.setEncoding(String)
 
 - 
getCharSetpublic java.lang.String 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 interface- AttachmentProperties
- Returns:
- Java character set for the connection (nullwhen not explicitly configured).
 
 - 
setUserpublic void setUser(java.lang.String user) - Specified by:
- setUserin interface- AttachmentProperties
- Parameters:
- user- Name of the user to authenticate to the server.
 
 - 
getUserpublic java.lang.String getUser() - Specified by:
- getUserin interface- AttachmentProperties
- Returns:
- Name of the user to authenticate to the server.
 
 - 
setPasswordpublic void setPassword(java.lang.String password) - Specified by:
- setPasswordin interface- AttachmentProperties
- Parameters:
- password- Password to authenticate to the server.
 
 - 
getPasswordpublic java.lang.String getPassword() - Specified by:
- getPasswordin interface- AttachmentProperties
- Returns:
- Password to authenticate to the server.
 
 - 
getServerNamepublic java.lang.String getServerName() Description copied from interface:AttachmentPropertiesGet the hostname or IP address of the Firebird server.- Specified by:
- getServerNamein interface- AttachmentProperties
- Returns:
- Hostname or IP address of the server
- See Also:
- AttachmentProperties.setServerName(String)
 
 - 
setServerNamepublic void setServerName(java.lang.String serverName) 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 interface- AttachmentProperties
- Parameters:
- serverName- Hostname or IP address of the server
 
 - 
getPortNumberpublic int getPortNumber() Description copied from interface:AttachmentPropertiesGet the port number of the server.- Specified by:
- getPortNumberin interface- AttachmentProperties
- Returns:
- Port number of the server
- See Also:
- AttachmentProperties.setPortNumber(int)
 
 - 
setPortNumberpublic 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 interface- AttachmentProperties
- Parameters:
- portNumber- Port number of the server
- See Also:
- AttachmentProperties.setServerName(String)
 
 - 
getServiceNamepublic java.lang.String getServiceName() Description copied from interface:ServiceConnectionPropertiesGets the service name (defaults to"service_mgr").- Specified by:
- getServiceNamein interface- ServiceConnectionProperties
- Returns:
- database name
- See Also:
- ServiceConnectionProperties.setServiceName(String)
 
 - 
setServiceNamepublic void setServiceName(java.lang.String serviceName) 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, OOREMOTE, 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, OOREMOTE
- //localhost:3051/ — PURE_JAVA, OOREMOTE, 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, OOREMOTE, NATIVE (for NATIVE, this format is parsed and transformed to the next example)
- localhost:service_mgr — NATIVE, PURE_JAVA, OOREMOTE
- //localhost:3051/service_mgr — PURE_JAVA, OOREMOTE, NATIVE (for NATIVE, this format is parsed and transformed to the next example)
- localhost/3051:service_mgr — NATIVE, PURE_JAVA, OOREMOTE
- service_mgr — NATIVE, EMBEDDED, PURE_JAVA, OOREMOTE (PURE_JAVA and OOREMOTE 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) TODO: Check if actually valid
- 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 TODO verify if that works
- null
 - Specified by:
- setServiceNamein interface- ServiceConnectionProperties
- Parameters:
- serviceName- service name
 
 - 
setExpectedDbpublic void setExpectedDb(java.lang.String expectedDb) 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 interface- ServiceConnectionProperties
- Parameters:
- expectedDb- Expected database
 
 - 
getExpectedDbpublic java.lang.String getExpectedDb() Description copied from interface:ServiceConnectionPropertiesGets the expected db (isc_spb_expected_db; defaults tonull).- Specified by:
- getExpectedDbin interface- ServiceConnectionProperties
- Returns:
- expected database
- See Also:
- ServiceConnectionProperties.setExpectedDb(String)
 
 - 
setDatabasepublic void setDatabase(java.lang.String database) 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 interface- ServiceManager
- Parameters:
- database- path for the connection to the service manager.
 
 - 
getDatabasepublic java.lang.String getDatabase() Description copied from interface:ServiceManagerReturns the database path for the connection to the service manager.- Specified by:
- getDatabasein interface- ServiceManager
- Returns:
- the database path for the connection to the service manager.
 
 - 
getHost@Deprecated public java.lang.String getHost() Deprecated.Description copied from interface:ServiceManagerReturns the host for the connection to the service manager.- Specified by:
- getHostin interface- ServiceManager
- Returns:
- the host for the connection to the service manager.
 
 - 
setHost@Deprecated public void setHost(java.lang.String host) Deprecated.Description copied from interface:ServiceManagerSets the host for the connection to the service manager.See AttachmentProperties.setServerName(String)for details.- Specified by:
- setHostin interface- ServiceManager
- Parameters:
- host- for the connection to the service manager.
 
 - 
getPort@Deprecated public int getPort() Deprecated.Description copied from interface:ServiceManagerReturns the port for the connection to the service manager.- Specified by:
- getPortin interface- ServiceManager
- Returns:
- the port for the connection to the service manager.
 
 - 
setPort@Deprecated public void setPort(int port) Deprecated.Description copied from interface:ServiceManagerSets the port for the connection to the service manager.- Specified by:
- setPortin interface- ServiceManager
- Parameters:
- port- for the connection to the service manager.
 
 - 
getWireCryptpublic java.lang.String getWireCrypt() Description copied from interface:AttachmentPropertiesGet the wire encryption level.- Specified by:
- getWireCryptin interface- AttachmentProperties
- Returns:
- Wire encryption level
 
 - 
getWireCryptAsEnumpublic WireCrypt getWireCryptAsEnum() Description copied from interface:ServiceManagerGet the wire encryption level.- Specified by:
- getWireCryptAsEnumin interface- ServiceManager
- Returns:
- Wire encryption level
 
 - 
setWireCryptAsEnumpublic void setWireCryptAsEnum(WireCrypt wireCrypt) Description copied from interface:ServiceManagerSet the wire encryption level.- Specified by:
- setWireCryptAsEnumin interface- ServiceManager
- Parameters:
- wireCrypt- Wire encryption level (- nullnot allowed)
 
 - 
getDbCryptConfigpublic java.lang.String getDbCryptConfig() Description copied from interface:AttachmentPropertiesGet the database encryption plugin configuration.- Specified by:
- getDbCryptConfigin interface- AttachmentProperties
- Returns:
- Database encryption plugin configuration, meaning plugin specific
 
 - 
setDbCryptConfigpublic void setDbCryptConfig(java.lang.String dbCryptConfig) Description copied from interface:AttachmentPropertiesSets the database encryption plugin configuration.- Specified by:
- setDbCryptConfigin interface- AttachmentProperties
- Parameters:
- dbCryptConfig- Database encryption plugin configuration, meaning plugin specific
 
 - 
getAuthPluginspublic java.lang.String getAuthPlugins() Description copied from interface:AttachmentPropertiesGet the list of authentication plugins to try.- Specified by:
- getAuthPluginsin interface- AttachmentProperties
- Returns:
- comma-separated list of authentication plugins
 
 - 
setAuthPluginspublic void setAuthPlugins(java.lang.String authPlugins) Description copied from interface:AttachmentPropertiesSets the authentication plugins to try.Invalid names are skipped during authentication. - Specified by:
- setAuthPluginsin interface- AttachmentProperties
- Parameters:
- authPlugins- comma-separated list of authentication plugins
 
 - 
isWireCompressionpublic 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 interface- AttachmentProperties
- Returns:
- truewire compression enabled
 
 - 
setWireCompressionpublic void setWireCompression(boolean wireCompression) Description copied from interface:AttachmentPropertiesSets if the connection should try to enable wire compression.- Specified by:
- setWireCompressionin interface- AttachmentProperties
- Parameters:
- wireCompression-- trueenable wire compression,- falsedisable wire compression (the default)
- See Also:
- AttachmentProperties.isWireCompression()
 
 - 
getPropertypublic java.lang.String getProperty(java.lang.String name) 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 interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Value of the property, or nullwhen not set or not a known property
 
 - 
setPropertypublic void setProperty(java.lang.String name, java.lang.String value)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 interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
getIntPropertypublic java.lang.Integer getIntProperty(java.lang.String name) 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 interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Integer with value of the property, or nullwhen not set
 
 - 
setIntPropertypublic void setIntProperty(java.lang.String name, java.lang.Integer value)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 interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
getBooleanPropertypublic java.lang.Boolean getBooleanProperty(java.lang.String name) 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 anintproperty- Specified by:
- getBooleanPropertyin interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- Returns:
- Integer with value of the property, or nullwhen not set
 
 - 
setBooleanPropertypublic void setBooleanProperty(java.lang.String name, java.lang.Boolean value)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 interface- BaseProperties
- Parameters:
- name- Property name (not- nullor empty)
- value- Property value (use- nullto apply default)
 
 - 
connectionPropertyValuespublic java.util.Map<ConnectionProperty,java.lang.Object> 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 interface- BaseProperties
- Returns:
- An unmodifiable view on the property values held in this properties instance
 
 - 
getLoggerpublic java.io.OutputStream getLogger() Description copied from interface:ServiceManagerReturns the logger for the connection to the service manager.- Specified by:
- getLoggerin interface- ServiceManager
- Returns:
- Returns the out.
 
 - 
setLoggerpublic void setLogger(java.io.OutputStream logger) Description copied from interface:ServiceManagerSets the logger for the connection to the service manager.- Specified by:
- setLoggerin interface- ServiceManager
- Parameters:
- logger- The out to set.
 
 - 
attachServiceManagerpublic FbService attachServiceManager() throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
attachDatabaseprotected FbDatabase attachDatabase() throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
queueServicepublic void queueService(FbService service) throws java.sql.SQLException, java.io.IOException - Throws:
- java.sql.SQLException
- java.io.IOException
 
 - 
executeServicesOperation@Deprecated protected void executeServicesOperation(ServiceRequestBuffer srb) throws java.sql.SQLException Deprecated.Execute a Services API operation in the database. All output from the operation is sent to thisServiceManager's logger.- Parameters:
- srb- The buffer containing the task request
- Throws:
- java.sql.SQLException- if a database access error occurs or incorrect parameters are supplied
 
 - 
executeServicesOperationprotected final void executeServicesOperation(FbService service, ServiceRequestBuffer srb) throws java.sql.SQLException - Throws:
- java.sql.SQLException
 
 - 
createRequestBufferprotected ServiceRequestBuffer createRequestBuffer(FbService service, int operation, int options) 
 - 
getServerVersionpublic GDSServerVersion getServerVersion() throws java.sql.SQLException Description copied from interface:ServiceManagerObtains the server version through a service call.- Specified by:
- getServerVersionin interface- ServiceManager
- Returns:
- Parsed server version, or GDSServerVersion.INVALID_VERSIONif parsing failed.
- Throws:
- java.sql.SQLException- For errors connecting to the service manager.
 
 
- 
 
-