Announcement Announcement Module
Collapse
No announcement yet.
CairngormServiceLocator question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • CairngormServiceLocator question

    I am using CairngormServiceLocator to get access to my RemoteObjects:
    Code:
    var r:RemoteObject = CairngormServiceLocator.getInstance().getRemoteObject(RemoteServices.PROPERTY_SERVICE);
    r.addEventListener(ResultEvent.RESULT, onGetSpaceTreeResult);
    r.addEventListener(FaultEvent.FAULT, fault);
    r.getSpaces(nodeId);
    But now that i want to add a new remote method call I run into a problem. Since CairngormServiceLocator returns the same instance of RemoteService when I add more remote listeners - it is not the effect i am trying to achieve. Perhaps i need a <prototype>?

    My config:
    Code:
    <object id="remoteObjectSecure" class="mx.rpc.remoting.mxml.RemoteObject"
    	abstract="true">
    	<property name="endpoint"
    		value="http://${host}:${port}/${context-root}/spring/messagebroker/amf" />
    	<property name="showBusyCursor" value="true" />
    </object>
    
    
    <object id="serviceLocator"
    	class="org.springextensions.actionscript.cairngorm.business.CairngormServiceLocator"
    	factory-method="getInstance">
    	<property name="propertyService">
    		<object id="propertyService" parent="remoteObjectSecure">
    			<property name="destination" value="propertyService" />
    		</object>
    	</property>
    </object>

  • #2
    Workaround - don't addEventListers directly to the remote service. Instead, get an asyncToken and attach a Responder. I didn't have to create a million responders for each remote method call. There is a Responder adapter class, I just pass function pointers. It's actually 1 line of code less ;p

    Code:
    import mx.rpc.Responder;
    var aToken:AsyncToken = r.getSpaces(nodeId);
    aToken.addResponder(new Responder(onGetSpaceTreeResult, fault));

    Comment

    Working...
    X