public interface ICompilationContext extends IContext
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_COMPILE_LOGGER_NAME
Default logger used for compilation contexts.
|
static String |
DEFAULT_OPTIMIZE_LOGGER_NAME
Default logger used for compilation contexts.
|
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.
|
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, getWriteBaseType, setExecutionSet, setLoggerName
static final String DEFAULT_COMPILE_LOGGER_NAME
static final String DEFAULT_OPTIMIZE_LOGGER_NAME
void compile() throws MRuleValidationException
MRuleValidationException
void init() throws MRuleValidationException
MRuleValidationException
CompilationLevel getCompilationLevel()
CompilationLevel
void setPhase(Phase phase)
void setCompilationLevel(CompilationLevel compilationLevel)
CompilationLevel
to use for compilation.<A extends IAddon> AddonInfo getAddonInfo(A addon)
ICompilationContext getRootContext()
IContext
getRootContext
in interface IContext
boolean registerAddon(IAddon parent, IAddon addon) throws MRuleValidationException
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.parent
- Parent from which the addon was registered or [null | self] for root Addon.addon
- The addon to registered.MRuleValidationException
void registerAddonRecursively(IAddon parent, IAddon addon) throws MRuleValidationException
PersistantProperties
.
If sub addons are declared differently (via Maps for instance) the IAddon.wasRegistered(ICompilationContext, IAddon, AddonInfo)
hook has to be implemented.parent
- Parent from which the addon was registered or [null | self] for root Addon.addon
- The addon to registered recursively.MRuleValidationException
registerAddon(IAddon, IAddon)
void clearRegisteredAddons()
Set<IAddon> getAllUniqueAddons()
List<IAddon> getAllAddons()
Object getProperty(Object key)
void setProperty(Object key, Object value)
void removeProperty(Object key)
ICacheActivationResolver getCacheActivationResolver()
void setCacheActivationResolver(ICacheActivationResolver cacheActivationResolver)
boolean isCacheEnabled(String feature)
feature
- Feature for which to check cache activationboolean isOptimizationEnabled()
void setOptimizationEnabled(boolean optimizationEnabled)
IExecutionContext convertToExecutionContext()