Package com.ibm.fhir.persistence.proxy
Class FHIRProxyXADataSource
- java.lang.Object
-
- com.ibm.fhir.persistence.proxy.FHIRProxyXADataSource
-
- All Implemented Interfaces:
CommonDataSource
,XADataSource
public class FHIRProxyXADataSource extends Object implements XADataSource
This class serves as a proxy for creating XA connections to databases according to a properties-based configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FHIRProxyXADataSource.DataSourceCacheEntry
Internal envelope for caching data source entries
-
Constructor Summary
Constructors Constructor Description FHIRProxyXADataSource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FHIRProxyXADataSource.DataSourceCacheEntry
createDataSourceCacheEntry(String dsId)
Creates an appropriate datasource and its cache entry according to the properties associated with the specified datastore-idList<XADataSource>
getCachedDataSources()
This method returns a list of all the cached XADataSource instances held by this proxy datasource.static String
getDataSourceImplClassnameForType(String type)
Returns the XADataSource implementation classname associated with the specified type, or null if the type is not recognized.XADataSource
getDelegate()
This function will return an XADataSource instance that is configured according to the connection properties associated with the FHIRRequestContext info found on thread-local.int
getLoginTimeout()
PrintWriter
getLogWriter()
Logger
getParentLogger()
XAConnection
getXAConnection()
XAConnection
getXAConnection(String tenantId, String dsId)
void
setLoginTimeout(int seconds)
void
setLogWriter(PrintWriter out)
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
-
Methods inherited from interface javax.sql.XADataSource
createXAConnectionBuilder
-
-
-
-
Method Detail
-
getCachedDataSources
public List<XADataSource> getCachedDataSources()
This method returns a list of all the cached XADataSource instances held by this proxy datasource.
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceXADataSource
- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceXADataSource
- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int seconds) throws SQLException
- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceXADataSource
- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException
- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceXADataSource
- Throws:
SQLException
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-
getXAConnection
public XAConnection getXAConnection() throws SQLException
- Specified by:
getXAConnection
in interfaceXADataSource
- Throws:
SQLException
-
getXAConnection
public XAConnection getXAConnection(String tenantId, String dsId) throws SQLException
- Specified by:
getXAConnection
in interfaceXADataSource
- Throws:
SQLException
-
getDelegate
public XADataSource getDelegate() throws SQLException
This function will return an XADataSource instance that is configured according to the connection properties associated with the FHIRRequestContext info found on thread-local. Note: this function is declared as public for testing purposes. Normally, this function is only called internally.- Throws:
SQLException
-
getDataSourceImplClassnameForType
public static String getDataSourceImplClassnameForType(String type)
Returns the XADataSource implementation classname associated with the specified type, or null if the type is not recognized.- Parameters:
type
- the datasource type (e.g. "db2", "derby", etc.)
-
createDataSourceCacheEntry
public static FHIRProxyXADataSource.DataSourceCacheEntry createDataSourceCacheEntry(String dsId) throws Exception
Creates an appropriate datasource and its cache entry according to the properties associated with the specified datastore-id- Throws:
Exception
-
-