net.esper.eql.core
Class EngineImportServiceImpl

java.lang.Object
  extended by net.esper.eql.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".
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.
protected  Class resolveClass(String className)
          Finds a class by class name using the auto-import information provided.
 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

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

resolveClass

protected Class resolveClass(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

getImports

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

Returns:
returns auto-import list as array