| LowRA API Documentation | Annexes | All Packages | All Classes | Index | Frames |
|
| IoC context Pre processing | ||
LowRA offers tools to apply pre processing jobs on the IoC xml context using ApplicationLoader features.
Pre processing jobs may also be defined using directly the xml context file, let's show how it work.
Welcome to dynamic pre processing system.
LowRA implements a ContextProcessor interface to define basic rules for xml context preprocessing.
Each processor you want to implement must implement this interface.
Take a look at a context processor sample :
package com.project
{
import com.bourre.ioc.context.processor.ContextProcessor;
public class CustomProcessor implements ContextProcessor
{
public function CustomProcessor( ...args )
{
}
public function process( xml : XML ) : XML
{
//do preprocessing on passed-in xml content here.
return xml;
}
}
}
Instead of using hard coded pre processing ( ApplicationLoader.addProcessingMethod() or ApplicationLoader.addProcessor() ), IoC context support preprocessor node definition.
A preprocessor node must be named : <preprocessor>
Preprocessor node support :
type definition ( full qualified class name of processor )url definition to load processor code if not in current application domain ( like DLL )factory and singleton-access behaviourmethod attributeWhen processor objet is built, the method "process" ( from ContextProcessor interface ) is called.
Here is different preprocessor node definitions :
<beans>
<preprocessor type="com.project.CustomProcessor" />
</beans>
<beans>
<preprocessor type="com.project.CustomProcessor" url="customProcessorDLL.swf" />
</beans>
<beans>
<preprocessor type="com.project.CustomProcessor" url="customProcessorDLL.swf">
<argument value="something" /> <argument value="something else" />
</preprocessor>
</beans>
Adapter allow to use no ContextProcessor compliant processor to do preprocessing job.
So, processor doesn't need to implement the LowRA interface, but must implement a method which :
Example :
package com.project
{
public class AdpaterProcessor
{
public function AdpaterProcessor( ...args )
{
}
public function run( xml : XML ) : XML
{
//do preprocessing on passed-in xml content here.
return xml;
}
}
}
To use adapter, just set the method attribute to define the name of the method to call on processor.
<beans>
<preprocessor type="com.project.AdpaterProcessor" url="AdpaterProcessorDLL.swf" method="run" />
</beans>
LowRA offers differents tools for pre processing, here is the order of pre processing treatments :
And then... IoC context is parsed.