|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.esper.client.Configuration
public class Configuration
An instance of Configuration allows the application
to specify properties to be used when
creating a EPServiceProvider. Usually an application will create
a single Configuration, then get one or more instances of
EPServiceProvider
via EPServiceProviderManager
.
The Configuration is meant
only as an initialization-time object. EPServiceProviders are
immutable and do not retain any association back to the
Configuration.
The format of an Esper XML configuration file is defined in
esper-configuration-1.0.xsd.
Field Summary | |
---|---|
protected static java.lang.String |
ESPER_DEFAULT_CONFIG
Default name of the configuration file. |
protected java.util.Map<java.lang.String,java.lang.String> |
eventClasses
Map of event name and fully-qualified Java class name. |
protected java.util.Map<java.lang.String,ConfigurationEventTypeXMLDOM> |
eventTypesXMLDOM
Map of event name and fully-qualified Java class name. |
protected java.util.List<java.lang.String> |
imports
The java-style class and package name imports that will be used to resolve partial class names. |
protected java.util.Map<java.lang.String,java.util.Properties> |
mapAliases
The type aliases for events that result when maps are sent into the engine. |
Constructor Summary | |
---|---|
Configuration()
Constructs an empty configuration. |
Method Summary | |
---|---|
void |
addEventTypeAlias(java.lang.String eventTypeAlias,
ConfigurationEventTypeXMLDOM xmlDOMEventTypeDesc)
Add an alias for an event type that represents org.w3c.dom.Node events. |
void |
addEventTypeAlias(java.lang.String eventTypeAlias,
java.util.Properties typeMap)
Add an alias for an event type that represents java.util.Map events. |
void |
addEventTypeAlias(java.lang.String eventTypeAlias,
java.lang.String javaEventClass)
Add an alias for an event type represented by Java-bean plain-old Java object events. |
void |
addImport(java.lang.String autoImport)
Add an import (a class or package). |
Configuration |
configure()
Use the configuration specified in an application resource named esper.cfg.xml. |
Configuration |
configure(org.w3c.dom.Document document)
Use the mappings and properties specified in the given XML document. |
Configuration |
configure(java.io.File configFile)
Use the configuration specified in the given application file. |
Configuration |
configure(java.lang.String resource)
Use the configuration specified in the given application resource. |
Configuration |
configure(java.net.URL url)
Use the configuration specified by the given URL. |
protected java.io.InputStream |
getConfigurationInputStream(java.lang.String resource)
Get the configuration file as an InputStream. |
java.util.Map<java.lang.String,java.lang.String> |
getEventTypeAliases()
Returns the mapping of event type alias to Java class name. |
java.util.Map<java.lang.String,java.util.Properties> |
getEventTypesMapEvents()
Returns a map keyed by event type alias name, and values being the definition for the event type of the property names and types that make up the event. |
java.util.Map<java.lang.String,ConfigurationEventTypeXMLDOM> |
getEventTypesXMLDOM()
Returns the mapping of event type alias to XML DOM event type information. |
java.util.List<java.lang.String> |
getImports()
Returns the class and package imports. |
protected static java.io.InputStream |
getResourceAsStream(java.lang.String resource)
Returns an input stream from an application resource in the classpath. |
protected void |
reset()
Reset to an empty configuration. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String ESPER_DEFAULT_CONFIG
protected java.util.Map<java.lang.String,java.lang.String> eventClasses
protected java.util.Map<java.lang.String,ConfigurationEventTypeXMLDOM> eventTypesXMLDOM
protected java.util.Map<java.lang.String,java.util.Properties> mapAliases
protected java.util.List<java.lang.String> imports
Constructor Detail |
---|
public Configuration()
Method Detail |
---|
public void addEventTypeAlias(java.lang.String eventTypeAlias, java.lang.String javaEventClass)
eventTypeAlias
- is the alias for the event typejavaEventClass
- fully-qualified class name of the event typepublic void addEventTypeAlias(java.lang.String eventTypeAlias, java.util.Properties typeMap)
eventTypeAlias
- is the alias for the event typetypeMap
- maps the name of each property in the Map event to the type (as a string) of its value in the Map objectpublic void addEventTypeAlias(java.lang.String eventTypeAlias, ConfigurationEventTypeXMLDOM xmlDOMEventTypeDesc)
eventTypeAlias
- is the alias for the event typexmlDOMEventTypeDesc
- descriptor containing property and mapping information for XML-DOM eventspublic void addImport(java.lang.String autoImport)
autoImport
- - the import to addpublic java.util.Map<java.lang.String,java.lang.String> getEventTypeAliases()
public java.util.Map<java.lang.String,java.util.Properties> getEventTypesMapEvents()
public java.util.Map<java.lang.String,ConfigurationEventTypeXMLDOM> getEventTypesXMLDOM()
public java.util.List<java.lang.String> getImports()
public Configuration configure() throws EPException
EPException
- thrown to indicate error reading configurationpublic Configuration configure(java.lang.String resource) throws EPException
resource
- if the file name of the resource
EPException
- thrown to indicate error reading configurationprotected java.io.InputStream getConfigurationInputStream(java.lang.String resource) throws EPException
See getResourceAsStream for information on how the resource name is resolved.
resource
- is the resource name
EPException
- thrown to indicate error reading configurationpublic Configuration configure(java.net.URL url) throws EPException
url
- URL from which you wish to load the configuration
EPException
public Configuration configure(java.io.File configFile) throws EPException
configFile
- File from which you wish to load the configuration
EPException
public Configuration configure(org.w3c.dom.Document document) throws EPException
document
- an XML document from which you wish to load the configuration
EPException
- if there is problem in accessing the document.protected 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 for
protected void reset()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |