Class FBServiceManager

    • Constructor Detail

      • FBServiceManager

        public FBServiceManager()
        Create a new instance of FBServiceManager based on the default GDSType.
      • FBServiceManager

        public FBServiceManager​(java.lang.String gdsType)
        Create a new instance of FBServiceManager based on a given GDSType.
        Parameters:
        gdsType - type must be PURE_JAVA, EMBEDDED, or NATIVE
      • FBServiceManager

        public FBServiceManager​(GDSType gdsType)
        Create a new instance of FBServiceManager based on a given GDSType.
        Parameters:
        gdsType - The GDS implementation type to use
    • Method Detail

      • setType

        public final void setType​(java.lang.String type)
        Specified by:
        setType in interface AttachmentProperties
        Parameters:
        type - type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS implementations installed in the system.
      • setCharSet

        public void setCharSet​(java.lang.String charSet)
        Description copied from interface: AttachmentProperties
        Set the Java character set for the connection.

        It is possible to set both the charSet and encoding to achieve a character set conversion effect, but in general only one of both properties should be set.

        Specified by:
        setCharSet in interface AttachmentProperties
        Parameters:
        charSet - Character set for the connection. Similar to encoding property, but accepts Java names instead of Firebird ones.
        See Also:
        AttachmentProperties.setEncoding(String)
      • getCharSet

        public java.lang.String 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() (property charsetName), or FbAttachment.getEncodingFactory() (properties defaultEncoding.charsetName or {code defaultEncodingDefinition.javaCharset}).

        Specified by:
        getCharSet in interface AttachmentProperties
        Returns:
        Java character set for the connection (null when not explicitly configured).
      • setUser

        public void setUser​(java.lang.String user)
        Specified by:
        setUser in interface AttachmentProperties
        Parameters:
        user - Name of the user to authenticate to the server.
      • getUser

        public java.lang.String getUser()
        Specified by:
        getUser in interface AttachmentProperties
        Returns:
        Name of the user to authenticate to the server.
      • setPassword

        public void setPassword​(java.lang.String password)
        Specified by:
        setPassword in interface AttachmentProperties
        Parameters:
        password - Password to authenticate to the server.
      • getPassword

        public java.lang.String getPassword()
        Specified by:
        getPassword in interface AttachmentProperties
        Returns:
        Password to authenticate to the server.
      • setServerName

        public void setServerName​(java.lang.String serverName)
        Description copied from interface: AttachmentProperties
        Set the hostname or IP address of the Firebird server.

        When set to null (the default), the databaseName or serviceName is used as the full identification of the database host, port and database path/alias. Protocol implementations, for example PURE_JAVA, may default to localhost when this property is null, but databaseName/serviceName does not (seem to) contain a host name.

        Specified by:
        setServerName in interface AttachmentProperties
        Parameters:
        serverName - Hostname or IP address of the server
      • 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 if serverName is null, unless the protocol implementation needs a hostname, but cannot find a hostname in databaseName/serviceName.

        Specified by:
        setPortNumber in interface AttachmentProperties
        Parameters:
        portNumber - Port number of the server
        See Also:
        AttachmentProperties.setServerName(String)
      • setServiceName

        public void setServiceName​(java.lang.String serviceName)
        Description copied from interface: ServiceConnectionProperties
        Sets the service name

        When serverName is null, 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 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, but serviceName doesn't seem to contain a host name, may default to attempting to connect to localhost with serviceName as the service.

        When serverName is set, the value is taken as the database path or alias. Examples:

        • service_mgr
        • empty string TODO verify if that works
        • null
        Specified by:
        setServiceName in interface ServiceConnectionProperties
        Parameters:
        serviceName - service name
      • setExpectedDb

        public 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 is null.

        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 interface ServiceConnectionProperties
        Parameters:
        expectedDb - Expected database
      • setDatabase

        public void setDatabase​(java.lang.String database)
        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 interface ServiceManager
        Parameters:
        database - path for the connection to the service manager.
      • getDatabase

        public java.lang.String getDatabase()
        Description copied from interface: ServiceManager
        Returns the database path for the connection to the service manager.
        Specified by:
        getDatabase in 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: ServiceManager
        Returns the host for the connection to the service manager.
        Specified by:
        getHost in interface ServiceManager
        Returns:
        the host for the connection to the service manager.
      • getPort

        @Deprecated
        public int getPort()
        Deprecated.
        Description copied from interface: ServiceManager
        Returns the port for the connection to the service manager.
        Specified by:
        getPort in interface ServiceManager
        Returns:
        the port for the connection to the service manager.
      • setPort

        @Deprecated
        public void setPort​(int port)
        Deprecated.
        Description copied from interface: ServiceManager
        Sets the port for the connection to the service manager.
        Specified by:
        setPort in interface ServiceManager
        Parameters:
        port - for the connection to the service manager.
      • setWireCryptAsEnum

        public void setWireCryptAsEnum​(WireCrypt wireCrypt)
        Description copied from interface: ServiceManager
        Set the wire encryption level.
        Specified by:
        setWireCryptAsEnum in interface ServiceManager
        Parameters:
        wireCrypt - Wire encryption level (null not allowed)
      • getDbCryptConfig

        public java.lang.String getDbCryptConfig()
        Description copied from interface: AttachmentProperties
        Get the database encryption plugin configuration.
        Specified by:
        getDbCryptConfig in interface AttachmentProperties
        Returns:
        Database encryption plugin configuration, meaning plugin specific
      • setDbCryptConfig

        public void setDbCryptConfig​(java.lang.String dbCryptConfig)
        Description copied from interface: AttachmentProperties
        Sets the database encryption plugin configuration.
        Specified by:
        setDbCryptConfig in interface AttachmentProperties
        Parameters:
        dbCryptConfig - Database encryption plugin configuration, meaning plugin specific
      • getAuthPlugins

        public java.lang.String getAuthPlugins()
        Description copied from interface: AttachmentProperties
        Get the list of authentication plugins to try.
        Specified by:
        getAuthPlugins in interface AttachmentProperties
        Returns:
        comma-separated list of authentication plugins
      • setAuthPlugins

        public void setAuthPlugins​(java.lang.String authPlugins)
        Description copied from interface: AttachmentProperties
        Sets the authentication plugins to try.

        Invalid names are skipped during authentication.

        Specified by:
        setAuthPlugins in interface AttachmentProperties
        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 interface AttachmentProperties
        Returns:
        true wire compression enabled
      • getProperty

        public java.lang.String getProperty​(java.lang.String name)
        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. For int or boolean the string equivalent is returned.

        Specified by:
        getProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        Returns:
        Value of the property, or null when not set or not a known property
      • setProperty

        public void setProperty​(java.lang.String name,
                                java.lang.String value)
        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 or boolean properties, the appropriate conversions are applied. Using null will reset to the default value. For boolean properties, an empty string is taken to mean true.

        Specified by:
        setProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        value - Property value (use null to apply default)
      • getIntProperty

        public java.lang.Integer getIntProperty​(java.lang.String name)
        Description copied from interface: BaseProperties
        Retrieves an int 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 an int property

        Specified by:
        getIntProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        Returns:
        Integer with value of the property, or null when not set
      • setIntProperty

        public void setIntProperty​(java.lang.String name,
                                   java.lang.Integer value)
        Description copied from interface: BaseProperties
        Sets an int 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 interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        value - Property value (use null to apply default)
      • getBooleanProperty

        public java.lang.Boolean getBooleanProperty​(java.lang.String name)
        Description copied from interface: BaseProperties
        Retrieves a boolean 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 an int property

        Specified by:
        getBooleanProperty in interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        Returns:
        Integer with value of the property, or null when not set
      • setBooleanProperty

        public void setBooleanProperty​(java.lang.String name,
                                       java.lang.Boolean value)
        Description copied from interface: BaseProperties
        Sets a boolean 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 interface BaseProperties
        Parameters:
        name - Property name (not null or empty)
        value - Property value (use null to apply default)
      • connectionPropertyValues

        public java.util.Map<ConnectionProperty,​java.lang.Object> 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 interface BaseProperties
        Returns:
        An unmodifiable view on the property values held in this properties instance
      • getLogger

        public java.io.OutputStream getLogger()
        Description copied from interface: ServiceManager
        Returns the logger for the connection to the service manager.
        Specified by:
        getLogger in interface ServiceManager
        Returns:
        Returns the out.
      • setLogger

        public void setLogger​(java.io.OutputStream logger)
        Description copied from interface: ServiceManager
        Sets the logger for the connection to the service manager.
        Specified by:
        setLogger in interface ServiceManager
        Parameters:
        logger - The out to set.
      • attachServiceManager

        public FbService attachServiceManager()
                                       throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • attachDatabase

        protected FbDatabase attachDatabase()
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • queueService

        public 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
        Execute a Services API operation in the database. All output from the operation is sent to this ServiceManager'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
      • executeServicesOperation

        protected final void executeServicesOperation​(FbService service,
                                                      ServiceRequestBuffer srb)
                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException