Package jade.util.leap

Examples of jade.util.leap.Iterator


      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();
        if (args != null && args.length > 0) {
          addressURL = args[0].toString();
View Full Code Here


  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 );
        cmd.removeParam( route );
        if ( myLogger.isLoggable( Logger.FINER ) ) {
View Full Code Here

    }
  }
 
  private void notifyAliasListeners(AID alias, AID agent, boolean added) {
    synchronized (aliasListeners) {
      Iterator it = aliasListeners.iterator();
      while (it.hasNext()) {
        MessagingHelper.AliasListener listener = (MessagingHelper.AliasListener) it.next();
        try {
          if (added) {
            // Alias added
            listener.handleNewAlias(alias, agent);
          }
View Full Code Here

  // Public since it is replicated by the MainReplicationService
  public void removeGlobalAliases(AID agent) {
    myLogger.log(Logger.FINE, "Removing all global alias entries for agent "+agent.getLocalName());
    List removedAliases = removeEntriesFor(globalAliases, agent);
    // Notify listeners
    Iterator it = removedAliases.iterator();
    while (it.hasNext()) {
      AID alias = (AID) it.next();
      notifyAliasListeners(alias, agent, false);
    }
  }
View Full Code Here

  public String[] getOwnedCommands() {
    return OWNED_COMMANDS;
  }
 
  void notifyLocalMTPs() {
    Iterator it = routes.getLocalMTPs();
    while (it.hasNext()) {
      RoutingTable.MTPInfo info = (RoutingTable.MTPInfo) it.next();
      MTPDescriptor mtp = info.getDescriptor();
      ContainerID cid = myContainer.getID();
     
      try {
        MessagingSlice mainSlice = (MessagingSlice)getSlice(MAIN_SLICE);
View Full Code Here

      else {
        // Dispatch it through the ACC
        if (msg.getTraceID() != null) {
          myLogger.log(Logger.INFO, msg.getTraceID() + " - Activating ACC delivery");
        }
        Iterator addresses = receiverID.getAllAddresses();
        if (addresses.hasNext()) {
          while (addresses.hasNext()) {
            String address = (String) addresses.next();
            try {
              forwardMessage(msg, receiverID, address);
              return;
            }
            catch (MTPException mtpe) {
View Full Code Here

  /*
   * This method is called before preparing the Envelope of an outgoing message.
   * It checks for all the AIDs present in the message and adds the addresses, if not present
   **/
  private void addPlatformAddresses(AID id) {
    Iterator it = routes.getAddresses();
    while(it.hasNext()) {
      String addr = (String)it.next();
      id.addAddresses(addr);
    }
  }
View Full Code Here

      }
    }
  }
 
  private final boolean isPlatformAddress(String addr) {
    Iterator it = routes.getAddresses();
    while(it.hasNext()) {
      String ad = (String)it.next();
      if (CaseInsensitiveString.equalsIgnoreCase(ad, addr)) {
        return true;
      }
    }
    return false;
View Full Code Here

      }
    }
  }
 
  private String getTraceId(Envelope env) {
    Iterator it = env.getAllProperties();
    while (it.hasNext()) {
      Property p = (Property) it.next();
      if (p.getName().equals(ACLMessage.TRACE)) {
        return (String) p.getValue();
      }
    }
    return null;
View Full Code Here

    if(gui != null) {
      gui.disposeAsync();
    }
    DFAgentDescription dfd = new DFAgentDescription();
    dfd.setName(getAID());
    Iterator it = parents.iterator();
    while(it.hasNext()) {
      AID parentName = (AID)it.next();
      try {
        DFService.deregister(this, parentName, dfd);
      }
      catch(FIPAException fe) {
        fe.printStackTrace();
View Full Code Here

TOP

Related Classes of jade.util.leap.Iterator

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.