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()StringgetCipherSuites()Gets cipher suites.ConnectiongetConnection()ConnectiongetConnection(String username, String pwd)intgetLoginTimeout()PrintWritergetLogWriter()LoggergetParentLogger()StringgetPassword()StringgetSchema()intgetSocketReceiveBuffer()intgetSocketSendBuffer()StringgetSslClientCertificateKeyStorePassword()Gets key store password.StringgetSslClientCertificateKeyStoreType()Gets key store type used for context creation.StringgetSslClientCertificateKeyStoreUrl()Gets the key store URL.StringgetSslFactory()Gets the class name of the custom implementation of the Factory<SSLSocketFactory>.StringgetSslKeyAlgorithm()Gets algorithm that will be used to create a key manager.StringgetSslMode()Gets SSL connection mode.StringgetSslProtocol()Gets protocol for secure transport.StringgetSslTrustCertificateKeyStorePassword()Gets trust store password.StringgetSslTrustCertificateKeyStoreType()Gets trust store type.StringgetSslTrustCertificateKeyStoreUrl()Gets the trust store URL.StringgetUrl()StringgetURL()Different application servers us different format (URL & url).StringgetUsername()booleanisAutoCloseServerCursor()booleanisCollocated()booleanisDistributedJoins()booleanisEnforceJoinOrder()booleanisLazy()booleanisReplicatedOnly()booleanisSkipReducerOnUpdate()booleanisSslTrustAll()Gets trust any server certificate flag.booleanisTcpNoDelay()booleanisWrapperFor(Class<?> iface)voidsetAddresses(String... addrsStr)Sets the addresses of the Ignite nodes to connect; address string format:host[:portRangeFrom[..portRangeTo]].voidsetAutoCloseServerCursor(boolean autoCloseServerCursor)voidsetCipherSuites(String cipherSuites)Override default cipher suites.voidsetCollocated(boolean collocated)voidsetDistributedJoins(boolean distributedJoins)voidsetEnforceJoinOrder(boolean enforceJoinOrder)voidsetLazy(boolean lazy)voidsetLoginTimeout(int seconds)voidsetLogWriter(PrintWriter out)voidsetPassword(String passwd)voidsetReplicatedOnly(boolean replicatedOnly)voidsetSchema(String schema)voidsetSkipReducerOnUpdate(boolean skipReducerOnUpdate)voidsetSocketReceiveBuffer(int size)voidsetSocketSendBuffer(int size)voidsetSslClientCertificateKeyStorePassword(String passwd)Sets key store password.voidsetSslClientCertificateKeyStoreType(String ksType)Sets key store type used in context initialization.voidsetSslClientCertificateKeyStoreUrl(String url)Sets path to the key store file.voidsetSslFactory(String sslFactory)Sets the class name of the custom implementation of the Factory<SSLSocketFactory>.voidsetSslKeyAlgorithm(String keyAlgorithm)Sets key manager algorithm that will be used to create a key manager.voidsetSslMode(String mode)Use SSL connection to Ignite node.voidsetSslProtocol(String sslProtocol)Sets protocol for secure transport.voidsetSslTrustAll(boolean trustAll)Sets totrueto trust any server certificate (revoked, expired or self-signed SSL certificates).voidsetSslTrustCertificateKeyStorePassword(String passwd)Sets trust store password.voidsetSslTrustCertificateKeyStoreType(String ksType)Sets trust store type.voidsetSslTrustCertificateKeyStoreUrl(String url)Sets path to the trust store file.voidsetTcpNoDelay(boolean tcpNoDelay)voidsetUrl(String url)voidsetURL(String url)Different application servers us different format (URL & url).voidsetUsername(String name)<T> Tunwrap(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:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
public Connection getConnection(String username, String pwd) throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin 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.keyStoreand 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()isrequiredand key store URL isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.keyStorewill 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()isrequiredand key store password isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.keyStorePasswordwill 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()isrequiredand key store type isn't specified by Ignite properties (e.g. at JDBC URL)the JSSE propertyjavax.net.ssl.keyStoreTypewill 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()isrequiredand trust store URL isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.trustStorewill 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()isrequiredand trust store password isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.trustStorePasswordwill 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()isrequiredand trust store type isn't specified by Ignite properties (e.g. at JDBC URL) the JSSE propertyjavax.net.ssl.trustStoreTypewill 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 totrueto 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()isrequiredand 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.
-
-