com.espertech.esper.epl.core
Class EngineImportServiceImpl

java.lang.Object
  extended by com.espertech.esper.epl.core.EngineImportServiceImpl
All Implemented Interfaces:
EngineImportService

public class EngineImportServiceImpl
extends Object
implements EngineImportService

Implementation for engine-level imports.


Constructor Summary
EngineImportServiceImpl()
          Ctor.
 
Method Summary
 void addAggregation(String functionName, String aggregationClass)
          Add an aggregation function.
 void addImport(String importName)
          Add an import, such as "com.mypackage.*" or "com.mypackage.MyClass".
 void addMethodRefs(Map<String,ConfigurationMethodRef> configs)
          Adds cache configs for method invocations for from-clause.
 ConfigurationMethodRef getConfigurationMethodRef(String className)
          Returns the method invocation caches for the from-clause for a class.
protected  String[] getImports()
          For testing, returns imports.
 AggregationSupport resolveAggregation(String name)
          Used at statement compile-time to try and resolve a given function name into an aggregation method.
 Class resolveClass(String classNameAlias)
          Resolves a given class name, either fully qualified and simple and imported to a class.
protected  Class resolveClassInternal(String className)
          Finds a class by class name using the auto-import information provided.
 Method resolveMethod(Class clazz, String methodName, Class[] paramTypes)
          Resolves a given method name and list of parameter types to an instance or static method exposed by the given class.
 Method resolveMethod(String classNameAlias, String methodName)
          Resolves a given class and method name to a static method, expecting the method to exist exactly once and not be overloaded, with any parameters.
 Method resolveMethod(String classNameAlias, String methodName, Class[] paramTypes)
          Resolves a given class, method and list of parameter types to a static method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EngineImportServiceImpl

public EngineImportServiceImpl()
Ctor.

Method Detail

getConfigurationMethodRef

public ConfigurationMethodRef getConfigurationMethodRef(String className)
Description copied from interface: EngineImportService
Returns the method invocation caches for the from-clause for a class.

Specified by:
getConfigurationMethodRef in interface EngineImportService
Parameters:
className - the class name providing the method
Returns:
cache configs

addMethodRefs

public void addMethodRefs(Map<String,ConfigurationMethodRef> configs)
Adds cache configs for method invocations for from-clause.

Parameters:
configs - cache configs

addImport

public void addImport(String importName)
               throws EngineImportException
Description copied from interface: EngineImportService
Add an import, such as "com.mypackage.*" or "com.mypackage.MyClass".

Specified by:
addImport in interface EngineImportService
Parameters:
importName - is the import to add
Throws:
EngineImportException - if the information or format is invalid

addAggregation

public void addAggregation(String functionName,
                           String aggregationClass)
                    throws EngineImportException
Description copied from interface: EngineImportService
Add an aggregation function.

Specified by:
addAggregation in interface EngineImportService
Parameters:
functionName - is the name of the function to make known.
aggregationClass - is the class that provides the aggregator
Throws:
EngineImportException - throw if format or information is invalid

resolveAggregation

public AggregationSupport resolveAggregation(String name)
                                      throws EngineImportException,
                                             EngineImportUndefinedException
Description copied from interface: EngineImportService
Used at statement compile-time to try and resolve a given function name into an aggregation method. Matches function name case-neutral.

Specified by:
resolveAggregation in interface EngineImportService
Parameters:
name - is the function name
Returns:
aggregation provider
Throws:
EngineImportException - if the aggregation providing class could not be loaded or doesn't match
EngineImportUndefinedException - if the function is not a configured aggregation function

resolveMethod

public Method resolveMethod(String classNameAlias,
                            String methodName,
                            Class[] paramTypes)
                     throws EngineImportException
Description copied from interface: EngineImportService
Resolves a given class, method and list of parameter types to a static method.

Specified by:
resolveMethod in interface EngineImportService
Parameters:
classNameAlias - is the class name to use
methodName - is the method name
paramTypes - is parameter types match expression sub-nodes
Returns:
method this resolves to
Throws:
EngineImportException - if the method cannot be resolved to a visible static method

resolveMethod

public Method resolveMethod(String classNameAlias,
                            String methodName)
                     throws EngineImportException
Description copied from interface: EngineImportService
Resolves a given class and method name to a static method, expecting the method to exist exactly once and not be overloaded, with any parameters.

Specified by:
resolveMethod in interface EngineImportService
Parameters:
classNameAlias - is the class name to use
methodName - is the method name
Returns:
method this resolves to
Throws:
EngineImportException - if the method cannot be resolved to a visible static method, or if the method is overloaded

resolveClass

public Class resolveClass(String classNameAlias)
                   throws EngineImportException
Description copied from interface: EngineImportService
Resolves a given class name, either fully qualified and simple and imported to a class.

Specified by:
resolveClass in interface EngineImportService
Parameters:
classNameAlias - is the class name to use
Returns:
class this resolves to
Throws:
EngineImportException - if there was an error resolving the class

resolveClassInternal

protected Class resolveClassInternal(String className)
                              throws ClassNotFoundException
Finds a class by class name using the auto-import information provided.

Parameters:
className - is the class name to find
Returns:
class
Throws:
ClassNotFoundException - if the class cannot be loaded

resolveMethod

public Method resolveMethod(Class clazz,
                            String methodName,
                            Class[] paramTypes)
                     throws EngineImportException
Description copied from interface: EngineImportService
Resolves a given method name and list of parameter types to an instance or static method exposed by the given class.

Specified by:
resolveMethod in interface EngineImportService
Parameters:
clazz - is the class to look for a fitting method
methodName - is the method name
paramTypes - is parameter types match expression sub-nodes
Returns:
method this resolves to
Throws:
EngineImportException - if the method cannot be resolved to a visible static or instance method

getImports

protected String[] getImports()
For testing, returns imports.

Returns:
returns auto-import list as array

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com