Packageorg.restfulx.services
Interfacepublic interface IServiceProvider
SubinterfacesISyncingServiceProvider, IVersioningServiceProvider
ImplementorsDirectCouchDBHTTPServiceProvider, XMLHTTPServiceProvider

This interface represents the core contract between service providers (such as HTTP, AIR, etc) and the rest of the framework. New service providers must implement this interface and register with the RxApplicationController on application initialization.



Public Properties
 PropertyDefined by
  id : int
[read-only] ID uniquely identifies this service provider.
IServiceProvider
Public Methods
 MethodDefined by
  
canLazyLoad():Boolean
Indicates if this service provider can perform lazy loading.
IServiceProvider
  
create(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void
RESTful CRUD contract: create method.
IServiceProvider
  
destroy(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void
RESTful CRUD contract: destroy method.
IServiceProvider
  
hasErrors(object:Object):Boolean
Indicates to the ServiceResponder that this particular run (typically create/update or destroy) has produced errors.
IServiceProvider
  
index(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void
RESTful CRUD contract: index method.
IServiceProvider
  
marshall(object:Object, recursive:Boolean = false):Object
Produces service provider specific model representation suitable for being serialized.
IServiceProvider
  
show(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void
RESTful CRUD contract: show method.
IServiceProvider
  
unmarshall(object:Object, disconnected:Boolean = false, defaultType:String = null):Object
The reverse of marshall.
IServiceProvider
  
update(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null, recursive:Boolean = false, undoRedoFlag:int = 0):void
RESTful CRUD contract: update method.
IServiceProvider
Property detail
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
Method detail
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
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
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
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
index()method 
public function index(object:Object, responder:IResponder, metadata:Object = null, nestedBy:Array = null):void

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

Parameters
object: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.
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
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.
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
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