Main
Flex Shell 0.6.1
What is Flex-Shell?Demo : http://amostudio.com:8080/fs-demo/flex/Main.html# Flex-Shell is a Shell(Wrapper) style Framework Designed for Flex 2/3 development. Flex-Shell enforces simplicity and unobstructiveness of development code
Flex-Shell is based on Colibri Configuration Engine which
I have wrote and implemented in J2EE Flex-Shell heavily uses Flex's native Module component and provides API for developer to easily load Modules into application.
Flex-Shell's core consist of three components(no actually its four)
NOTE: Each Manager is maintained as a Single Instance(Singleton pattern), and they are created automatically by framework, in order To obtain the instance of particular manager do : MyManagerClass.getInstance();
Configuration EngineConfiguration Engine is a key feature of Flex-shell. it takes Flex development on next level, Full Configuration xml fshell-config.xml<?xml version="1.0" encoding="UTF-8"?>
<fshell-config version="0.6.1">
<core type="default">
<property name="asyncLoading" value="true" />
<system type="default">
<plugin loadPolicy="roleBased" role="system" loadPriority="9"
name="plugins/system/FSSystemBoardPlugin.swf" requred="false">
<property name="frameMonitor" value="ON" />
</plugin>
</system>
<security type="default">
<plugin name="plugins/security/DefaultAuthenticator.swf"
type="authentication" requred="true">
<property name="passwordEncoding" value="MD5" />
<property name="securityType" value="group" />
<provider name="myMainAuthenticationService"
type="amf-http">
<property name="destination" value="fsAuthenticate" />
</provider>
</plugin>
<service forName="roleRegistry" type="local" url="roles.xml" />
</security>
<application type="default">
<property name="sessionTimeout" value="10" />
<property name="lalala" value="true" />
<plugin loadPolicy="preload" loadPriority="9"
name="plugins/application/DummyApplicationPlugin.swf"
requred="true">
<property name="someName" value="someValue" />
<property name="someName2" value="someValue2" />
<property name="someName3" value="someValue3" />
</plugin>
<module name="modules/sampleModule.swf"
loadPolicy="preload"
loadPriority="78" />
<module name="modules/sampleModule2.swf"
loadPolicy="preload" loadPriority="1" />
<module name="modules/sampleModule4.swf"
loadPolicy="roleBased" role="role1" loadPriority="3" />
<module name="modules/sampleModule12.swf"
loadPolicy="onDemand" loadPriority="34" />
<service forName="tests" type="local" url="tests.xml" />
</application>
</core>
</fshell-config>
Hierarchy of fshell-config.xml resembles the hierarchy of flex-shell framework itself. <core type="default">
<property name="system" value="false" />
<property name="asyncLoading" value="true" />
<system type="default">
....
</system>
<security type="default">
....
</security>
<application type="default">
....
</application>
</core>
<system type="default">
<property name="someName" value="someValue" />
<property name="someName2" value="someValue2" />
<plugin "somePlugin.swf" >
<property name="someName3" value="someValue3" />
</plugin>
<service forName="sysService" type="local"
url="sys.xml" />
</system>
<security type="default">
<property name="someName" value="someValue" />
<property name="someName2" value="someValue2" />
<plugin "defaultAuthenticator.swf" >
<property name="someName3" value="someValue3" />
</plugin>
<service forName="roleRegistry" type="local"
url="roles.xml" />
</security>
<application type="default">
<property name="someName" value="someValue" />
<property name="someName2" value="someValue2" />
<plugin "defaultAuthenticator.swf" >
<property name="someName3" value="someValue3" />
</plugin>
........
<module name="sampleModule.swf"
loadPolicy="preload"
loadPriority="78" />
........
<service forName="roleRegistry" type="local"
url="roles.xml" />
</application>
As you see,each manager's xml configuration nodes are similar to each other,
<property name="someName value="someValue" />
property nodes are automatically parsed and placed inside properties object of a manager they belong to. myManagerInstance.getProperty("propertyName");
<module name="modules/sampleModule.swf"
loadPolicy="preload"
loadPriority="78" />
<plugin name="myplugin.swf" type="someType" requred="true">
<property name="someProperty" value="someValue" />
</plugin>
What is Plugin ?
Plugins are regular modules with some twist :)
What is Service Node ?Service node is used to dynamically append additional configuration xml to manager, using service call, <service forName="roleRegistry" type="local"
url="roles.xml" />
service node attributes are :
this service call returns xml in following format : <?xml version="1.0" encoding="UTF-8"?>
<roleRegistry>
<role name="role1" weight="89" />
<role name="role2" weight="90" />
<role name="role3" weight="999" />
</roleRegistry>
Module Loading & Policy ConfigurationModule Loading, based on Policy and Priority values provides configuration that tells engine <module name="myRegularFlex2module.swf" loadPolicy="preload" loadPriority="4" />
var myMod:Module = ApplicationManager.getInsance().loadModule("mymodule.swf");
<module name="myModule.swf" loadPolicy="roleBased" role="role2" loadPriority="4" />
role name can be anything developer wishes to, as long as this role is declared under SecurityManager Configuration Node in flex-shell.xml file(about it later on ) .
All this information is enough for application to take this module and load it for user at runtime. all user has to do is listen for module Event(regular Flex ModuleEvent.READY) (this might change the future). Security Manager - is Second Biggest Part of the Flex-Shell Framework, (which can be easily turned off and ignored, if developer does not wish to use it ) providing flexible, configurable security Management, (in future idea is to make it service pluggable so user can create a custom Service ABC and plugit into security Manager as custom authentication mechanism) .
System Manager - is class that provides all system level operations such as advance components for debugging, memory monitoring stack trace display API, also (still in development) to provide solution to run unnecessary object reference(including circular references) cleanup to helpout Garbage Collector, this is done by having classes(components) implement ISystemManagable interface if they have code that can be cleaned up when system Manager runs cleanup method. How to Use Flex-shellFlex-shell starts by including mxml <colibri:Shell >
</colibri:Shell>
in your main application, why including and not extending Application ? by including developer gets almost non obtrusive development environment, So,what kind of children can colibri:Shell have? good question, to make it more clear, colibri:shell is a extended, managed ViewStack Object,
two of the manager's already have default view, but ApplicationManager does not, that means, at minimum flex-shell should have following : <colibri:Shell >
<local:Index />
</colibri:Shell>
TODO ... Flex Shell Lifecyclein Two minutes or less
When all 'preload" policy Modules are loaded ColibriCoreEvent is dispatched. Core engine receives event notification and transitions into next phase which is to run all remaining initialization code and transition into SECURITY_ACTIVATED state, (loading SecurityManager with assocciated View ). For each transition CoreEngine dispatches FlexShellEvent with currentState attribute. if SecurityManager is turned off CoreEngine immediately transitions into APPLICATION_ACTIVATE State and then Developers Code lifeCycle begins. CoreEngine's internal States are : /**
* Indicates that a component has Been Created
*/
public static const CREATED:int = -1;
/**
* Indicates that a component has Been Configured
*/
public static const COFNIGURED:int = 0;
/**
* Indicates that all 'preload' Modules Have Been Loaded
*/
public static const INITIALIZED:int = 1;
/**
* Indicates that a Security Manager Have Been Loaded and activated
* NOTE if Security is Turned off This state immediately transitions to
* APPLICATION_ACTIVATE State
*/
public static const SECURITY_ACTIVATED:int = 2;
/**
* Indicates that a Application Manager Have Been Loaded
*at this state Developer's Application Code is starting to execute.
*/
public static const APPLICATION_ACTIVATE:int = 3;
To be Continued ... |