Packageorg.restfulx.services.air
Classpublic class AIRServiceProvider
ImplementsISyncingServiceProvider
SubclassesMockAIRServiceProvider

AIR Service Provider implementation.



Public Properties
 PropertyDefined by
  connection : SQLConnection
reference to the connnection object used by AIR service provider
AIRServiceProvider
  id : int
[read-only] ID uniquely identifies this service provider.
AIRServiceProvider
  initialized : Boolean
indicates if the local database has been set up and is ready to be modified/queried
AIRServiceProvider
Protected Properties
 PropertyDefined by
  queue : Array
queue of SQL expressions to execute
AIRServiceProvider
  schema : Dictionary
existing schema (already in SQLite)
AIRServiceProvider
  sql : Dictionary
map of models to various SQL expressions
AIRServiceProvider
  state : ModelsMetadata
local metadata state
AIRServiceProvider
  tables : Dictionary
tables as per all the models registered
AIRServiceProvider
Public Methods
 MethodDefined by
  
AIRServiceProvider(dbFile:File = null)
AIRServiceProvider
  
If the service provider supports it, this begins a transaction
AIRServiceProvider
  
canLazyLoad():Boolean
Indicates if this service provider can perform lazy loading.
AIRServiceProvider
  
commitTransaction(responder:IResponder = null):void
If the service provider supports it, this commits the currently active transaction
AIRServiceProvider
  
