Package jade.domain.FIPAAgentManagement

Examples of jade.domain.FIPAAgentManagement.AMSAgentDescription


  public void bornAgent(AID aid, ContainerID cid, JADEPrincipal principal, String ownership, boolean forceReplacement) throws NameClashException, NotFoundException {
    AgentDescriptor ad = new AgentDescriptor(AgentDescriptor.NATIVE_AGENT);
    ad.setContainerID(cid);
    ad.setPrincipal(principal);
    // Registration to the With Pages service
    AMSAgentDescription amsd = new AMSAgentDescription();
    amsd.setName(aid);
    amsd.setOwnership(ownership);
    amsd.setState(AMSAgentDescription.ACTIVE);
    ad.setDescription(amsd);
   
    AgentDescriptor old = platformAgents.put(aid, ad);
    if(old != null) {
      // There's already an agent with name 'name'
View Full Code Here


   */
  public void suspendedAgent(AID name) throws NotFoundException {
    AgentDescriptor ad = platformAgents.acquire(name);
    if (ad == null)
      throw new NotFoundException("SuspendedAgent failed to find " + name);
    AMSAgentDescription amsd = ad.getDescription();
    if (amsd != null) {
      amsd.setState(AMSAgentDescription.SUSPENDED);
    }
    ContainerID cid = ad.getContainerID();
    platformAgents.release(name);
   
    // Notify listeners
View Full Code Here

   */
  public void resumedAgent(AID name) throws NotFoundException {
    AgentDescriptor ad = platformAgents.acquire(name);
    if(ad == null)
      throw new NotFoundException("ResumedAgent failed to find " + name);
    AMSAgentDescription amsd = ad.getDescription();
    if (amsd != null) {
      amsd.setState(AMSAgentDescription.ACTIVE);
    }
    ContainerID cid = ad.getContainerID();
    platformAgents.release(name);
   
    // Notify listeners
View Full Code Here

   */
  public void frozenAgent(AID name, ContainerID bufferContainer) throws NotFoundException {
    AgentDescriptor ad = platformAgents.acquire(name);
    if (ad == null)
      throw new NotFoundException("FrozenAgent failed to find " + name);
    AMSAgentDescription amsd = ad.getDescription();
    if (amsd != null) {
      amsd.setState(AMSAgentDescription.SUSPENDED);
    }
    ContainerID cid = ad.getContainerID();
    platformAgents.release(name);
   
    // Notify listeners
View Full Code Here

   */
  public void thawedAgent(AID name, ContainerID bufferContainer) throws NotFoundException {
    AgentDescriptor ad = platformAgents.acquire(name);
    if (ad == null)
      throw new NotFoundException("ThawedAgent failed to find " + name);
    AMSAgentDescription amsd = ad.getDescription();
    if (amsd != null) {
      amsd.setState(AMSAgentDescription.ACTIVE);
    }
    ContainerID cid = ad.getContainerID();
    platformAgents.release(name);
   
    // Notify listeners
View Full Code Here

     
      // Update the AMS-descriptions of all registered agents living in the platform
      AID[] allIds = platformAgents.keys();
      for (int i = 0; i < allIds.length; ++i) {
        AgentDescriptor ad = platformAgents.acquire(allIds[i]);
        AMSAgentDescription dsc = ad.getDescription()
        if (dsc != null && ad.isNative()) {
          AID id = dsc.getName();
          id.addAddresses(mtpAddress);
        }
        platformAgents.release(allIds[i]);
      }
     
View Full Code Here

     
      // Update the AMS-descriptions of all agents living in the platform
      AID[] allIds = platformAgents.keys();
      for (int i = 0; i < allIds.length; ++i) {
        AgentDescriptor ad = platformAgents.acquire(allIds[i]);
        AMSAgentDescription dsc = ad.getDescription()
        if (ad.isNative()) {
          AID id = dsc.getName();
          id.removeAddresses(mtpAddress);
        }
        platformAgents.release(allIds[i]);
      }
     
View Full Code Here

    // Mandatory slots have already been checked
    AID agentID = dsc.getName();
   
    AgentDescriptor ad = platformAgents.acquire(agentID);
    if (ad != null) {
      AMSAgentDescription oldDsc = ad.getDescription();
      if (oldDsc != null) {
        ad.setDescription(dsc);
        String newState = dsc.getState();
        String newOwnership = dsc.getOwnership();
        if (newOwnership == null) {
          newOwnership = oldDsc.getOwnership();
        }
        platformAgents.release(agentID);
        if (ad.isNative()) {
          // This is an agent living in the platform --> if necessary
          // force changes in agent state and ownership
          if (AMSAgentDescription.SUSPENDED.equals(newState) && !AMSAgentDescription.SUSPENDED.equals(oldDsc.getState())) {
            suspend(agentID);
          }
          if (AMSAgentDescription.ACTIVE.equals(newState) && !AMSAgentDescription.ACTIVE.equals(oldDsc.getState())) {
            activate(agentID);
          }
          if (newOwnership != null && newOwnership != oldDsc.getOwnership()) {
            /*byte[] password = Agent.extractPassword(newOwnership);
             String username = Agent.extractUsername(newOwnership);
             take(agentID, username, password);*/
          }
        }
 
View Full Code Here

  public List amsSearch(AMSAgentDescription template, long maxResults) {
    List results = new ArrayList();
    AID[] ids = platformAgents.keys();
    for (int i = 0; i < ids.length; ++i) {
      try {
        AMSAgentDescription amsd = getAMSDescription(ids[i]);
        if (match(template, amsd)) {
          results.add(amsd);
          if (results.size() >= maxResults) {
            break;
          }
View Full Code Here

   */
  public AMSAgentDescription getAMSDescription(AID agentID) throws NotFoundException {
    AgentDescriptor ad = platformAgents.acquire(agentID);
    if(ad == null)
      throw new NotFoundException("getAMSDescription() failed to find agent " + agentID.getName());
    AMSAgentDescription amsd = ad.getDescription();
    platformAgents.release(agentID);
    return amsd;
  }
View Full Code Here

TOP

Related Classes of jade.domain.FIPAAgentManagement.AMSAgentDescription

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.