    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JavaAgent.resource.RetrievalResource

    java.lang.Object
       |
       +----JavaAgent.resource.Resource
               |
               +----JavaAgent.resource.RetrievalResource

public abstract class RetrievalResource
extends Resource

Subclass of Resource which the Agent will attempt to retrieve from other Agents when that resource is not available. Example of this type of Resource are: addresses, languages and interpreters.

Copyright (c) 1995, H. Robert Frost, Stanford University. All rights reserved.

Copyright (c) 1996, H. Robert Frost, Enterprise Integration Technologies, Inc. All rights reserved.

RESTRICTED RIGHTS LEGEND: Use, duplication or disclosure by the Government is subject to restrictions as set forth in subparagraph(c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013 and in similar clauses in the FAR and NASA FAR supplement.

This software is bound by the terms and conditions listed in the attached LICENSE file.

##

BLOCK
  Block retrieval.
SEND_MSG
  Send out message then block.

##

RetrievalResource(Agent)
  Constructor for the resource.

##

block(Object)
  Block until the element is put in the Resource.
getMissingAction(Object, int, String)
  Called when there is an attempt to retrieve an element associated with a non-existent identifier.
getReceiver(Object)
getType()
send_message(Object, String)
  Send out a retrieval message.

##

BLOCK

     public static final int BLOCK

  Block retrieval.

SEND_MSG

     public static final int SEND_MSG

  Send out message then block.

##

RetrievalResource

     public RetrievalResource(Agent agent)

  Constructor for the resource.

  Parameters:
    agent - The Agent which owns the resource.

##

getMissingAction

     public Object getMissingAction(Object identifier,
                                    int retrieve_option,
                                    String receiver) throws ResourceException

  Called when there is an attempt to retrieve an element associated with a non-existent identifier. If an attempt to retrieve the given identifier should be taken (determined by the abstract retrieve() method, then the action taken depends on the specified retrieve_option:
  - BLOCK: block until either the element is inserted into the Resource or RETRIEVAL_WAIT msec have expired.
  - SEND_MSG: send a message with receiver and content fields defined by abstract methods then BLOCK.
  Other options can be specified by subclasses of RetrievalResource. If the element is null, the Agent was unable to retrieve the element and the null object is removed and a ResourceException is thrown.

  Parameters:
    identifier - Object identifier for the element.
    retrieve_option - Specifies action to take if the element is not currently present.
    receiver - Agent to whom retrieve requests should be sent, null if default should be used.
  Returns:
    Object to be returned.
  Overrides:
    getMissingAction in class Resource

block

     protected Object block(Object identifier) throws ResourceException

  Block until the element is put in the Resource. Each wait is timed and after a set number of notify calls the retrieval attempt is halted and a exception is thrown.

  Parameters:
    identifier - Identifier for the element.

send_message

     protected void send_message(Object identifier,
                                 String receiver)

  Send out a retrieval message.

  Parameters:
    identifier - Object identifier for the element.
    receiver - Agent to whom retrieve requests should be sent, null if default should be used.

getReceiver

     protected abstract String getReceiver(Object identifier)

getType

     protected abstract String getType()

    All Packages  Class Hierarchy  This Package  Previous  Next  Index