Package | com.ericfeminella.air.cairngorm.business |
Class | public class AIRServiceLocator |
Inheritance | AIRServiceLocator ![]() |
AIRServiceLocator
provides a mechanism from which AIR APIs,
specifically SQLConnection
, SQLStatement
) can
be located (referenced) from the Cairngorm ServiceLocator
as a Service via SQLService
.
AIRServiceLocator
allows for Adobe AIR specific APIs to be
retrieved from a Cairngorm ServiceLocator
implementation in the
same way one would access RPC Services such as HTTPService
,
WebService
etc. from the ServiceLocator
AIRServiceLocator
<?xml version="1.0" encoding="utf-8"?> <services:AIRServiceLocator xmlns:mx = "http://www.adobe.com/2006/mxml" xmlns:services = "com.ericfeminella.air.cairngorm.business." > <mx:Script> <![CDATA[ import mx.events.FlexEvent; public static const RDBMS:String = "rdbms"; protected override function preinitialize(event:FlexEvent) : void { rdbms.open(); } ]]> </mx:Script> <services:SQLService id = "rdbms" localDatabaseFilePath = "{ File.desktopDirectory.nativePath }" localDatabaseFileName = "air.cairngorm.example.db" /> </services:AIRServiceLocator>
See also
Property | Defined by | ||
---|---|---|---|
instance : AIRServiceLocator
[static]
Defines the Singleton instance of
AIRServiceLocator
| AIRServiceLocator | ||
services : SQLServices
Defines the
SQLServices instance which contains a reference
to all SQLService defined on a AIRServiceLocator
instance
| AIRServiceLocator |
Method | Defined by | ||
---|---|---|---|
AIRServiceLocator constructor Instantiates the Singleton
instance of AIRServiceLocator and adds an listener for the
FlexEvent.PREINITIALIZE event
| AIRServiceLocator | ||
[static]
Retrieves the Singleton instance of the
AIRServiceLocator
| AIRServiceLocator | ||
getSQLService(name:String):SQLService
Retrieves a specific
SQLService which has been defined
by the AIRServiceLocator instance
| AIRServiceLocator | ||
hasSQLService(name:String):Boolean
Determines if the specified
SQLService has been defined
on a AIRServiceLocator instance
| AIRServiceLocator |
Method | Defined by | ||
---|---|---|---|
preinitialize(event:FlexEvent):void
Abstract method which is invoked when
Application.preinitialize
event is dispatched. | AIRServiceLocator |
instance | property |
protected static var instance:AIRServiceLocator
Defines the Singleton instance of AIRServiceLocator
services | property |
protected var services:SQLServices
Defines the SQLServices
instance which contains a reference
to all SQLService
defined on a AIRServiceLocator
instance
AIRServiceLocator | () | constructor |
public function AIRServiceLocator()
AIRServiceLocator
constructor Instantiates the Singleton
instance of AIRServiceLocator
and adds an listener for the
FlexEvent.PREINITIALIZE
event
—
|
getInstance | () | method |
public static function getInstance():AIRServiceLocator
Retrieves the Singleton instance of the AIRServiceLocator
AIRServiceLocator —
singleton instance of AIRServiceLocator
|
getSQLService | () | method |
public function getSQLService(name:String):SQLService
Retrieves a specific SQLService
which has been defined
by the AIRServiceLocator
instance
name:String — unique identifier of the SQLService instance
|
SQLService —
SQLService instance with the specified name
|
SQLService
instance can be referenced via AIRServiceLocator.getSQLService
var service:SQLService; service = AIRServiceLocator.getInstance().getSQLService( Services.SERVICE );
hasSQLService | () | method |
public function hasSQLService(name:String):Boolean
Determines if the specified SQLService
has been defined
on a AIRServiceLocator
instance
name:String — unique identifier of the SQLService instance
|
Boolean — true if the service exists, otherwise false
|
preinitialize | () | method |
protected function preinitialize(event:FlexEvent):void
Abstract method which is invoked when Application.preinitialize
event is dispatched.
This method is provided in order to allow clients to override in order to initialize services at startup of the application.
Parametersevent:FlexEvent |