mondrian.calc
Class ExpCompiler.Factory

java.lang.Object
  extended by mondrian.util.ObjectFactory<ExpCompiler>
      extended by mondrian.calc.ExpCompiler.Factory
Enclosing interface:
ExpCompiler

public static final class ExpCompiler.Factory
extends ObjectFactory<ExpCompiler>

The ExpCompiler.Factory is used to access ExpCompiler implementations. Each call returns a new instance. This factory supports overriding the default instance by use of a ThreadLocal and by defining a System property with the ExpCompiler class name.

 

Nested Class Summary
static class ExpCompiler.Factory.Context
          The ExpCompiler only has two override mechanisms: the ThreadLocal and System Properties.
 
Nested classes/interfaces inherited from class mondrian.util.ObjectFactory
ObjectFactory.Singleton<T>
 
Method Summary
static void clearThreadLocalClassName()
          Clears the class name (regardless of whether a class name was set).
protected  String getClassName()
          Get the class name set in the ThreadLocal or null.
protected  ExpCompiler getDefault(Class[] parameterTypes, Object[] parameterValues)
          The ExpCompiler.Factory's implementation of the ObjectFactory's abstract method which returns the default ExpCompiler instance.
static ExpCompiler getExpCompiler(Evaluator evaluator, Validator validator)
          Create a ExpCompiler instance, each call returns a new compiler.
static ExpCompiler getExpCompiler(Evaluator evaluator, Validator validator, List<ResultStyle> resultStyles)
           
static ExpCompiler.Factory getFactory()
          Get the underlying Factory object.
protected  StringProperty getStringProperty()
          Return the ExpCompiler.Factory
static String getThreadLocalClassName()
          Get the class name of a ExpCompiler implementation or null.
 Object removeContext()
          Get the current override contect.
 void restoreContext(Object context)
          Restore the current overrides.
static void setThreadLocalClassName(String className)
          Sets the class name of a ExpCompiler implementation.
 
Methods inherited from class mondrian.util.ObjectFactory
defaultCreationException, getClassName, getObject, getObject, getObject, getObject, getObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getExpCompiler

public static ExpCompiler getExpCompiler(Evaluator evaluator,
                                         Validator validator)
                                  throws CreationException
Create a ExpCompiler instance, each call returns a new compiler.

Throws:
CreationException - if the compiler can not be created
Parameters:
evaluator - the Evaluator to use with the compiler
validator - the Validator to use with the compiler
Returns:
the new ExpCompiler compiler

getExpCompiler

public static ExpCompiler getExpCompiler(Evaluator evaluator,
                                         Validator validator,
                                         List<ResultStyle> resultStyles)
                                  throws CreationException
Throws:
CreationException - if the compiler can not be created
Parameters:
evaluator - the Evaluator to use with the compiler
validator - the Validator to use with the compiler
resultStyles - the initial ResultStyle array for the compiler
Returns:
the new ExpCompiler compiler

getThreadLocalClassName

public static String getThreadLocalClassName()
Get the class name of a ExpCompiler implementation or null.

Returns:
the class name or null.

setThreadLocalClassName

public static void setThreadLocalClassName(String className)
Sets the class name of a ExpCompiler implementation. This should be called (obviously) before calling the ExpCompiler.Factory getExpCompiler method to get the ExpCompiler implementation. Generally, this is only used for testing.

Parameters:
className - Class name

clearThreadLocalClassName

public static void clearThreadLocalClassName()
Clears the class name (regardless of whether a class name was set). When a class name is set using setThreadLocalClassName, the setting whould be done in a try-block and a call to this clear method should be in the finally-clause of that try-block.


getClassName

protected String getClassName()
Get the class name set in the ThreadLocal or null.

Overrides:
getClassName in class ObjectFactory<ExpCompiler>
Returns:
class name or null.

getStringProperty

protected StringProperty getStringProperty()
Return the ExpCompiler.Factory
Specified by:
getStringProperty in class ObjectFactory<ExpCompiler>
Returns:
ExpCompiler.Factory property name

getDefault

protected ExpCompiler getDefault(Class[] parameterTypes,
                                 Object[] parameterValues)
                          throws CreationException
The ExpCompiler.Factory's implementation of the ObjectFactory's abstract method which returns the default ExpCompiler instance.

Specified by:
getDefault in class ObjectFactory<ExpCompiler>
Throws:
CreationException - if the ExpCompiler can not be created.
Parameters:
parameterTypes - array of classes: Evaluator, Validator and ResultStyle
parameterValues - the Evaluator, Validator and ResultStyle values
Returns:
ExpCompiler instance

getFactory

public static ExpCompiler.Factory getFactory()
Get the underlying Factory object.

This is for testing only.

Returns:
the ExpCompiler.Factory object

removeContext

public Object removeContext()
Get the current override contect.

This is for testing only.

Overrides:
removeContext in class ObjectFactory<ExpCompiler>
Returns:
the override context object.

restoreContext

public void restoreContext(Object context)
Restore the current overrides.

This is for testing only.

Overrides:
restoreContext in class ObjectFactory<ExpCompiler>
Parameters:
context - the current override object.

SourceForge.net_Logo