Packagecom.lafabrick.reflex.service
Classpublic class ServicesLocator

Allows to register the various services (AbstractService) of the application.


Example

Example of use of ServiceLocator with the XML context of configuration (ApplicationContext)

Structuralization of the XML file of config : example of definition of RemoteObject.

  
  <?xml version="1.0" encoding="UTF-8"?>
  <objects>
      <object id="remotingUser" className="mx.rpc.remoting.mxml.RemoteObject">
          <property name="destination" className="String">javaFacadeUser</property>
          <property name="showBusyCursor" className="Boolean">true</property>
      </object>
  </objects>
  

Load the context, and add the service in ServiceLocator

  
  ApplicationContext.load( "application-config.xml", onLoaded );
  
  private function onLoaded() : void
  {
    ServicesLocator.addService( "serviceRemoting", ApplicationContext.getObject( "remotingUser" ) as RemoteObject );
  }
  

See also

com.lafabrick.reflex.ioc.ApplicationContext


Public Methods
 MethodDefined by
  
addService(serviceName:String, serviceObject:AbstractService):void
[static] Allows to add a service (type AbstractService) in the dictionary of service
ServicesLocator
  
getService(serviceName:String):AbstractService
[static] Allows to get a service with its identifier
ServicesLocator
Method detail
addService()method
public static function addService(serviceName:String, serviceObject:AbstractService):void

Allows to add a service (type AbstractService) in the dictionary of service

Parameters
serviceName:String — service id
 
serviceObject:AbstractService — instance of the service to be registered
getService()method 
public static function getService(serviceName:String):AbstractService

Allows to get a service with its identifier

Parameters
serviceName:String — service id

Returns
AbstractService — instance of the service