public class CompilationContextWrapper extends ContextWrapper<ICompilationContext> implements ICompilationContext
c
DEFAULT_COMPILE_LOGGER_NAME, DEFAULT_OPTIMIZE_LOGGER_NAME
Constructor and Description |
---|
CompilationContextWrapper(ICompilationContext c) |
Modifier and Type | Method and Description |
---|---|
void |
clearRegisteredAddons()
Clears all registered Addons.
|
void |
compile()
Convenience method to compile AND optimize the AbstractMRuleExecutionSet of this context with this context.
|
IExecutionContext |
convertToExecutionContext()
Allows to convert this compilation context to a "fake" execution context.
|
<A extends IAddon> |
getAddonInfo(A addon) |
List<IAddon> |
getAllAddons()
Gets all addons encountered during compilation process.
|
Set<IAddon> |
getAllUniqueAddons()
Gets all unique addons encountered during compilation process.
|
ICacheActivationResolver |
getCacheActivationResolver() |
CompilationLevel |
getCompilationLevel()
Returns requested
CompilationLevel |
Object |
getProperty(Object key)
Allows to retrieve properties shared between components during compilation process.
|
ICompilationContext |
getRootContext()
In case of sub context usage, this allows to access the root context.
|
static ICompilationContext |
getSubContext(ICompilationContext c,
Class<?> newReadWriteBaseType) |
static ICompilationContext |
getSubContext(ICompilationContext c,
Class<?> newReadBaseType,
Class<?> newWriteBaseType) |
static ICompilationContext |
getSubContext(ICompilationContext c,
CompilationLevel clToUse) |
static ICompilationContext |
getSubContext(ICompilationContext c,
CompilationLevel clToUse,
Class<?> newReadWriteBaseType) |
static ICompilationContext |
getSubContext(ICompilationContext c,
CompilationLevel clToUse,
Class<?> newReadBaseType,
Class<?> newWriteBaseType) |
void |
init()
INTERNAL USE ONLY: Called by rule engine to initialize and check before compilation.
|
boolean |
isCacheEnabled(String feature)
Tells if cache is enabled for a specific feature.
|
boolean |
isOptimizationEnabled()
Allows to completely disable optimization process.
|
boolean |
registerAddon(IAddon parent,
IAddon addon)
Registers any encountered
IAddon during compilation process. |
void |
registerAddonRecursively(IAddon parent,
IAddon addon)
Registers this Addon and all it's sub addons.
|
void |
removeProperty(Object key)
Allows to remove shared properties.
|
void |
setCacheActivationResolver(ICacheActivationResolver cacheActivationResolver) |
void |
setCompilationLevel(CompilationLevel compilationLevel)
CompilationLevel to use for compilation. |
void |
setOptimizationEnabled(boolean optimizationEnabled)
Is optimization process enabled?
|
void |
setPhase(Phase phase)
Sets current phase: COMPILE or OPTIMIZE.
|
void |
setProperty(Object key,
Object value)
Allows to store properties to share between components during compilation process.
|
getExecutionSet, getImports, getLog, getPhase, getReadBaseType, getSecurityManager, getVariables, getWrappedObject, getWriteBaseType, setExecutionSet, setLoggerName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getExecutionSet, getImports, getLog, getPhase, getReadBaseType, getSecurityManager, getVariables, getWriteBaseType, setExecutionSet, setLoggerName
public CompilationContextWrapper(ICompilationContext c)
public void compile() throws MRuleValidationException
ICompilationContext
compile
in interface ICompilationContext
MRuleValidationException
public void init() throws MRuleValidationException
ICompilationContext
init
in interface ICompilationContext
MRuleValidationException
public CompilationLevel getCompilationLevel()
ICompilationContext
CompilationLevel
getCompilationLevel
in interface ICompilationContext
public void setPhase(Phase phase)
ICompilationContext
setPhase
in interface ICompilationContext
public void setCompilationLevel(CompilationLevel compilationLevel)
ICompilationContext
CompilationLevel
to use for compilation.setCompilationLevel
in interface ICompilationContext
public Object getProperty(Object key)
ICompilationContext
getProperty
in interface ICompilationContext
public void setProperty(Object key, Object value)
ICompilationContext
setProperty
in interface ICompilationContext
public void removeProperty(Object key)
ICompilationContext
removeProperty
in interface ICompilationContext
public <A extends IAddon> AddonInfo getAddonInfo(A addon)
getAddonInfo
in interface ICompilationContext
public boolean registerAddon(IAddon parent, IAddon addon) throws MRuleValidationException
ICompilationContext
IAddon
during compilation process.
If this specific instance has already been registered, this method
does nothing.IAddon
has been registered,
this method creates addon info for it.IAddon
has been registered,
this method updates addon info and returns the same instance as provided.IAddon.wasRegistered(ICompilationContext, IAddon, AddonInfo)
is called at the end
of the registration if registration is successful (i.e. if Addon was not already registered).
Since 1.4.0, this method does not deduplicate anymore and so returns same instance
as provided. This behaviour might change in future version so returned value should
not be ignored.
Since 1.5.0, An instance of IAddon
is no more responsible for registering
it's own sub-addons, as it's done automatically. The registration process is no more
responsible for eventual deduplication, encapsulation, ... So the return type has been
changed to boolean instead of formerly IAddon.registerAddon
in interface ICompilationContext
parent
- Parent from which the addon was registered or [null | self] for root Addon.addon
- The addon to registered.MRuleValidationException
public void registerAddonRecursively(IAddon parent, IAddon addon) throws MRuleValidationException
ICompilationContext
PersistantProperties
.
If sub addons are declared differently (via Maps for instance) the IAddon.wasRegistered(ICompilationContext, IAddon, AddonInfo)
hook has to be implemented.registerAddonRecursively
in interface ICompilationContext
parent
- Parent from which the addon was registered or [null | self] for root Addon.addon
- The addon to registered recursively.MRuleValidationException
ICompilationContext.registerAddon(IAddon, IAddon)
public void clearRegisteredAddons()
ICompilationContext
clearRegisteredAddons
in interface ICompilationContext
public Set<IAddon> getAllUniqueAddons()
ICompilationContext
getAllUniqueAddons
in interface ICompilationContext
public List<IAddon> getAllAddons()
ICompilationContext
getAllAddons
in interface ICompilationContext
public ICompilationContext getRootContext()
IContext
getRootContext
in interface ICompilationContext
getRootContext
in interface IContext
getRootContext
in class ContextWrapper<ICompilationContext>
public static ICompilationContext getSubContext(ICompilationContext c, Class<?> newReadWriteBaseType)
public static ICompilationContext getSubContext(ICompilationContext c, CompilationLevel clToUse, Class<?> newReadWriteBaseType)
public static ICompilationContext getSubContext(ICompilationContext c, Class<?> newReadBaseType, Class<?> newWriteBaseType)
public static ICompilationContext getSubContext(ICompilationContext c, CompilationLevel clToUse, Class<?> newReadBaseType, Class<?> newWriteBaseType)
public static ICompilationContext getSubContext(ICompilationContext c, CompilationLevel clToUse)
public boolean isCacheEnabled(String feature)
ICompilationContext
isCacheEnabled
in interface ICompilationContext
feature
- Feature for which to check cache activationpublic ICacheActivationResolver getCacheActivationResolver()
getCacheActivationResolver
in interface ICompilationContext
public void setCacheActivationResolver(ICacheActivationResolver cacheActivationResolver)
setCacheActivationResolver
in interface ICompilationContext
public boolean isOptimizationEnabled()
ICompilationContext
isOptimizationEnabled
in interface ICompilationContext
public void setOptimizationEnabled(boolean optimizationEnabled)
ICompilationContext
setOptimizationEnabled
in interface ICompilationContext
public IExecutionContext convertToExecutionContext()
ICompilationContext
convertToExecutionContext
in interface ICompilationContext