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 java.lang.Object
implements EngineImportService

Implementation for engine-level imports.


Field Summary
 
Fields inherited from interface com.espertech.esper.epl.core.EngineImportService
EXT_SINGLEROW_FUNCTION_TRANSPOSE
 
Constructor Summary
EngineImportServiceImpl(boolean allowExtendedAggregationFunc, boolean isUdfCache, boolean isDuckType, boolean sortUsingCollator, java.math.MathContext optionalDefaultMathContext)
          Ctor
 
Method Summary
 void addAggregation(java.lang.String functionName, ConfigurationPlugInAggregationFunction aggregationDesc)
          Add an aggregation function.
 void addAggregationMultiFunction(ConfigurationPlugInAggregationMultiFunction desc)
           
 void addImport(java.lang.String importName)
          Add an import, such as "com.mypackage.*" or "com.mypackage.MyClass".
 void addMethodRefs(java.util.Map<java.lang.String,ConfigurationMethodRef> configs)
          Adds cache configs for method invocations for from-clause.
 void addSingleRow(java.lang.String functionName, java.lang.String singleRowFuncClass, java.lang.String methodName, ConfigurationPlugInSingleRowFunction.ValueCache valueCache, ConfigurationPlugInSingleRowFunction.FilterOptimizable filterOptimizable, boolean rethrowExceptions)
          Add an single-row function.
 ConfigurationMethodRef getConfigurationMethodRef(java.lang.String className)
          Returns the method invocation caches for the from-clause for a class.
 java.math.MathContext getDefaultMathContext()
           
protected  java.lang.String[] getImports()
          For testing, returns imports.
 boolean isDuckType()
           
 boolean isSortUsingCollator()
           
 boolean isUdfCache()
           
 ExprNode resolveAggExtendedBuiltin(java.lang.String name, boolean isDistinct)
          Resolve an extended (non-SQL std) builtin aggregation.
 AggregationFunctionFactory resolveAggregationFactory(java.lang.String name)
          Used at statement compile-time to try and resolve a given function name into an aggregation method.
 ConfigurationPlugInAggregationMultiFunction resolveAggregationMultiFunction(java.lang.String name)
           
 java.lang.Class resolveAnnotation(java.lang.String className)
          Resolves a given class name, either fully qualified and simple and imported to a annotation.
 java.lang.Class resolveClass(java.lang.String className)
          Resolves a given class name, either fully qualified and simple and imported to a class.
