Package jade.domain.FIPAAgentManagement

Examples of jade.domain.FIPAAgentManagement.InternalError


      return request;
    }
    catch (Exception e) {
      // Should never happen
      e.printStackTrace();
      result = new InternalError("Error encoding request ["+e.getMessage()+"]");
    }
    return null;
  }
View Full Code Here


      if (p instanceof Result) {
        result = ((Result) p).getValue();
      }
    }
    catch (Exception e) {
      result = new InternalError("Error decoding response ["+e.getMessage()+"]");
    }
  }
View Full Code Here

      result = new InternalError("Error decoding response ["+e.getMessage()+"]");
    }
  }
 
  protected void handleRefuse(ACLMessage refuse) {
    result = new InternalError("Agent "+remoteDF.getName()+" replyed with "+ACLMessage.getPerformative(refuse.getPerformative()));
  }
View Full Code Here

  protected void handleRefuse(ACLMessage refuse) {
    result = new InternalError("Agent "+remoteDF.getName()+" replyed with "+ACLMessage.getPerformative(refuse.getPerformative()));
  }
 
  protected void handleNotUnderstood(ACLMessage notUnderstood) {
    result = new InternalError("Agent "+remoteDF.getName()+" replyed with "+ACLMessage.getPerformative(notUnderstood.getPerformative()));
  }
View Full Code Here

  protected void handleNotUnderstood(ACLMessage notUnderstood) {
    result = new InternalError("Agent "+remoteDF.getName()+" replyed with "+ACLMessage.getPerformative(notUnderstood.getPerformative()));
  }
 
  protected void handleFailure(ACLMessage failure) {
    result = new InternalError("Agent "+remoteDF.getName()+" replyed with "+ACLMessage.getPerformative(failure.getPerformative()));
  }
View Full Code Here

   @exception FIPAException if the search id is already in the cache.
   */
  private void checkSearchId(String searchId) throws FIPAException {
    if (searchId != null) {
      if (searchIdCache.contains(searchId)) {
        throw new InternalError("search-id already served");
      }
      else {
        searchIdCache.add(searchId);
      }
    }
View Full Code Here

   
    private void handleNotifyFailure(VerticalCommand cmd) {
      Object[] params = cmd.getParams();
      GenericMessage msg = (GenericMessage)params[0];
      AID receiver = (AID)params[1];
      InternalError ie = (InternalError)params[2];
     
      // The acl message contained inside the GenericMessage cannot be null; the notifyFailureToSender() method already checks that
      ACLMessage aclmsg = msg.getACLMessage();
      if((aclmsg.getSender()==null) || (aclmsg.getSender().equals(myContainer.getAMS()))) // sanity check to avoid infinite loops
        return;
     
      // Send back a failure message
      final ACLMessage failure = aclmsg.createReply();
      failure.setPerformative(ACLMessage.FAILURE);
      final AID theAMS = myContainer.getAMS();
      failure.setSender(theAMS);
      failure.setLanguage(FIPANames.ContentLanguage.FIPA_SL);
     
      // FIXME: the content is not completely correct, but that should
      // also avoid creating wrong content
      String content = "( (action " + msg.getSender().toString();
      content = content + " (ACLMessage) ) (MTS-error "+receiver+" "+ie.getMessage() + ") )";
      failure.setContent(content);
     
      try {
        GenericCommand command = new GenericCommand(MessagingSlice.SEND_MESSAGE, MessagingSlice.NAME, null);
        command.addParam(theAMS);
View Full Code Here

                            "]: trying the next one...");
                    }
                }

                notifyFailureToSender(msg, receiverID,
                    new InternalError("No valid address contained within the AID " +
                        receiverID.getName()));
            }
        }
        catch (NotFoundException nfe) {
            // The receiver does not exist --> Send a FAILURE message
            notifyFailureToSender(msg, receiverID,
                new InternalError("Agent not found: " + nfe.getMessage()));
        }
        catch (JADESecurityException jse) {
            // The receiver does not exist --> Send a FAILURE message
            notifyFailureToSender(msg, receiverID,
                new InternalError("Not authorized: " + jse.getMessage()));
        }
    }
View Full Code Here

    private void handleNotifyFailure(VerticalCommand cmd)
        throws JADESecurityException {
        Object[] params = cmd.getParams();
        GenericMessage msg = (GenericMessage) params[0];
        AID receiver = (AID) params[1];
        InternalError ie = (InternalError) params[2];

        // If (the sender is not the AMS and the performative is not FAILURE)
        ACLMessage aclmsg = msg.getACLMessage();

        if ((aclmsg.getSender() == null) ||
                ((aclmsg.getSender().equals(myContainer.getAMS())) &&
                (aclmsg.getPerformative() == ACLMessage.FAILURE))) { // sanity check to avoid infinite loops

            return;
        }

        // Send back a failure message
        final ACLMessage failure = aclmsg.createReply();
        failure.setPerformative(ACLMessage.FAILURE);

        //System.err.println(failure.toString());
        final AID theAMS = myContainer.getAMS();
        failure.setSender(theAMS);
        failure.setLanguage(FIPANames.ContentLanguage.FIPA_SL);

        // FIXME: the content is not completely correct, but that should
        // also avoid creating wrong content
        String content = "( (action " + msg.getSender().toString();
        content = content + " (ACLMessage) ) (MTS-error " + receiver + " \"" +
            ie.getMessage() + "\") )";
        failure.setContent(content);

        try {
            GenericCommand command = new GenericCommand(MessagingSlice.SEND_MESSAGE,
                    MessagingSlice.NAME, null);
View Full Code Here

          ch.deliverNow(msg, receiverID);
        }
        catch (Throwable t) {
          // A MessageManager deliverer thread must never die
          myLogger.log(Logger.WARNING, "MessageManager cannot deliver message "+stringify(msg)+" to agent "+receiverID.getName(), t);
          ch.notifyFailureToSender(msg, receiverID, new InternalError(ACLMessage.AMS_FAILURE_UNEXPECTED_ERROR + ": "+t));
        }
        servedCnt++;
        outBox.handleServed(receiverID);
      }
    }
View Full Code Here

TOP

Related Classes of jade.domain.FIPAAgentManagement.InternalError

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.