Package org.apache.ignite
Class IgniteJdbcThinDataSource
- java.lang.Object
-
- org.apache.ignite.IgniteJdbcThinDataSource
-
- All Implemented Interfaces:
Serializable
,Wrapper
,CommonDataSource
,DataSource
public class IgniteJdbcThinDataSource extends Object implements DataSource, Serializable
JDBC thin DataSource implementation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IgniteJdbcThinDataSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String[]
getAddresses()
String
getCipherSuites()
Gets cipher suites.Connection
getConnection()
Connection
getConnection(String username, String pwd)
int
getLoginTimeout()
PrintWriter
getLogWriter()
Logger
getParentLogger()
String
getPassword()
String
getSchema()
int
getSocketReceiveBuffer()
int
getSocketSendBuffer()
String
getSslClientCertificateKeyStorePassword()
Gets key store password.String
getSslClientCertificateKeyStoreType()
Gets key store type used for context creation.String
getSslClientCertificateKeyStoreUrl()
Gets the key store URL.String
getSslFactory()
Gets the class name of the custom implementation of the Factory<SSLSocketFactory>.String
getSslKeyAlgorithm()
Gets algorithm that will be used to create a key manager.String
getSslMode()
Gets SSL connection mode.String
getSslProtocol()
Gets protocol for secure transport.String
getSslTrustCertificateKeyStorePassword()
Gets trust store password.String
getSslTrustCertificateKeyStoreType()
Gets trust store type.String
getSslTrustCertificateKeyStoreUrl()
Gets the trust store URL.String
getUrl()
String
getURL()
Different application servers us different format (URL & url).String
getUsername()
boolean
isAutoCloseServerCursor()
boolean
isCollocated()
boolean
isDistributedJoins()
boolean
isEnforceJoinOrder()
boolean
isLazy()
boolean
isReplicatedOnly()
boolean
isSkipReducerOnUpdate()
boolean
isSslTrustAll()
Gets trust any server certificate flag.boolean
isTcpNoDelay()
boolean
isWrapperFor(Class<?> iface)
void
setAddresses(String... addrsStr)
Sets the addresses of the Ignite nodes to connect; address string format:host[:portRangeFrom[..portRangeTo]]
.void
setAutoCloseServerCursor(boolean autoCloseServerCursor)
void
setCipherSuites(String cipherSuites)
Override default cipher suites.void
setCollocated(boolean collocated)
void
setDistributedJoins(boolean distributedJoins)
void
setEnforceJoinOrder(boolean enforceJoinOrder)
void
setLazy(boolean lazy)
void
setLoginTimeout(int seconds)
void
setLogWriter(PrintWriter out)
void
setPassword(String passwd)
void
setReplicatedOnly(boolean replicatedOnly)
void
setSchema(String schema)
void
setSkipReducerOnUpdate(boolean skipReducerOnUpdate)
void
setSocketReceiveBuffer(int size)
void
setSocketSendBuffer(int size)
void
setSslClientCertificateKeyStorePassword(String passwd)
Sets key store password.void
setSslClientCertificateKeyStoreType(String ksType)
Sets key store type used in context initialization.void
setSslClientCertificateKeyStoreUrl(String url)
Sets path to the key store file.void
setSslFactory(String sslFactory)
Sets the class name of the custom implementation of the Factory<SSLSocketFactory>.void
setSslKeyAlgorithm(String keyAlgorithm)
Sets key manager algorithm that will be used to create a key manager.void
setSslMode(String mode)
Use SSL connection to Ignite node.void
setSslProtocol(String sslProtocol)
Sets protocol for secure transport.void
setSslTrustAll(boolean trustAll)
Sets totrue
to trust any server certificate (revoked, expired or self-signed SSL certificates).void
setSslTrustCertificateKeyStorePassword(String passwd)
Sets trust store password.void
setSslTrustCertificateKeyStoreType(String ksType)
Sets trust store type.void
setSslTrustCertificateKeyStoreUrl(String url)
Sets path to the trust store file.void
setTcpNoDelay(boolean tcpNoDelay)
void
setUrl(String url)
void
setURL(String url)
Different application servers us different format (URL & url).void
setUsername(String name)
<T> T
unwrap(Class<T> iface)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
-
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
-
-
-
Method Detail
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getConnection
public Connection getConnection(String username, String pwd) throws SQLException
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException
- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException
- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-
getURL
public String getURL()
Different application servers us different format (URL & url).- Returns:
- Connection URL.
-
setURL
public void setURL(String url) throws SQLException
Different application servers us different format (URL & url).- Parameters:
url
- Connection URL.- Throws:
SQLException
- On error whrn URL is invalid.
-
getAddresses
public String[] getAddresses()
- Returns:
- Ignite nodes addresses.
-
setAddresses
public void setAddresses(String... addrsStr) throws SQLException
Sets the addresses of the Ignite nodes to connect; address string format:host[:portRangeFrom[..portRangeTo]]
. Examples:- "127.0.0.1"
- "127.0.0.1:10800"
- "127.0.0.1:10800..10810"
- "mynode0.mydomain.org:10800..10810", "mynode1.mydomain.org:10800..10810", "127.0.0.1:10800"
- Parameters:
addrsStr
- Ignite nodes addresses.- Throws:
SQLException
- On invalid addresses.
-
getSchema
public String getSchema()
- Returns:
- Schema name of the connection.
-
setSchema
public void setSchema(String schema)
- Parameters:
schema
- Schema name of the connection.
-
getUrl
public String getUrl()
- Returns:
- The URL of the connection.
-
setUrl
public void setUrl(String url) throws SQLException
- Parameters:
url
- The URL of the connection.- Throws:
SQLException
- On invalid URL.
-
isDistributedJoins
public boolean isDistributedJoins()
- Returns:
- Distributed joins flag.
-
setDistributedJoins
public void setDistributedJoins(boolean distributedJoins)
- Parameters:
distributedJoins
- Distributed joins flag.
-
isEnforceJoinOrder
public boolean isEnforceJoinOrder()
- Returns:
- Enforce join order flag.
-
setEnforceJoinOrder
public void setEnforceJoinOrder(boolean enforceJoinOrder)
- Parameters:
enforceJoinOrder
- Enforce join order flag.
-
isCollocated
public boolean isCollocated()
- Returns:
- Collocated flag.
-
setCollocated
public void setCollocated(boolean collocated)
- Parameters:
collocated
- Collocated flag.
-
isReplicatedOnly
public boolean isReplicatedOnly()
- Returns:
- Replicated only flag.
-
setReplicatedOnly
public void setReplicatedOnly(boolean replicatedOnly)
- Parameters:
replicatedOnly
- Replicated only flag.
-
isAutoCloseServerCursor
public boolean isAutoCloseServerCursor()
- Returns:
- Auto close server cursors flag.
-
setAutoCloseServerCursor
public void setAutoCloseServerCursor(boolean autoCloseServerCursor)
- Parameters:
autoCloseServerCursor
- Auto close server cursors flag.
-
getSocketSendBuffer
public int getSocketSendBuffer()
- Returns:
- Socket send buffer size.
-
setSocketSendBuffer
public void setSocketSendBuffer(int size) throws SQLException
- Parameters:
size
- Socket send buffer size.- Throws:
SQLException
- On error.
-
getSocketReceiveBuffer
public int getSocketReceiveBuffer()
- Returns:
- Socket receive buffer size.
-
setSocketReceiveBuffer
public void setSocketReceiveBuffer(int size) throws SQLException
- Parameters:
size
- Socket receive buffer size.- Throws:
SQLException
- On error.
-
isTcpNoDelay
public boolean isTcpNoDelay()
- Returns:
- TCP no delay flag.
-
setTcpNoDelay
public void setTcpNoDelay(boolean tcpNoDelay)
- Parameters:
tcpNoDelay
- TCP no delay flag.
-
isLazy
public boolean isLazy()
- Returns:
- Lazy query execution flag.
-
setLazy
public void setLazy(boolean lazy)
- Parameters:
lazy
- Lazy query execution flag.
-
isSkipReducerOnUpdate
public boolean isSkipReducerOnUpdate()
- Returns:
- Skip reducer on update flag.
-
setSkipReducerOnUpdate
public void setSkipReducerOnUpdate(boolean skipReducerOnUpdate)
- Parameters:
skipReducerOnUpdate
- Skip reducer on update flag.
-
getSslMode
public String getSslMode()
Gets SSL connection mode.- Returns:
- Use SSL flag.
-
setSslMode
public void setSslMode(String mode)
Use SSL connection to Ignite node. In case set to"require"
SSL context must be configured.setSslClientCertificateKeyStoreUrl(java.lang.String)
property and related properties must be set up or JSSE properties must be set up (seejavax.net.ssl.keyStore
and otherjavax.net.ssl.*
properties) In case set to"disable"
plain connection is used. Available modes:"disable", "require"
. Default value is"disable"
- Parameters:
mode
- SSL mode.
-
getSslProtocol
public String getSslProtocol()
Gets protocol for secure transport.- Returns:
- SSL protocol name.
-
setSslProtocol
public void setSslProtocol(String sslProtocol)
Sets protocol for secure transport. If not specified, TLS protocol will be used. Protocols implementations supplied by JSEE: SSLv3 (SSL), TLSv1 (TLS), TLSv1.1, TLSv1.2See more at JSSE Reference Guide.
- Parameters:
sslProtocol
- SSL protocol name.
-
getCipherSuites
public String getCipherSuites()
Gets cipher suites.- Returns:
- SSL cipher suites.
-
setCipherSuites
public void setCipherSuites(String cipherSuites)
Override default cipher suites.See more at JSSE Reference Guide.
- Parameters:
cipherSuites
- SSL cipher suites.
-
getSslKeyAlgorithm
public String getSslKeyAlgorithm()
Gets algorithm that will be used to create a key manager.- Returns:
- Key manager algorithm.
-
setSslKeyAlgorithm
public void setSslKeyAlgorithm(String keyAlgorithm)
Sets key manager algorithm that will be used to create a key manager. Notice that in most cased default value suites well, however, on Android platform this value need to be set to X509. Algorithms implementations supplied by JSEE: PKIX (X509 or SunPKIX), SunX509See more at JSSE Reference Guide.
- Parameters:
keyAlgorithm
- Key algorithm name.
-
getSslClientCertificateKeyStoreUrl
public String getSslClientCertificateKeyStoreUrl()
Gets the key store URL.- Returns:
- Client certificate KeyStore URL.
-
setSslClientCertificateKeyStoreUrl
public void setSslClientCertificateKeyStoreUrl(String url)
Sets path to the key store file. This is a mandatory parameter since ssl context could not be initialized without key manager. In casegetSslMode()
isrequired
and key store URL isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.keyStore
will be used.- Parameters:
url
- Client certificate KeyStore URL.
-
getSslClientCertificateKeyStorePassword
public String getSslClientCertificateKeyStorePassword()
Gets key store password.- Returns:
- Client certificate KeyStore password.
-
setSslClientCertificateKeyStorePassword
public void setSslClientCertificateKeyStorePassword(String passwd)
Sets key store password. In casegetSslMode()
isrequired
and key store password isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.keyStorePassword
will be used.- Parameters:
passwd
- Client certificate KeyStore password.
-
getSslClientCertificateKeyStoreType
public String getSslClientCertificateKeyStoreType()
Gets key store type used for context creation.- Returns:
- Client certificate KeyStore type.
-
setSslClientCertificateKeyStoreType
public void setSslClientCertificateKeyStoreType(String ksType)
Sets key store type used in context initialization. In casegetSslMode()
isrequired
and key store type isn't specified by Ignite properties (e.g. at JDBC URL)the JSSE propertyjavax.net.ssl.keyStoreType
will be used. In case both Ignite properties and JSSE properties are not set the default 'JKS' type is used.See more at JSSE Reference Guide.
- Parameters:
ksType
- Client certificate KeyStore type.
-
getSslTrustCertificateKeyStoreUrl
public String getSslTrustCertificateKeyStoreUrl()
Gets the trust store URL.- Returns:
- Trusted certificate KeyStore URL.
-
setSslTrustCertificateKeyStoreUrl
public void setSslTrustCertificateKeyStoreUrl(String url)
Sets path to the trust store file. This is an optional parameter, however one of thesetSslTrustCertificateKeyStoreUrl(String)
,setSslTrustAll(boolean)
properties must be set. In casegetSslMode()
isrequired
and trust store URL isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.trustStore
will be used.- Parameters:
url
- Trusted certificate KeyStore URL.
-
getSslTrustCertificateKeyStorePassword
public String getSslTrustCertificateKeyStorePassword()
Gets trust store password.- Returns:
- Trusted certificate KeyStore password.
-
setSslTrustCertificateKeyStorePassword
public void setSslTrustCertificateKeyStorePassword(String passwd)
Sets trust store password. In casegetSslMode()
isrequired
and trust store password isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.trustStorePassword
will be used.- Parameters:
passwd
- Trusted certificate KeyStore password.
-
getSslTrustCertificateKeyStoreType
public String getSslTrustCertificateKeyStoreType()
Gets trust store type.- Returns:
- Trusted certificate KeyStore type.
-
setSslTrustCertificateKeyStoreType
public void setSslTrustCertificateKeyStoreType(String ksType)
Sets trust store type. In casegetSslMode()
isrequired
and trust store type isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.trustStoreType
will be used. In case both Ignite properties and JSSE properties are not set the default 'JKS' type is used.- Parameters:
ksType
- Trusted certificate KeyStore type.
-
isSslTrustAll
public boolean isSslTrustAll()
Gets trust any server certificate flag.- Returns:
- Trust all certificates flag.
-
setSslTrustAll
public void setSslTrustAll(boolean trustAll)
Sets totrue
to trust any server certificate (revoked, expired or self-signed SSL certificates).Defaults is
false
. Note: Do not enable this option in production you are ever going to use on a network you do not entirely trust. Especially anything going over the public internet.- Parameters:
trustAll
- Trust all certificates flag.
-
getSslFactory
public String getSslFactory()
Gets the class name of the custom implementation of the Factory<SSLSocketFactory>.- Returns:
- Custom class name that implements Factory<SSLSocketFactory>.
-
setSslFactory
public void setSslFactory(String sslFactory)
Sets the class name of the custom implementation of the Factory<SSLSocketFactory>. IfgetSslMode()
isrequired
and factory is specified the custom factory will be used instead of JSSE socket factory. So, other SSL properties will be ignored.- Parameters:
sslFactory
- Custom class name that implements Factory<SSLSocketFactory>.
-
setUsername
public void setUsername(String name)
- Parameters:
name
- User name to authentication.
-
getUsername
public String getUsername()
- Returns:
- User name to authentication.
-
setPassword
public void setPassword(String passwd)
- Parameters:
passwd
- User's password.
-
getPassword
public String getPassword()
- Returns:
- User's password.
-
-