public class ConfigurationDBAdapter
extends java.lang.Object
Constructor and Description |
---|
ConfigurationDBAdapter() |
Modifier and Type | Method and Description |
---|---|
ConfigurationDBAdapter |
configure()
Use the configuration specified in an application
resource named esper.cfg.xml.
|
ConfigurationDBAdapter |
configure(java.io.File configFile)
Use the ConfigurationDBAdapter specified in the given application
file.
|
ConfigurationDBAdapter |
configure(java.lang.String resource)
Use the ConfigurationDBAdapter specified in the given application
resource.
|
ConfigurationDBAdapter |
configure(java.net.URL url)
Use the ConfigurationDBAdapter specified by the given URL.
|
ConfigurationDBAdapter |
configureFromString(java.lang.String xml)
Use the ConfigurationDBAdapter specified by the given XML String.
|
protected static java.io.InputStream |
getConfigurationInputStream(java.lang.String resource)
Get the ConfigurationDBAdapter file as an InputStream.
|
java.util.List<DMLQuery> |
getDmlQueries() |
java.util.Map<java.lang.String,Executor> |
getExecutors() |
java.util.Map<java.lang.String,com.espertech.esper.client.ConfigurationDBRef> |
getJdbcConnections() |
protected static java.io.InputStream |
getResourceAsStream(java.lang.String resource)
Returns an input stream from an application resource in the classpath.
|
java.util.List<UpsertQuery> |
getUpsertQueries() |
void |
setDmlQueries(java.util.List<DMLQuery> dmlQueries) |
void |
setExecutors(java.util.Map<java.lang.String,Executor> executors) |
void |
setJdbcConnections(java.util.Map<java.lang.String,com.espertech.esper.client.ConfigurationDBRef> jdbcConnections) |
void |
setUpsertQueries(java.util.List<UpsertQuery> upsertQueries) |
public java.util.Map<java.lang.String,com.espertech.esper.client.ConfigurationDBRef> getJdbcConnections()
public void setJdbcConnections(java.util.Map<java.lang.String,com.espertech.esper.client.ConfigurationDBRef> jdbcConnections)
public java.util.List<DMLQuery> getDmlQueries()
public void setDmlQueries(java.util.List<DMLQuery> dmlQueries)
public java.util.List<UpsertQuery> getUpsertQueries()
public void setUpsertQueries(java.util.List<UpsertQuery> upsertQueries)
public java.util.Map<java.lang.String,Executor> getExecutors()
public void setExecutors(java.util.Map<java.lang.String,Executor> executors)
public ConfigurationDBAdapter configure() throws java.lang.RuntimeException
java.lang.RuntimeException
- thrown to indicate error reading configurationpublic ConfigurationDBAdapter configure(java.lang.String resource) throws java.lang.RuntimeException
The resource is found via getConfigurationInputStream(resource). That method can be overridden to implement an arbitrary lookup strategy.
See getResourceAsStream for information on how the resource name is resolved.resource
- if the file name of the resourcejava.lang.RuntimeException
- thrown to indicate error reading configurationprotected static java.io.InputStream getConfigurationInputStream(java.lang.String resource) throws java.lang.RuntimeException
See getResourceAsStream for information on how the resource name is resolved.
resource
- is the resource namejava.lang.RuntimeException
- thrown to indicate error reading configurationpublic ConfigurationDBAdapter configureFromString(java.lang.String xml) throws java.lang.RuntimeException
xml
- XML stringjava.lang.RuntimeException
- is thrown when the URL could not be accesspublic ConfigurationDBAdapter configure(java.net.URL url) throws java.lang.RuntimeException
url
- URL from which you wish to load the configurationjava.lang.RuntimeException
- is thrown when the URL could not be accessprotected static java.io.InputStream getResourceAsStream(java.lang.String resource)
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.
resource
- to get input stream forpublic ConfigurationDBAdapter configure(java.io.File configFile) throws java.lang.RuntimeException
configFile
- File from which you wish to load the configurationjava.lang.RuntimeException
- when the file could not be found