java.lang.Object
com.espertech.esper.common.client.configuration.Configuration
All Implemented Interfaces:
Serializable

public class Configuration extends Object implements Serializable
An instance of 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 Details

    • ESPER_DEFAULT_CONFIG

      protected static final String 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

      public Configuration configure() throws EPException
      Use the configuration specified in an application resource named esper.cfg.xml.
      Returns:
      Configuration initialized from the resource
      Throws:
      EPException - thrown to indicate error reading configuration
    • configure

      public Configuration configure(String resource) throws EPException
      Use the configuration specified in the given application resource. The format of the resource is defined in esper-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

      protected static InputStream getConfigurationInputStream(String resource) throws EPException
      Get the configuration file as an InputStream. 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

      public Configuration configure(URL url) throws EPException
      Use the configuration specified by the given URL. The format of the document obtained from the URL is defined in esper-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

      public Configuration configure(File configFile) throws EPException
      Use the configuration specified in the given application file. The format of the file is defined in esper-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

      public Configuration configure(Document document) throws EPException
      Use the mappings and properties specified in the given XML document. The format of the file is defined in esper-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

      protected static InputStream getResourceAsStream(String resource)
      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

      public ConfigurationCommon 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

      public void setCommon(ConfigurationCommon common)
      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

      public ConfigurationCompiler 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

      public void setCompiler(ConfigurationCompiler compiler)
      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

      public ConfigurationRuntime 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

      public void setRuntime(ConfigurationRuntime runtime)
      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 StateMgmtSettingsProvider internalUseGetStmtMgmtProvider(StateMgmtSettingsProxy proxy)
      For internal use only: returns statement settings provider
      Parameters:
      proxy - proxy
      Returns:
      provider