Package jade.util.leap

Examples of jade.util.leap.List


   * agent and closing down the Sniffer administration <em>GUI</em>.
   * Currently sniffed agents are also unsniffed to avoid errors.
   */
  protected void toolTakeDown() {

    List l = (List)(agentsUnderSniff.clone());
    ACLMessage request = getSniffMsg(l, SNIFF_OFF);

    // Start a FIPARequestProtocol to sniffOff all the agents since
    // the sniffer is shutting down
    try {
View Full Code Here


          cmd.setReturnValue(new Boolean(transferIdentity(agentID, src, dest)));
        }
        else if(cmdName.equals(AgentMobilitySlice.H_HANDLETRANSFERRESULT)) {
          AID agentID = (AID)params[0];
          boolean transferResult = ((Boolean)params[1]).booleanValue();
          List messages = (List)params[2];
         
          handleTransferResult(agentID, transferResult, messages);
        }
        else if(cmdName.equals(AgentMobilitySlice.H_CLONEDAGENT)) {
          GenericCommand gCmd = new GenericCommand(AgentMobilityHelper.INFORM_CLONED, AgentMobilitySlice.NAME, null);
View Full Code Here

         
          //if a FileHandler has been specified it's not possibile to retrieve the fileName
         
          //retrieves all the handlers associated to the logger
          //root handlers are inheredited by default
          List loggerHandlers = (this.rootHandlers == null ? new ArrayList() : new ArrayList(this.rootHandlers));
          //root logger handlers have been already set.
          if(!logName.equals("")){
            Handler[] handlers = theLogger.getHandlers();
            //if an handler has been specified at runtime it will have a format
            //i.e java.util.logging.FileHandler@1234556 so we remove the last part.
            //add the file handler specified by the user only if fileHandler is not a root handler
            for (int i=0;i<handlers.length;i++){
              String temp = handlers[i].toString();
              if (!fhExists){
                  String userHandler = (temp.indexOf('@') < 0 ? temp : temp.substring(0, temp.indexOf('@')));
                  loggerHandlers.add(userHandler);
              }
            }
          }
          logInfoElem.setHandlers(loggerHandlers);
         
View Full Code Here

          logManagerClass = className;
       
        logger.log(Logger.CONFIG, "Log manager class defined: " + logManagerClass);
        logManager = (LogManager) Class.forName(logManagerClass).newInstance();
       
        List logInfo = logManager.getAllLogInfo();
        Result r = new Result(actExpr, logInfo);
        getContentManager().fillContent(reply, r);
        reply.setPerformative(ACLMessage.INFORM);
      } catch (Exception any) {
        String errorMsg = "Error initializing LogManager. "+any;
View Full Code Here

   null to indicate that the result is not yet available.
   */
  List searchAction(Search s, AID requester) throws FIPAException {
    DFAgentDescription dfd = (DFAgentDescription) s.getDescription();
    SearchConstraints constraints = s.getConstraints();
    List result = null;
   
    if(logger.isLoggable(Logger.CONFIG))
      logger.log(Logger.CONFIG,"Agent "+requester.getName()+" requesting action Search");
   
    // Avoid loops in searching on federated DFs
    checkSearchId(constraints.getSearchId());
   
    int maxResult = getActualMaxResults(constraints);
   
    //  Search locally
    result = DFSearch(dfd, maxResult);
   
    // Note that if the local search produced more results than
    // required, we don't even consider the recursive search
    // regardless of the maxDepth parameter.
    if(result.size() < maxResult) {
     
      // Check if the search has to be propagated
      Long maxDepth = constraints.getMaxDepth();
      if ( (children.size() > 0) && (maxDepth != null) && (maxDepth.intValue() > 0) ) {
        // Start a recursive search.
View Full Code Here

   */
  List getDescriptionAction(GetDescription action, AID requester) {
    if(logger.isLoggable(Logger.CONFIG))
      logger.log(Logger.CONFIG,"Agent "+requester+" requesting action GetDescription.");
    // FIXME: This embeds the description into a list since the Applet still expects a List
    List tmp = new ArrayList();
    tmp.add(getDescriptionOfThisDF());
    return tmp;
  }
View Full Code Here

  List getDescriptionUsedAction(GetDescriptionUsed action, AID requester) {
    AID parent = action.getParentDF();
    if(logger.isLoggable(Logger.CONFIG))
      logger.log(Logger.CONFIG,"Agent "+requester+" requesting action GetDescriptionUsed to federate with "+parent.getName());
    // FIXME: This embeds the description into a list since the Applet still expects a List
    List tmp = new ArrayList();
    tmp.add(getDescriptionOfThisDF(parent));
    return tmp;
  }
View Full Code Here

   */
  public DFAgentDescription getDFAgentDsc(AID name) throws FIPAException
  {
    DFAgentDescription template = new DFAgentDescription();
    template.setName(name);
    List l = agentDescriptions.search(template, 1);
    if(l.isEmpty())
      return null;
    else
      return (DFAgentDescription)l.get(0);
  }
View Full Code Here

      // Activate the efficient encoding for intra-platform encoding
      ACLCodec efficientCodec = new LEAPACLCodec();
      messageEncodings.put(efficientCodec.getName().toLowerCase(), efficientCodec);
     
      // Codecs
      List l = myProfile.getSpecifiers(Profile.ACLCODECS);
      Iterator codecs = l.iterator();
      while (codecs.hasNext()) {
        Specifier spec = (Specifier) codecs.next();
        String className = spec.getClassName();
        try{
          Class c = Class.forName(className);
          ACLCodec codec = (ACLCodec)c.newInstance();
          messageEncodings.put(codec.getName().toLowerCase(), codec);
          if (myLogger.isLoggable(Logger.CONFIG))
            myLogger.log(Logger.CONFIG,"Installed "+ codec.getName()+ " ACLCodec implemented by " + className + "\n");
         
          // FIXME: notify the AMS of the new Codec to update the APDescritption.
        }
        catch(ClassNotFoundException cnfe){
          throw new jade.lang.acl.ACLCodec.CodecException("ERROR: The class " +className +" for the ACLCodec not found.", cnfe);
        }
        catch(InstantiationException ie) {
          throw new jade.lang.acl.ACLCodec.CodecException("The class " + className + " raised InstantiationException (see NestedException)", ie);
        }
        catch(IllegalAccessException iae) {
          throw new jade.lang.acl.ACLCodec.CodecException("The class " + className  + " raised IllegalAccessException (see nested exception)", iae);
        }
      }
     
      // MTPs
      l = myProfile.getSpecifiers(Profile.MTPS);
      PrintWriter f = null;
      StringBuffer sb = null;
     
      Iterator mtps = l.iterator();
      while (mtps.hasNext()) {
        Specifier spec = (Specifier) mtps.next();
        String className = spec.getClassName();
        String addressURL = null;
        Object[] args = spec.getArgs();
View Full Code Here

        gui = (DFGUIInterface)c.newInstance();
        gui.setAdapter(df.this); //this method must be called to avoid reflection (the constructor of the df gui has no parameters).   
        DFAgentDescription matchEverything = new DFAgentDescription();
        // FIXME: Getting a list with all DFAgentDescriptions may cause out of memory
        // The DFGui should probably be paged and we should use an iterated search.
        List agents = agentDescriptions.search(matchEverything, -1);
        List AIDList = new ArrayList();
        Iterator it = agents.iterator();
        while(it.hasNext())
          AIDList.add(((DFAgentDescription)it.next()).getName());
       
        gui.refresh(AIDList.iterator(), parents.iterator(), children.iterator());
        gui.setVisible(true);
        return true;
       
      }catch(Exception e){e.printStackTrace();}
    }
View Full Code Here

TOP

Related Classes of jade.util.leap.List

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.