public class ConfigurationDBAdapter extends 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(File configFile)
Use the ConfigurationDBAdapter specified in the given application
file.
|
ConfigurationDBAdapter |
configure(String resource)
Use the ConfigurationDBAdapter specified in the given application
resource.
|
ConfigurationDBAdapter |
configure(URL url)
Use the ConfigurationDBAdapter specified by the given URL.
|
ConfigurationDBAdapter |
configureFromString(String xml)
Use the ConfigurationDBAdapter specified by the given XML String.
|
protected static InputStream |
getConfigurationInputStream(String resource)
Get the ConfigurationDBAdapter file as an InputStream.
|
List<DMLQuery> |
getDmlQueries() |
Map<String,Executor> |
getExecutors() |
Map<String,com.espertech.esper.client.ConfigurationDBRef> |
getJdbcConnections() |
protected static InputStream |
getResourceAsStream(String resource)
Returns an input stream from an application resource in the classpath.
|
List<UpsertQuery> |
getUpsertQueries() |
void |
setDmlQueries(List<DMLQuery> dmlQueries) |
void |
setExecutors(Map<String,Executor> executors) |
void |
setJdbcConnections(Map<String,com.espertech.esper.client.ConfigurationDBRef> jdbcConnections) |
void |
setUpsertQueries(List<UpsertQuery> upsertQueries) |
public Map<String,com.espertech.esper.client.ConfigurationDBRef> getJdbcConnections()
public void setJdbcConnections(Map<String,com.espertech.esper.client.ConfigurationDBRef> jdbcConnections)
public List<UpsertQuery> getUpsertQueries()
public void setUpsertQueries(List<UpsertQuery> upsertQueries)
public ConfigurationDBAdapter configure() throws RuntimeException
RuntimeException
- thrown to indicate error reading configurationpublic ConfigurationDBAdapter configure(String resource) throws 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 resourceRuntimeException
- thrown to indicate error reading configurationprotected static InputStream getConfigurationInputStream(String resource) throws RuntimeException
See getResourceAsStream for information on how the resource name is resolved.
resource
- is the resource nameRuntimeException
- thrown to indicate error reading configurationpublic ConfigurationDBAdapter configureFromString(String xml) throws RuntimeException
xml
- XML stringRuntimeException
- is thrown when the URL could not be accesspublic ConfigurationDBAdapter configure(URL url) throws RuntimeException
url
- URL from which you wish to load the configurationRuntimeException
- is thrown when the URL could not be accessprotected static InputStream getResourceAsStream(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(File configFile) throws RuntimeException
configFile
- File from which you wish to load the configurationRuntimeException
- when the file could not be found