public abstract class XADataSourceFactory extends Object
This is the singleton class used to load the OpenNMS database configuration from the opennms-database.xml. This provides convenience methods to create database connections to the database configured in this default xml
Note: Users of this class should make sure the init() is called before calling any other method to ensure the config is loaded before accessing other convenience methods
Constructor and Description |
---|
XADataSourceFactory() |
Modifier and Type | Method and Description |
---|---|
static void |
close()
close
|
static XADataSource |
getInstance()
Return the singleton instance of this factory.
|
static XADataSource |
getInstance(String name)
getInstance
|
static XADataSource |
getXADataSource()
Return the datasource configured for the database
|
static XADataSource |
getXADataSource(String dsName)
getDataSource
|
static void |
init(String dsName)
init
|
static void |
setDataSourceConfigurationFactory(DataSourceConfigurationFactory factory) |
static void |
setInstance(String dsName,
XADataSource singleton)
setInstance
|
static void |
setInstance(XADataSource ds)
setInstance
|
public static XADataSource getInstance()
Return the singleton instance of this factory. This is the instance of
the factory that was last created when the
init
or
reload
method was invoked. The instance will not change
unless a reload
method is invoked.
IllegalStateException
- Thrown if the factory has not yet been initialized.public static XADataSource getInstance(String name)
getInstance
name
- a String
object.DataSource
object.public static void setInstance(XADataSource ds)
setInstance
ds
- a DataSource
object.public static void setInstance(String dsName, XADataSource singleton)
setInstance
dsName
- a String
object.singleton
- a DataSource
object.public static XADataSource getXADataSource()
public static XADataSource getXADataSource(String dsName)
getDataSource
dsName
- a String
object.DataSource
object.public static void setDataSourceConfigurationFactory(DataSourceConfigurationFactory factory)
public static void close()
close
SQLException
- if any.Copyright © 2017. All rights reserved.