Re: [jade-develop] help: converting stringified AID back to AID


Subject: Re: [jade-develop] help: converting stringified AID back to AID
From: Peter Ebben (Peter.Ebben@telin.nl)
Date: Tue Aug 06 2002 - 17:39:35 MET DST


Felix,

Do not use AID.toString() for your purpose.

AID's can be created in two ways, either from a local name of an agent, or
from a 'fully qualified' name (guid).

To obtain a 'stringified' version of the AID (i.e., the guid of the Agent),
use AID.getName(). This would, in your case, return
'wda01@moldau:1099/JADE', instead of '( agent-identifier :name
wda01@moldau:1099/JADE)'.

To convert back to an AID, use the constructor AID(java.lang.String name,
boolean isGUID), as follows:

String myGUID = myAID.getName();

// More code goes here...

AID newAID = new AID(myGUID, AID.ISGUID);

Hope this helps.

Kind regards,

Peter Ebben

Felix Schmid wrote:
>
> Hi there,
>
> I am currently trying to convert a String containing the AID of an agent
> (derived by AID's toString() method)
> back to an instance of class AID. However, using AID's constructor doesn't
> work as it appends another
> 'agent-identifier' in front of the String.
>
> e.g.
>
> ( agent-identifier :name wda01@moldau:1099/JADE)
>
> becomes
>
> ( agent-identifier :name ( agent-identifier :name wda01@moldau:1099/JADE))
>
> Is there any way to solve this problem?
>
> cheers,
> felix



This archive was generated by hypermail 2a22 : Tue Aug 06 2002 - 17:31:48 MET DST