Package jade.util.leap

Examples of jade.util.leap.List


  // kindly provided by David Bernstein, 15/6/2005
  public void shutdown() {
    // clone addresses (externally because leap list doesn't
    // implement Cloneable) so don't get concurrent modification
    // exception on the list as the MTPs are being uninstalled
    List platformAddresses = new jade.util.leap.ArrayList();
    Iterator routeIterator = routes.getAddresses();
    while ( routeIterator.hasNext() ) {
      platformAddresses.add( routeIterator.next() );
    }
    // make an uninstall-mtp command to re-use for each MTP installed
    GenericCommand cmd = new GenericCommand( MessagingSlice.UNINSTALL_MTP, getName(), null );
    // for each platform address, uninstall the MTP it represents
    routeIterator = platformAddresses.iterator();
    while ( routeIterator.hasNext() ) {
      String route = (String)routeIterator.next();
      try {
        cmd.addParam( route );
        receiverSink.consume( cmd );
View Full Code Here


  List queryPlatformLocationsAction(QueryPlatformLocationsAction qpl, AID requester) throws FIPAException {
    if (logger.isLoggable(Logger.FINE))
      logger.log(Logger.FINE, "Agent " + requester + " requesting Query-platform-locations");
    // FIXME: Permissions for this action are not yet defined
    ContainerID[] ids = myPlatform.containerIDs();
    List l = new ArrayList();
    for (int i = 0; i < ids.length; ++i) {
      l.add(ids[i]);
    }
    return l;
  }
View Full Code Here

          ContainerID[] cids = impl.containerIDs();
          for(int i = 0; i < cids.length; i++) {
            ContainerID cid = cids[i];
           
            try {
              List mtps = impl.containerMTPs(cid);
              Iterator it = mtps.iterator();
              while(it.hasNext()) {
                MTPDescriptor mtp = (MTPDescriptor)it.next();
                newSlice.addRoute(mtp, cid.getName());
              }
            }
View Full Code Here

  /**
   Return a list of all MTPs in the platform
   */
  private List platformMTPs() {
    List mtps = new ArrayList();
    ContainerID[] cc = myPlatform.containerIDs();
    for (int i = 0; i < cc.length; ++i) {
      try {
        List l = myPlatform.containerMTPs(cc[i]);
        Iterator it = l.iterator();
        while (it.hasNext()) {
          mtps.add(it.next());
        }
      } catch (NotFoundException nfe) {
        // The container has died while we were looping --> ignore it
View Full Code Here

  }
 
 
  protected void startNode() throws IMTPException, ProfileException, ServiceException, JADESecurityException, NotFoundException {
    // Initialize all services (without activating them)
    List services = new ArrayList();
    initMandatoryServices(services);
   
    List l = myProfile.getSpecifiers(Profile.SERVICES);
    myProfile.setSpecifiers(Profile.SERVICES, l); // Avoid parsing services twice
    initAdditionalServices(l.iterator(), services);
     
    // Register with the platform
    ServiceDescriptor[] descriptors = new ServiceDescriptor[services.size()];
    for (int i = 0; i < descriptors.length; ++i) {
      descriptors[i] = (ServiceDescriptor) services.get(i);
View Full Code Here

 
 
  private String[] parseAddressList(String toParse) {
   
    StringTokenizer lexer = new StringTokenizer(toParse, ADDR_LIST_DELIMITERS);
    List addresses = new ArrayList();
    while(lexer.hasMoreTokens()) {
      String tok = lexer.nextToken();
      addresses.add(tok);
    }
   
    Object[] objs = addresses.toArray();
    String[] result = new String[objs.length];
    for(int i = 0; i < result.length; i++) {
      result[i] = (String)objs[i];
    }
   
View Full Code Here

    return result;
  }
 
 
  public List removePendingMessages(MessageTemplate template, boolean notifyFailure) {
    List pendingMsg = ((jade.imtp.leap.FrontEndStub) myFrontEnd).removePendingMessages(template);
    if (pendingMsg.size() > 0) {
      myLogger.log(Logger.INFO, "Removed "+pendingMsg.size()+" pending messages from BackEnd queue.");
    }
    if (notifyFailure) {
      Iterator it = pendingMsg.iterator();
      while (it.hasNext()) {
        try {
          Object[] removed = (Object[]) it.next();
          ACLMessage msg = (ACLMessage) removed[0];
          AID receiver = new AID((String) removed[1], AID.ISLOCALNAME);           
View Full Code Here

  /**
   Add the node to the platform with the basic services
   */
  protected void startNode() throws IMTPException, ProfileException, ServiceException, JADESecurityException, NotFoundException {
    // Initialize all services (without activating them)
    List services = new ArrayList();
   
    initMandatoryServices(services);

    List l = myProfile.getSpecifiers(Profile.SERVICES);
    myProfile.setSpecifiers(Profile.SERVICES, l); // Avoid parsing services twice
    initAdditionalServices(l.iterator(), services);

    // Register with the platform (pass only global services to the Main)
    ServiceDescriptor[] descriptors = new ServiceDescriptor[services.size()];
    for (int i = 0; i < descriptors.length; ++i) {
      descriptors[i] = (ServiceDescriptor) services.get(i);
View Full Code Here

    }
  }

  private void startBootstrapAgents() {
    try {
      List l = myProfile.getSpecifiers(Profile.AGENTS);
      Iterator agentSpecifiers = l.iterator();
      while(agentSpecifiers.hasNext()) {
        Specifier s = (Specifier) agentSpecifiers.next();
        if (s.getName() != null) {
          AID agentID = new AID(s.getName(), AID.ISLOCALNAME);
View Full Code Here

        else if (cmdName.equals(MessagingSlice.H_CURRENTALIASES)) {
          globalAliases = (Hashtable) params[0];
        }
        else if (cmdName.equals(MessagingSlice.H_TRANSFERLOCALALIASES)) {
          AID agent = (AID) params[0];
          List aliases = (List) params[1];
          Iterator it = aliases.iterator();
          while (it.hasNext()) {
            localAliases.put((AID) it.next(), agent);
          }
        }
      }
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.