next up previous contents
Next: Helper Up: Resource Access Previous: getCommunicationService(String agentsystem)   Contents

helper.getProxy(String proxyInterface)

For accessing the other resources the helper offers the method getProxy. This method gets as parameter the string containing the class name and package of the interface which has to be implemented by the returned proxy. If there are more proxies for this interface registered in the System, all are returned. If the Agent is not allowed to access this proxy, a SecurityException will be thrown. The access to the MAFFinder could be done by the following lines, doing the same as the example before:

(MAFFinderIFace) maffinder = (MAFFinderIFace) helper.getProxy(

           ``tagents.sysagents.maffinder.MAFFinderIFace'')[0];

Location[] obs = maffinder.lookupAgent(new Name(helper.getID()), 

                                       profile);

For accessing a resource the Agent has to know the class name of the interface and has to have access to the interface definition at compile time.



Thomas Letsch 2001-02-21