| Package | com.lafabrick.reflex.service |
| Class | public class ServicesLocator |
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
| Method | Defined 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 | ||
| addService | () | method |
public static function addService(serviceName:String, serviceObject:AbstractService):voidAllows to add a service (type AbstractService) in the dictionary of service
ParametersserviceName:String — service id
|
|
serviceObject:AbstractService — instance of the service to be registered
|
| getService | () | method |
public static function getService(serviceName:String):AbstractServiceAllows to get a service with its identifier
ParametersserviceName:String — service id
|
AbstractService — instance of the service
|