create(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void
RESTful CRUD contract: create method.
AIRServiceProvider
  
destroy(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void
RESTful CRUD contract: destroy method.
AIRServiceProvider
  
dirty(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void
Idenfies all the instances for a particular class of models that need to be synchronized
AIRServiceProvider
  
getLastPullTimeStamp(object:Object, responder:IResponder):void
Gets the last time (timestamp originates on the server) a sync was performed with the central server
AIRServiceProvider
  
hasErrors(object:Object):Boolean
Indicates to the ServiceResponder that this particular run (typically create/update or destroy) has produced errors.
AIRServiceProvider
  
index(clazz:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void

Supports special handling for the following metadata properties:

  • search: A substring to match on one of the properties of the model idenfied by category
  • category: Model property that will be used for search (e.g.
AIRServiceProvider
  
marshall(object:Object, recursive:Boolean = false):Object
Produces service provider specific model representation suitable for being serialized.
AIRServiceProvider
  
Add any columns that have been added to models but do not currently exist in database.
AIRServiceProvider
  
purge(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false):void
Tries to eallydelete an object as opposed to just mark it for deletion.
AIRServiceProvider
  
show(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void
RESTful CRUD contract: show method.
AIRServiceProvider
  
sync(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void
Mark a specific model object as synced
AIRServiceProvider
  
unmarshall(object:Object, disconnected:Boolean = false, defaultType:String = null):Object
The reverse of marshall.
AIRServiceProvider
  
update(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void
RESTful CRUD contract: update method.
AIRServiceProvider
  
updateLastPullTimeStamp(object:Object, value:String):void
Updates the last time (timestamp originates on the server) a sync was performed with the central server
AIRServiceProvider
Protected Methods
 MethodDefined by
  
computeMetadada(clazz:Object, data:TypedArray, responder:IResponder):void
AIRServiceProvider
  
AIRServiceProvider
  
executeSQLStatement(statement:SQLStatement):void
AIRServiceProvider
  
extractSchema(result:SQLSchemaResult):void
AIRServiceProvider
  
getSQLStatement(statement:String):SQLStatement
AIRServiceProvider
  
getSQLType(node:XML):String
AIRServiceProvider
  
initializeConnection(databaseFile:File):void
AIRServiceProvider
  
invokeResponderResult(responder:IResponder, result:Object):void
AIRServiceProvider
  
AIRServiceProvider
  
queueSQLStatement(statement:SQLStatement):void
AIRServiceProvider
Public Constants
 ConstantDefined by
  ID : int
[static] service id
AIRServiceProvider
Property detail
connectionproperty
public var connection:SQLConnection

reference to the connnection object used by AIR service provider

idproperty 
id:int  [read-only]

ID uniquely identifies this service provider. This is typically obtained from ServiceManager like so: public static const ID:int = ServiceManager.generateId(); You can then wrap around this with a getter: public function get id():int { return ID; }

Implementation
    public function get id():int

See also

initializedproperty 
public var initialized:Boolean

indicates if the local database has been set up and is ready to be modified/queried

queueproperty 
protected var queue:Array

queue of SQL expressions to execute

schemaproperty 
protected var schema:Dictionary

existing schema (already in SQLite)

sqlproperty 
protected var sql:Dictionary

map of models to various SQL expressions

stateproperty 
protected var state:ModelsMetadata

local metadata state

tablesproperty 
protected var tables:Dictionary

tables as per all the models registered

Constructor detail
AIRServiceProvider()constructor
public function AIRServiceProvider(dbFile:File = null)

Parameters
dbFile:File (default = null)
Method detail
beginTransaction()method
public function beginTransaction():void

If the service provider supports it, this begins a transaction

See also

canLazyLoad()method 
public function canLazyLoad():Boolean

Indicates if this service provider can perform lazy loading. RxModelsController will then skip pre-fetching of the lazy dependencies and it's the responsibility of the provider to make sure that the data that was requested is loaded (perhaps via nesting, etc).

Returns
Boolean — true if the service provider can lazy load, false otherwise

See also

commitTransaction()method 
public function commitTransaction(responder:IResponder = null):void

If the service provider supports it, this commits the currently active transaction

Parameters
responder:IResponder (default = null)

See also

computeMetadada()method 
protected function computeMetadada(clazz:Object, data:TypedArray, responder:IResponder):voidParameters
clazz:Object
 
data:TypedArray
 
responder:IResponder
create()method 
public function create(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void

RESTful CRUD contract: create method. Same semantics as Rails RESTful controller create.

Parameters
object:Object — object to create (typically a new model instance)
 
responder:IResponder — the responder that must be called on index
 
metadata:Object (default = null) — any metadata that must be appended with the index request
 
nestedBy:Array (default = null) — an array of model instances that will be used to nest this request, e.g.: [project, user] where project is some Project model instance and user is some User model instance. In case of XMLHTTPServiceProvider nesting may require additional configuration on the server. If you are using Rails see config/routes.rb for more details.
 
recursive:Boolean (default = false) — indicates if recursive create (object + all children) should be performed
 
undoRedoFlag:int (default = 0) — indicates if it's a normal invocation, undo invocation or redo invocation

See also

destroy()method 
public function destroy(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void

RESTful CRUD contract: destroy method. Same semantics as Rails RESTful controller destroy.

Parameters
object:Object — object to destroy (typically an existing model instance)
 
responder:IResponder — the responder that must be called on index
 
metadata:Object (default = null) — any metadata that must be appended with the index request
 
nestedBy:Array (default = null) — an array of model instances that will be used to nest this request, e.g.: [project, user] where project is some Project model instance and user is some User model instance. In case of XMLHTTPServiceProvider nesting may require additional configuration on the server. If you are using Rails see config/routes.rb for more details.
 
recursive:Boolean (default = false) — indicates if recursive create (object + all children) should be performed
 
undoRedoFlag:int (default = 0) — indicates if it's a normal invocation, undo invocation or redo invocation

See also

dirty()method 
public function dirty(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void

Idenfies all the instances for a particular class of models that need to be synchronized

Parameters
object:Object — object to find versions for (typically a model class)
 
responder:IResponder — the responder that must be called on versions
 
metadata:Object (default = null) — any metadata that must be appended with the index request
 
nestedBy:Array (default = null) — an array of model instances that will be used to nest this request, e.g.: [project, user] where project is some Project model instance and user is some User model instance. In case of XMLHTTPServiceProvider nesting may require additional configuration on the server. If you are using Rails see config/routes.rb for more details.

See also

executePendingSQLStatements()method 
protected function executePendingSQLStatements():void
executeSQLStatement()method 
protected function executeSQLStatement(statement:SQLStatement):voidParameters
statement:SQLStatement
extractSchema()method 
protected function extractSchema(result:SQLSchemaResult):voidParameters
result:SQLSchemaResult
getLastPullTimeStamp()method 
public function getLastPullTimeStamp(object:Object, responder:IResponder):void

Gets the last time (timestamp originates on the server) a sync was performed with the central server

Parameters
object:Object — object to get timestamp for (typically a model class)
 
responder:IResponder

See also

getSQLStatement()method 
protected function getSQLStatement(statement:String):SQLStatementParameters
statement:String

Returns
SQLStatement
getSQLType()method 
protected function getSQLType(node:XML):StringParameters
node:XML

Returns
String
hasErrors()method 
public function hasErrors(object:Object):Boolean

Indicates to the ServiceResponder that this particular run (typically create/update or destroy) has produced errors. This typically means that response processing must be terminated and instead errors should be displayed.

Parameters
object:Object — the response object being processed

Returns
Boolean — true if there are errors false otherwise

See also

index()method 
public function index(clazz:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void

Supports special handling for the following metadata properties:

The rest of the metadata properties become compound conditions where {name: 4}, would match model property name that has values 4.

limit in combination with offset can be used to page a large data set.

RESTful CRUD contract: index method. Same semantics as Rails RESTful controller index. Parameters
clazz:Object — object to index (typically a class like Project, etc)
 
responder:IResponder — the responder that must be called on index
 
metadata:Object (default = null) — any metadata that must be appended with the index request
 
nestedBy:Array (default = null) — an array of model instances that will be used to nest this request, e.g.: [project, user] where project is some Project model instance and user is some User model instance. In case of XMLHTTPServiceProvider nesting may require additional configuration on the server. If you are using Rails see config/routes.rb for more details.

See also

initializeConnection()method 
protected function initializeConnection(databaseFile:File):voidParameters
databaseFile:File
invokeResponderResult()method 
protected function invokeResponderResult(responder:IResponder, result:Object):voidParameters
responder:IResponder
 
result:Object
marshall()method 
public function marshall(object:Object, recursive:Boolean = false):Object

Produces service provider specific model representation suitable for being serialized. For example, XMLHTTPServiceProvider would return XML.

Parameters
object:Object — object to marshall into serialized form
 
recursive:Boolean (default = false) — flag indicating if entire object graph should be serialized inline

Returns
Object

See also

migrateDatabase()method 
public function migrateDatabase():void

Add any columns that have been added to models but do not currently exist in database.

performDatabaseMigration()method 
protected function performDatabaseMigration():void
purge()method 
public function purge(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false):void

Tries to eallydelete an object as opposed to just mark it for deletion.

Parameters
object:Object — object to find versions for (typically a model class)
 
responder:IResponder — the responder that must be called on versions
 
metadata:Object (default = null) — any metadata that must be appended with the index request
 
nestedBy:Array (default = null) — an array of model instances that will be used to nest this request, e.g.: [project, user] where project is some Project model instance and user is some User model instance. In case of XMLHTTPServiceProvider nesting may require additional configuration on the server. If you are using Rails see config/routes.rb for more details.
 
recursive:Boolean (default = false) — indicates if a purge operations should be recusrive

See also

queueSQLStatement()method 
protected function queueSQLStatement(statement:SQLStatement):voidParameters
statement:SQLStatement
show()method 
public function show(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void

RESTful CRUD contract: show method. Same semantics as Rails RESTful controller show.

Parameters
object:Object — object to show (typically a model instance as opposed to class)
 
responder:IResponder — the responder that must be called on index
 
metadata:Object (default = null) — any metadata that must be appended with the index request
 
nestedBy:Array (default = null) — an array of model instances that will be used to nest this request, e.g.: [project, user] where project is some Project model instance and user is some User model instance. In case of XMLHTTPServiceProvider nesting may require additional configuration on the server. If you are using Rails see config/routes.rb for more details.

See also

sync()method 
public function sync(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void

Mark a specific model object as synced

Parameters
object:Object — object to find versions for (typically a model class instance)
 
responder:IResponder — the responder that must be called on versions
 
metadata:Object (default = null) — any metadata that must be appended with the index request
 
nestedBy:Array (default = null) — an array of model instances that will be used to nest this request, e.g.: [project, user] where project is some Project model instance and user is some User model instance. In case of XMLHTTPServiceProvider nesting may require additional configuration on the server. If you are using Rails see config/routes.rb for more details.

See also

unmarshall()method 
public function unmarshall(object:Object, disconnected:Boolean = false, defaultType:String = null):Object

The reverse of marshall. Takes a response from the underlying service provider and turns it into an object graph of models.

Parameters
object:Object — source object from the service provider/responder
 
disconnected:Boolean (default = false) — a flag indicating that the object should not be reconnected with the cache
 
defaultType:String (default = null) — default type to use if the type cannot be determined by the serializer

Returns
Object — (dis)connected object graph of the model corresponding to the response

See also

update()method 
public function update(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void

RESTful CRUD contract: update method. Same semantics as Rails RESTful controller update.

Parameters
object:Object — object to update (typically an existing model instance)
 
responder:IResponder — the responder that must be called on index
 
metadata:Object (default = null) — any metadata that must be appended with the index request
 
nestedBy:Array (default = null) — an array of model instances that will be used to nest this request, e.g.: [project, user] where project is some Project model instance and user is some User model instance. In case of XMLHTTPServiceProvider nesting may require additional configuration on the server. If you are using Rails see config/routes.rb for more details.
 
recursive:Boolean (default = false) — indicates if recursive create (object + all children) should be performed
 
undoRedoFlag:int (default = 0) — indicates if it's a normal invocation, undo invocation or redo invocation

See also

updateLastPullTimeStamp()method 
public function updateLastPullTimeStamp(object:Object, value:String):void

Updates the last time (timestamp originates on the server) a sync was performed with the central server

Parameters
object:Object — object object to update timestamp for (typically a model class)
 
value:String

See also

Constant detail
IDconstant
public static const ID:int

service id