Package herddb.jdbc
Class BasicHerdDBDataSource
- java.lang.Object
-
- herddb.jdbc.BasicHerdDBDataSource
-
- All Implemented Interfaces:
java.lang.AutoCloseable,java.sql.Wrapper,javax.sql.CommonDataSource,javax.sql.DataSource
- Direct Known Subclasses:
HerdDBDataSource,HerdDBEmbeddedDataSource,HerdDBWrappingDataSource
public class BasicHerdDBDataSource extends java.lang.Object implements javax.sql.DataSource, java.lang.AutoCloseableHerdDB DataSource- Author:
- enrico.olivelli
-
-
Field Summary
Fields Modifier and Type Field Description protected herddb.client.HDBClientclientprotected java.lang.StringdefaultSchemaprotected intloginTimeoutprotected intmaxActiveprotected java.util.Propertiespropertiesprotected java.lang.Stringurl
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasicHerdDBDataSource()BasicHerdDBDataSource(herddb.client.HDBClient client)
-
Method Summary
Modifier and Type Method Description voidclose()protected voiddoWaitForTableSpace()protected voidensureClient()protected voidensureConnection()herddb.client.HDBClientgetClient()java.sql.ConnectiongetConnection()java.sql.ConnectiongetConnection(java.lang.String username, java.lang.String password)java.lang.StringgetDefaultSchema()intgetLoginTimeout()java.io.PrintWritergetLogWriter()intgetMaxActive()java.util.logging.LoggergetParentLogger()java.lang.StringgetPassword()java.util.PropertiesgetProperties()java.lang.StringgetUrl()java.lang.StringgetUsername()java.lang.StringgetWaitForTableSpace()intgetWaitForTableSpaceTimeout()booleanisDiscoverTableSpaceFromQuery()booleanisWrapperFor(java.lang.Class<?> iface)voidsetClient(herddb.client.HDBClient client)voidsetDefaultSchema(java.lang.String defaultSchema)voidsetDiscoverTableSpaceFromQuery(boolean discoverTableSpaceFromQuery)voidsetLoginTimeout(int seconds)voidsetLogWriter(java.io.PrintWriter out)voidsetMaxActive(int maxActive)voidsetPassword(java.lang.String password)voidsetUrl(java.lang.String url)voidsetUsername(java.lang.String username)voidsetWaitForTableSpace(java.lang.String waitForTableSpace)voidsetWaitForTableSpaceTimeout(int waitForTableSpaceTimeout)<T> Tunwrap(java.lang.Class<T> iface)
-
-
-
Method Detail
-
getWaitForTableSpaceTimeout
public int getWaitForTableSpaceTimeout()
-
setWaitForTableSpaceTimeout
public void setWaitForTableSpaceTimeout(int waitForTableSpaceTimeout)
-
getWaitForTableSpace
public java.lang.String getWaitForTableSpace()
-
setWaitForTableSpace
public void setWaitForTableSpace(java.lang.String waitForTableSpace)
-
isDiscoverTableSpaceFromQuery
public boolean isDiscoverTableSpaceFromQuery()
-
setDiscoverTableSpaceFromQuery
public void setDiscoverTableSpaceFromQuery(boolean discoverTableSpaceFromQuery)
-
getMaxActive
public int getMaxActive()
-
setMaxActive
public void setMaxActive(int maxActive)
-
getDefaultSchema
public java.lang.String getDefaultSchema()
-
setDefaultSchema
public void setDefaultSchema(java.lang.String defaultSchema)
-
getUsername
public java.lang.String getUsername()
-
setUsername
public void setUsername(java.lang.String username)
-
getPassword
public java.lang.String getPassword()
-
setPassword
public void setPassword(java.lang.String password)
-
getUrl
public java.lang.String getUrl()
-
setUrl
public void setUrl(java.lang.String url)
-
getProperties
public java.util.Properties getProperties()
-
doWaitForTableSpace
protected void doWaitForTableSpace() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
ensureClient
protected void ensureClient() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
ensureConnection
protected void ensureConnection() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getClient
public herddb.client.HDBClient getClient()
-
setClient
public void setClient(herddb.client.HDBClient client)
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.DataSource- Throws:
java.sql.SQLException
-
getConnection
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.DataSource- Throws:
java.sql.SQLException
-
getLogWriter
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException- Specified by:
getLogWriterin interfacejavax.sql.CommonDataSource- Specified by:
getLogWriterin interfacejavax.sql.DataSource- Throws:
java.sql.SQLException
-
setLogWriter
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException- Specified by:
setLogWriterin interfacejavax.sql.CommonDataSource- Specified by:
setLogWriterin interfacejavax.sql.DataSource- Throws:
java.sql.SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws java.sql.SQLException- Specified by:
setLoginTimeoutin interfacejavax.sql.CommonDataSource- Specified by:
setLoginTimeoutin interfacejavax.sql.DataSource- Throws:
java.sql.SQLException
-
getLoginTimeout
public int getLoginTimeout() throws java.sql.SQLException- Specified by:
getLoginTimeoutin interfacejavax.sql.CommonDataSource- Specified by:
getLoginTimeoutin interfacejavax.sql.DataSource- Throws:
java.sql.SQLException
-
getParentLogger
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException- Specified by:
getParentLoggerin interfacejavax.sql.CommonDataSource- Throws:
java.sql.SQLFeatureNotSupportedException
-
unwrap
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException- Specified by:
unwrapin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
isWrapperFor
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException- Specified by:
isWrapperForin interfacejava.sql.Wrapper- Throws:
java.sql.SQLException
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-