Class Configuration
- All Implemented Interfaces:
Serializable
Configuration
allows the application
to specify properties to be used when compiling and when getting a runtime.
The Configuration
is meant
only as an initialization-time object.
The format of an Esper XML configuration file is defined in
esper-configuration-(version).xsd
.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String
Default name of the configuration file. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionUse the configuration specified in an application resource namedesper.cfg.xml
.Use the configuration specified in the given application file.Use the configuration specified in the given application resource.Use the configuration specified by the given URL.Use the mappings and properties specified in the given XML document.Returns the common section of the configuration.Returns the compiler section of the configuration.protected static InputStream
getConfigurationInputStream
(String resource) Get the configuration file as anInputStream
.protected static InputStream
getResourceAsStream
(String resource) Returns an input stream from an application resource in the classpath.Returns the runtime section of the configuration.com.espertech.esper.common.internal.statemgmtsettings.StateMgmtSettingsProvider
internalUseGetStmtMgmtProvider
(com.espertech.esper.common.internal.statemgmtsettings.StateMgmtSettingsProxy proxy) For internal use only: returns statement settings providerprotected void
reset()
Reset to an empty configuration.void
setCommon
(ConfigurationCommon common) Sets the common section of the configuration.void
setCompiler
(ConfigurationCompiler compiler) Sets the compiler section of the configuration.void
setRuntime
(ConfigurationRuntime runtime) Sets the runtime section of the configuration.
-
Field Details
-
ESPER_DEFAULT_CONFIG
Default name of the configuration file.- See Also:
-
-
Constructor Details
-
Configuration
public Configuration()Constructs an empty configuration. The auto import values are set by default to java.lang, java.math, java.text and java.util.
-
-
Method Details
-
configure
Use the configuration specified in an application resource namedesper.cfg.xml
.- Returns:
- Configuration initialized from the resource
- Throws:
EPException
- thrown to indicate error reading configuration
-
configure
Use the configuration specified in the given application resource. The format of the resource is defined inesper-configuration-(version).xsd
.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.- Parameters:
resource
- if the file name of the resource- Returns:
- Configuration initialized from the resource
- Throws:
EPException
- thrown to indicate error reading configuration
-
getConfigurationInputStream
Get the configuration file as anInputStream
. Might be overridden by subclasses to allow the configuration 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:
EPException
- thrown to indicate error reading configuration
-
configure
Use the configuration 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 configuration configured via the file
- Throws:
EPException
- is thrown when the URL could not be access
-
configure
Use the configuration 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 configuration configured via the file
- Throws:
EPException
- when the file could not be found
-
configure
Use the mappings and properties specified in the given XML document. The format of the file is defined inesper-configuration-(version).xsd
.- Parameters:
document
- an XML document from which you wish to load the configuration- Returns:
- A configuration configured via the
Document
- Throws:
EPException
- if there is problem in accessing the document.
-
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
-
getCommon
Returns the common section of the configuration.The common section is for use by both the compiler and the runtime.
- Returns:
- common configuration
-
setCommon
Sets the common section of the configuration.The common section is for use by both the compiler and the runtime.
- Parameters:
common
- common configuration
-
getCompiler
Returns the compiler section of the configuration.The compiler section is for use by the compiler. The runtime ignores this part of the configuration object.
- Returns:
- compiler configuration
-
setCompiler
Sets the compiler section of the configuration.The compiler section is for use by the compiler. The runtime ignores this part of the configuration object.
- Parameters:
compiler
- compiler configuration
-
getRuntime
Returns the runtime section of the configuration.The runtime section is for use by the runtime. The compiler ignores this part of the configuration object.
- Returns:
- runtime configuration
-
setRuntime
Sets the runtime section of the configuration.The runtime section is for use by the runtime. The compiler ignores this part of the configuration object.
- Parameters:
runtime
- runtime configuration
-
reset
protected void reset()Reset to an empty configuration. -
internalUseGetStmtMgmtProvider
public com.espertech.esper.common.internal.statemgmtsettings.StateMgmtSettingsProvider internalUseGetStmtMgmtProvider(com.espertech.esper.common.internal.statemgmtsettings.StateMgmtSettingsProxy proxy) For internal use only: returns statement settings provider- Parameters:
proxy
- proxy- Returns:
- provider
-