public class FBServiceManager extends java.lang.Object implements ServiceManager
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
Constructor and Description |
---|
FBServiceManager()
Create a new instance of
FBServiceManager based on
the default GDSType. |
FBServiceManager(GDSType gdsType)
Create a new instance of
FBServiceManager based on
a given GDSType. |
FBServiceManager(java.lang.String gdsType)
Create a new instance of
FBServiceManager based on
a given GDSType. |
Modifier and Type | Method and Description |
---|---|
protected FbDatabase |
attachDatabase() |
FbService |
attachServiceManager() |
java.util.Map<ConnectionProperty,java.lang.Object> |
connectionPropertyValues()
An unmodifiable view on the connection properties held by this BaseProperties implementation.
|
protected ServiceRequestBuffer |
createRequestBuffer(FbService service,
int operation,
int options) |
protected void |
executeServicesOperation(FbService service,
ServiceRequestBuffer srb) |
protected void |
executeServicesOperation(ServiceRequestBuffer srb)
Deprecated.
|
java.lang.String |
getAuthPlugins()
Get the list of authentication plugins to try.
|
java.lang.Boolean |
getBooleanProperty(java.lang.String name)
Retrieves a
boolean property value by name. |
java.lang.String |
getCharSet()
Java character set configured for the connection.
|
java.lang.String |
getDatabase()
Returns the database path for the connection to the service manager.
|
java.lang.String |
getDbCryptConfig()
Get the database encryption plugin configuration.
|
java.lang.String |
getExpectedDb()
Gets the expected db (
isc_spb_expected_db ; defaults to null ). |
java.lang.String |
getHost()
Deprecated.
|
java.lang.Integer |
getIntProperty(java.lang.String name)
Retrieves an
int property value by name. |
java.io.OutputStream |
getLogger()
Returns the logger for the connection to the service manager.
|
java.lang.String |
getPassword() |
int |
getPort()
Deprecated.
|
int |
getPortNumber()
Get the port number of the server.
|
java.lang.String |
getProperty(java.lang.String name)
Retrieves a string property value by name.
|
java.lang.String |
getServerName()
Get the hostname or IP address of the Firebird server.
|
GDSServerVersion |
getServerVersion()
Obtains the server version through a service call.
|
java.lang.String |
getServiceName()
Gets the service name (defaults to
"service_mgr" ). |
java.lang.String |
getUser() |
java.lang.String |
getWireCrypt()
Get the wire encryption level.
|
WireCrypt |
getWireCryptAsEnum()
Get the wire encryption level.
|
boolean |
isWireCompression()
Get if wire compression should be enabled.
|
void |
queueService(FbService service) |
void |
setAuthPlugins(java.lang.String authPlugins)
Sets the authentication plugins to try.
|
void |
setBooleanProperty(java.lang.String name,
java.lang.Boolean value)
Sets a
boolean property by name. |
void |
setCharSet(java.lang.String charSet)
Set the Java character set for the connection.
|
void |
setDatabase(java.lang.String database)
Sets the database path for the connection to the service manager.
|
void |
setDbCryptConfig(java.lang.String dbCryptConfig)
Sets the database encryption plugin configuration.
|
void |
setExpectedDb(java.lang.String expectedDb)
Filename or alias of the database expected to be accessed by the service operation (
isc_spb_expected_db ). |
void |
setHost(java.lang.String host)
Deprecated.
|
void |
setIntProperty(java.lang.String name,
java.lang.Integer value)
Sets an
int property by name. |
void |
setLogger(java.io.OutputStream logger)
Sets the logger for the connection to the service manager.
|
void |
setPassword(java.lang.String password) |
void |
setPort(int port)
Deprecated.
|
void |
setPortNumber(int portNumber)
Set the port number of the server.
|
void |
setProperty(java.lang.String name,
java.lang.String value)
Sets a property by name.
|
void |
setServerName(java.lang.String serverName)
Set the hostname or IP address of the Firebird server.
|
void |
setServiceName(java.lang.String serviceName)
Sets the service name
|
void |
setType(java.lang.String type) |
void |
setUser(java.lang.String user) |
void |
setWireCompression(boolean wireCompression)
Sets if the connection should try to enable wire compression.
|
void |
setWireCryptAsEnum(WireCrypt wireCrypt)
Set the wire encryption level.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConnectTimeout, getEncoding, getParallelWorkers, getProcessId, getProcessName, getRoleName, getSocketBufferSize, getSoTimeout, getType, setConnectTimeout, setEncoding, setParallelWorkers, setProcessId, setProcessName, setRoleName, setSocketBufferSize, setSoTimeout, setWireCrypt
getBooleanProperty, getIntProperty, getProperty
public static final int BUFFER_SIZE
public FBServiceManager()
FBServiceManager
based on
the default GDSType.public FBServiceManager(java.lang.String gdsType)
FBServiceManager
based on
a given GDSType.gdsType
- type must be PURE_JAVA, EMBEDDED, or NATIVEpublic FBServiceManager(GDSType gdsType)
FBServiceManager
based on
a given GDSType.gdsType
- The GDS implementation type to usepublic final void setType(java.lang.String type)
setType
in interface AttachmentProperties
type
- type of the connection, for example, "PURE_JAVA", "NATIVE", "EMBEDDED", depends on the GDS
implementations installed in the system.public void setCharSet(java.lang.String charSet)
AttachmentProperties
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.
setCharSet
in interface AttachmentProperties
charSet
- Character set for the connection. Similar to encoding
property, but accepts Java names instead
of Firebird ones.AttachmentProperties.setEncoding(String)
public java.lang.String getCharSet()
AttachmentProperties
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}).
getCharSet
in interface AttachmentProperties
null
when not explicitly configured).public void setUser(java.lang.String user)
setUser
in interface AttachmentProperties
user
- Name of the user to authenticate to the server.public java.lang.String getUser()
getUser
in interface AttachmentProperties
public void setPassword(java.lang.String password)
setPassword
in interface AttachmentProperties
password
- Password to authenticate to the server.public java.lang.String getPassword()
getPassword
in interface AttachmentProperties
public java.lang.String getServerName()
AttachmentProperties
getServerName
in interface AttachmentProperties
AttachmentProperties.setServerName(String)
public void setServerName(java.lang.String serverName)
AttachmentProperties
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.
setServerName
in interface AttachmentProperties
serverName
- Hostname or IP address of the serverpublic int getPortNumber()
AttachmentProperties
getPortNumber
in interface AttachmentProperties
AttachmentProperties.setPortNumber(int)
public void setPortNumber(int portNumber)
AttachmentProperties
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
.
setPortNumber
in interface AttachmentProperties
portNumber
- Port number of the serverAttachmentProperties.setServerName(String)
public java.lang.String getServiceName()
ServiceConnectionProperties
"service_mgr"
).getServiceName
in interface ServiceConnectionProperties
ServiceConnectionProperties.setServiceName(String)
public void setServiceName(java.lang.String serviceName)
ServiceConnectionProperties
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:
serverName
, depending on the Firebird version and platform, NATIVE may use Firebird Embedded)xnet
) TODO: Check if actually validfbclient
connection URLs — NATIVE, (EMBEDDED will behave as NATIVE, protocols
like PURE_JAVA may interpret the protocol name as a host nametype
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:
null
setServiceName
in interface ServiceConnectionProperties
serviceName
- service namepublic void setExpectedDb(java.lang.String expectedDb)
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.
setExpectedDb
in interface ServiceConnectionProperties
expectedDb
- Expected databasepublic java.lang.String getExpectedDb()
ServiceConnectionProperties
isc_spb_expected_db
; defaults to null
).getExpectedDb
in interface ServiceConnectionProperties
ServiceConnectionProperties.setExpectedDb(String)
public void setDatabase(java.lang.String database)
ServiceManager
Will also set the expectedDb
property. If a different value must be used, it must be set after
calling this method.
setDatabase
in interface ServiceManager
database
- path for the connection to the service manager.public java.lang.String getDatabase()
ServiceManager
getDatabase
in interface ServiceManager
@Deprecated public java.lang.String getHost()
ServiceManager
getHost
in interface ServiceManager
@Deprecated public void setHost(java.lang.String host)
ServiceManager
See AttachmentProperties.setServerName(String)
for details.
setHost
in interface ServiceManager
host
- for the connection to the service manager.@Deprecated public int getPort()
ServiceManager
getPort
in interface ServiceManager
@Deprecated public void setPort(int port)
ServiceManager
setPort
in interface ServiceManager
port
- for the connection to the service manager.public java.lang.String getWireCrypt()
AttachmentProperties
getWireCrypt
in interface AttachmentProperties
public WireCrypt getWireCryptAsEnum()
ServiceManager
getWireCryptAsEnum
in interface ServiceManager
public void setWireCryptAsEnum(WireCrypt wireCrypt)
ServiceManager
setWireCryptAsEnum
in interface ServiceManager
wireCrypt
- Wire encryption level (null
not allowed)public java.lang.String getDbCryptConfig()
AttachmentProperties
getDbCryptConfig
in interface AttachmentProperties
public void setDbCryptConfig(java.lang.String dbCryptConfig)
AttachmentProperties
setDbCryptConfig
in interface AttachmentProperties
dbCryptConfig
- Database encryption plugin configuration, meaning plugin specificpublic java.lang.String getAuthPlugins()
AttachmentProperties
getAuthPlugins
in interface AttachmentProperties
public void setAuthPlugins(java.lang.String authPlugins)
AttachmentProperties
Invalid names are skipped during authentication.
setAuthPlugins
in interface AttachmentProperties
authPlugins
- comma-separated list of authentication pluginspublic boolean isWireCompression()
AttachmentProperties
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.
isWireCompression
in interface AttachmentProperties
true
wire compression enabledpublic void setWireCompression(boolean wireCompression)
AttachmentProperties
setWireCompression
in interface AttachmentProperties
wireCompression
- true
enable wire compression, false
disable wire compression (the default)AttachmentProperties.isWireCompression()
public java.lang.String getProperty(java.lang.String name)
BaseProperties
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.
getProperty
in interface BaseProperties
name
- Property name (not null
or empty)null
when not set or not a known propertypublic void setProperty(java.lang.String name, java.lang.String value)
BaseProperties
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
.
setProperty
in interface BaseProperties
name
- Property name (not null
or empty)value
- Property value (use null
to apply default)public java.lang.Integer getIntProperty(java.lang.String name)
BaseProperties
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
getIntProperty
in interface BaseProperties
name
- Property name (not null
or empty)null
when not setpublic void setIntProperty(java.lang.String name, java.lang.Integer value)
BaseProperties
int
property by name.
For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
setIntProperty
in interface BaseProperties
name
- Property name (not null
or empty)value
- Property value (use null
to apply default)public java.lang.Boolean getBooleanProperty(java.lang.String name)
BaseProperties
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
getBooleanProperty
in interface BaseProperties
name
- Property name (not null
or empty)null
when not setpublic void setBooleanProperty(java.lang.String name, java.lang.Boolean value)
BaseProperties
boolean
property by name.
For implementation simplicity, it is allowed to also set string properties. The value set will be the string equivalent.
setBooleanProperty
in interface BaseProperties
name
- Property name (not null
or empty)value
- Property value (use null
to apply default)public java.util.Map<ConnectionProperty,java.lang.Object> connectionPropertyValues()
BaseProperties
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.
connectionPropertyValues
in interface BaseProperties
public java.io.OutputStream getLogger()
ServiceManager
getLogger
in interface ServiceManager
public void setLogger(java.io.OutputStream logger)
ServiceManager
setLogger
in interface ServiceManager
logger
- The out to set.public FbService attachServiceManager() throws java.sql.SQLException
java.sql.SQLException
protected FbDatabase attachDatabase() throws java.sql.SQLException
java.sql.SQLException
public void queueService(FbService service) throws java.sql.SQLException, java.io.IOException
java.sql.SQLException
java.io.IOException
@Deprecated protected void executeServicesOperation(ServiceRequestBuffer srb) throws java.sql.SQLException
executeServicesOperation(FbService, ServiceRequestBuffer)
.ServiceManager
's logger.srb
- The buffer containing the task requestjava.sql.SQLException
- if a database access error occurs or
incorrect parameters are suppliedprotected final void executeServicesOperation(FbService service, ServiceRequestBuffer srb) throws java.sql.SQLException
java.sql.SQLException
protected ServiceRequestBuffer createRequestBuffer(FbService service, int operation, int options)
public GDSServerVersion getServerVersion() throws java.sql.SQLException
ServiceManager
getServerVersion
in interface ServiceManager
GDSServerVersion.INVALID_VERSION
if parsing
failed.java.sql.SQLException
- For errors connecting to the service manager.Copyright © 2001-2023 Jaybird (Firebird JDBC) team. All rights reserved.