This is the primary extension point for Flex/AIR applications based on
the framework. It hooks up all available models, services and serializers.
Example
If you use Rx Code Generation Engine you'll get
ApplicationController
auto generated for you.
package pomodo.controllers {
import org.restfulx.Rx;
import org.restfulx.controllers.RxApplicationController;
import org.restfulx.utils.RxUtils;
import pomodo.commands.
import pomodo.models.
public class ApplicationController extends RxApplicationController {
private static var controller:ApplicationController;
public static var models:Array = [Account, Address, Assignment, Project,
ProjectCategory, Sprint, Task, User, Workunit];
public static var commands:Array = [];
public function ApplicationController(enforcer:SingletonEnforcer, extraServices:Array,
defaultServiceId:int = -1) {
super(commands, models, extraServices, defaultServiceId);
}
public static function get instance():ApplicationController {
if (controller == null) initialize();
return controller;
}
public static function initialize(extraServices:Array = null, defaultServiceId:int = -1,
airDatabaseName:String = null):void {
if (!RxUtils.isEmpty(airDatabaseName)) Rx.airDatabaseName = airDatabaseName;
controller = new ApplicationController(new SingletonEnforcer, extraServices,
defaultServiceId);
}
}
}
class SingletonEnforcer {}
public function RxApplicationController(commands:Array, models:Array, extraServices:Array = null, targetServiceId:int = -1)
Creates a new instance of the application controller.
Parameters
| commands:Array — the array of command classes to register e.g. [Command1, Command2]
|
|
| models:Array — the array of model classes to register e.g. [Model1, Model2]
|
|
| extraServices:Array (default = null ) — the array of services to use (XMLHTTPServiceProvider is registered
by default. All other providers (e.g. AIR) must be registered here)
|
|
| targetServiceId:int (default = -1 ) — default service to use for operations (by default XMLHTTPServiceProvider.ID)
|