Class ConfigurationDBAdapter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionUse the configuration specified in an application resource namedesper.cfg.xml
.Use the ConfigurationDBAdapter specified in the given application file.Use the ConfigurationDBAdapter specified in the given application resource.Use the ConfigurationDBAdapter specified by the given URL.Use the ConfigurationDBAdapter specified by the given XML String.protected static InputStream
getConfigurationInputStream
(String resource) Get the ConfigurationDBAdapter file as anInputStream
.protected static InputStream
getResourceAsStream
(String resource) Returns an input stream from an application resource in the classpath.void
setDmlQueries
(List<DMLQuery> dmlQueries) void
setExecutors
(Map<String, Executor> executors) void
setJdbcConnections
(Map<String, com.espertech.esper.common.client.configuration.common.ConfigurationCommonDBRef> jdbcConnections) void
setUpsertQueries
(List<UpsertQuery> upsertQueries)
-
Constructor Details
-
ConfigurationDBAdapter
public ConfigurationDBAdapter()
-
-
Method Details
-
getJdbcConnections
-
setJdbcConnections
-
getDmlQueries
-
setDmlQueries
-
getUpsertQueries
-
setUpsertQueries
-
getExecutors
-
setExecutors
-
configure
Use the configuration specified in an application resource namedesper.cfg.xml
.- Returns:
- Configuration initialized from the resource
- Throws:
RuntimeException
- thrown to indicate error reading configuration
-
configure
Use the ConfigurationDBAdapter specified in the given application resource. The format of the resource is defined inesper-configuration-(version).xsd
.\The resource is found via
SeegetConfigurationInputStream(resource)
. That method can be overridden to implement an arbitrary lookup strategy.getResourceAsStream
for information on how the resource name is resolved.- Parameters:
resource
- if the file name of the resource- Returns:
- ConfigurationDBAdapter initialized from the resource
- Throws:
RuntimeException
- thrown to indicate error reading configuration
-
getConfigurationInputStream
Get the ConfigurationDBAdapter file as anInputStream
. Might be overridden by subclasses to allow the ConfigurationDBAdapter to be located by some arbitrary mechanism.See
getResourceAsStream
for information on how the resource name is resolved.- Parameters:
resource
- is the resource name- Returns:
- input stream for resource
- Throws:
RuntimeException
- thrown to indicate error reading configuration
-
configureFromString
Use the ConfigurationDBAdapter specified by the given XML String. The format of the document obtained from the URL is defined inesper-configuration-(version).xsd
.- Parameters:
xml
- XML string- Returns:
- A ConfigurationDBAdapter configured via the file
- Throws:
RuntimeException
- is thrown when the URL could not be access
-
configure
Use the ConfigurationDBAdapter specified by the given URL. The format of the document obtained from the URL is defined inesper-configuration-(version).xsd
.- Parameters:
url
- URL from which you wish to load the configuration- Returns:
- A ConfigurationDBAdapter configured via the file
- Throws:
RuntimeException
- is thrown when the URL could not be access
-
getResourceAsStream
Returns an input stream from an application resource in the classpath.The method first removes the '/' character from the resource name if the first character is '/'.
The lookup order is as follows:
If a thread context class loader exists, use
Thread.currentThread().getResourceAsStream
to obtain an InputStream.If no input stream was returned, use the
Configuration.class.getResourceAsStream
. to obtain an InputStream.If no input stream was returned, use the
Configuration.class.getClassLoader().getResourceAsStream
. to obtain an InputStream.If no input stream was returned, throw an Exception.
- Parameters:
resource
- to get input stream for- Returns:
- input stream for resource
-
configure
Use the ConfigurationDBAdapter specified in the given application file. The format of the file is defined inesper-configuration-(version).xsd
.- Parameters:
configFile
-File
from which you wish to load the configuration- Returns:
- A ConfigurationDBAdapter configured via the file
- Throws:
RuntimeException
- when the file could not be found
-