protected  java.lang.Class resolveClassInternal(java.lang.String className, boolean requireAnnotation)
          Finds a class by class name using the auto-import information provided.
 java.lang.reflect.Constructor resolveCtor(java.lang.Class clazz, java.lang.Class[] paramTypes)
          Resolves a constructor matching list of parameter types.
 java.lang.reflect.Method resolveMethod(java.lang.Class clazz, java.lang.String methodName, java.lang.Class[] paramTypes, boolean[] allowEventBeanType, boolean[] allowEventBeanCollType)
          Resolves a given method name and list of parameter types to an instance or static method exposed by the given class.
 java.lang.reflect.Method resolveMethod(java.lang.String className, java.lang.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.
 java.lang.reflect.Method resolveMethod(java.lang.String className, java.lang.String methodName, java.lang.Class[] paramTypes, boolean[] allowEventBeanType, boolean[] allowEventBeanCollType)
          Resolves a given class, method and list of parameter types to a static method.
 java.lang.reflect.Method resolveNonStaticMethod(java.lang.Class clazz, java.lang.String methodName)
          Resolves a given class and method name to a non-static method, expecting the method to exist exactly once and not be overloaded, with any parameters.
 Pair<java.lang.Class,EngineImportSingleRowDesc> resolveSingleRow(java.lang.String name)
          Used at statement compile-time to try and resolve a given function name into an single-row function.
 ExprNode resolveSingleRowExtendedBuiltin(java.lang.String name)
          Resolve an extended (non-SQL std) single-row function.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EngineImportServiceImpl

public EngineImportServiceImpl(boolean allowExtendedAggregationFunc,
                               boolean isUdfCache,
                               boolean isDuckType,
                               boolean sortUsingCollator,
                               java.math.MathContext optionalDefaultMathContext)
Ctor

Parameters:
allowExtendedAggregationFunc - true to allow non-SQL standard builtin agg functions.
Method Detail

isUdfCache

public boolean isUdfCache()
Specified by:
isUdfCache in interface EngineImportService

isDuckType

public boolean isDuckType()
Specified by:
isDuckType in interface EngineImportService

getConfigurationMethodRef

public ConfigurationMethodRef getConfigurationMethodRef(java.lang.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(java.util.Map<java.lang.String,ConfigurationMethodRef> configs)
Adds cache configs for method invocations for from-clause.

Parameters:
configs - cache configs

addImport

public void addImport(java.lang.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(java.lang.String functionName,
                           ConfigurationPlugInAggregationFunction aggregationDesc)
                    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.
aggregationDesc - is the descriptor for the aggregation function
Throws:
EngineImportException - throw if format or information is invalid

addSingleRow

public void addSingleRow(java.lang.String functionName,
                         java.lang.String singleRowFuncClass,
                         java.lang.String methodName,
                         ConfigurationPlugInSingleRowFunction.ValueCache valueCache,
                         ConfigurationPlugInSingleRowFunction.FilterOptimizable filterOptimizable,
                         boolean rethrowExceptions)
                  throws EngineImportException
Description copied from interface: EngineImportService
Add an single-row function.

Specified by:
addSingleRow in interface EngineImportService
Parameters:
functionName - is the name of the function to make known.
singleRowFuncClass - is the class that provides the single row function
methodName - is the name of the public static method provided by the class that provides the single row function
valueCache - setting to control value cache behavior which may cache a result value when constant parameters are passed
Throws:
EngineImportException - throw if format or information is invalid

resolveAggregationFactory

public AggregationFunctionFactory resolveAggregationFactory(java.lang.String name)
                                                     throws EngineImportUndefinedException,
                                                            EngineImportException
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:
resolveAggregationFactory in interface EngineImportService
Parameters:
name - is the function name
Returns:
aggregation provider
Throws:
EngineImportUndefinedException - if the function is not a configured aggregation function
EngineImportException - if the aggregation providing class could not be loaded or doesn't match

addAggregationMultiFunction

public void addAggregationMultiFunction(ConfigurationPlugInAggregationMultiFunction desc)
                                 throws EngineImportException
Specified by:
addAggregationMultiFunction in interface EngineImportService
Throws:
EngineImportException

resolveAggregationMultiFunction

public ConfigurationPlugInAggregationMultiFunction resolveAggregationMultiFunction(java.lang.String name)
Specified by:
resolveAggregationMultiFunction in interface EngineImportService

resolveSingleRow

public Pair<java.lang.Class,EngineImportSingleRowDesc> resolveSingleRow(java.lang.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 single-row function. Matches function name case-neutral.

Specified by:
resolveSingleRow in interface EngineImportService
Parameters:
name - is the function name
Returns:
class name and method name pair
Throws:
EngineImportException - if the function providing class could not be loaded or doesn't match
EngineImportUndefinedException - if the function is not a configured single-row function

resolveMethod

public java.lang.reflect.Method resolveMethod(java.lang.String className,
                                              java.lang.String methodName,
                                              java.lang.Class[] paramTypes,
                                              boolean[] allowEventBeanType,
                                              boolean[] allowEventBeanCollType)
                                       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:
className - 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

resolveCtor

public java.lang.reflect.Constructor resolveCtor(java.lang.Class clazz,
                                                 java.lang.Class[] paramTypes)
                                          throws EngineImportException
Description copied from interface: EngineImportService
Resolves a constructor matching list of parameter types.

Specified by:
resolveCtor in interface EngineImportService
Parameters:
clazz - is the class to use
paramTypes - is parameter types match expression sub-nodes
Returns:
method this resolves to
Throws:
EngineImportException - if the ctor cannot be resolved

resolveMethod

public java.lang.reflect.Method resolveMethod(java.lang.String className,
                                              java.lang.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:
className - 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

resolveNonStaticMethod

public java.lang.reflect.Method resolveNonStaticMethod(java.lang.Class clazz,
                                                       java.lang.String methodName)
                                                throws EngineImportException
Description copied from interface: EngineImportService
Resolves a given class and method name to a non-static method, expecting the method to exist exactly once and not be overloaded, with any parameters.

Specified by:
resolveNonStaticMethod in interface EngineImportService
Parameters:
clazz - is the class
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 java.lang.Class resolveClass(java.lang.String className)
                             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:
className - is the class name to use
Returns:
class this resolves to
Throws:
EngineImportException - if there was an error resolving the class

resolveAnnotation

public java.lang.Class resolveAnnotation(java.lang.String className)
                                  throws EngineImportException
Description copied from interface: EngineImportService
Resolves a given class name, either fully qualified and simple and imported to a annotation.

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

resolveClassInternal

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

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

resolveMethod

public java.lang.reflect.Method resolveMethod(java.lang.Class clazz,
                                              java.lang.String methodName,
                                              java.lang.Class[] paramTypes,
                                              boolean[] allowEventBeanType,
                                              boolean[] allowEventBeanCollType)
                                       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
allowEventBeanType - whether EventBean footprint is allowed
Returns:
method this resolves to
Throws:
EngineImportException - if the method cannot be resolved to a visible static or instance method

resolveSingleRowExtendedBuiltin

public ExprNode resolveSingleRowExtendedBuiltin(java.lang.String name)
Description copied from interface: EngineImportService
Resolve an extended (non-SQL std) single-row function.

Specified by:
resolveSingleRowExtendedBuiltin in interface EngineImportService
Parameters:
name - of func
Returns:
node or null

resolveAggExtendedBuiltin

public ExprNode resolveAggExtendedBuiltin(java.lang.String name,
                                          boolean isDistinct)
Description copied from interface: EngineImportService
Resolve an extended (non-SQL std) builtin aggregation.

Specified by:
resolveAggExtendedBuiltin in interface EngineImportService
Parameters:
name - of func
isDistinct - indicator
Returns:
aggregation func node

getDefaultMathContext

public java.math.MathContext getDefaultMathContext()
Specified by:
getDefaultMathContext in interface EngineImportService

isSortUsingCollator

public boolean isSortUsingCollator()
Specified by:
isSortUsingCollator in interface EngineImportService

getImports

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

Returns:
returns auto-import list as array

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com