anthill.nest
Interface Storage

All Superinterfaces:
Clearable
All Known Implementing Classes:
LocalStorage

public interface Storage
extends Clearable

The Storage interface represents the resource storage component of a nest. Resources maintained by a Storage object may be retrieved by invoking the getResource() method. Resources may be added to a storage by invoking methods addAntResource() and addClientResource(). The former method is invoked by ants through their associated AntView object, while the latter is invoked by nest users.

Depending on the implementation, different storage policies may be adopted for resources inserted by ants and users. For example, ants resources may be handled with a LRU policy, while user resources may be stored permanently.

Storage is one of the components of a nest; the other are Manager), RequestSet, Gate and Trail.

Storage methods are invoked by AntView objects to implement methods addResource() and getResources(). The exact behavior of these methods depends on the implementation of Storage.


Method Summary
 void addAntResource(Resource resource)
          Adds a resource to the storage.
 void addClientResource(Resource resource)
          Add a resource to the storage.
 Resource[] getResources(java.lang.Object request)
          Returns the set of resources stored locally which satisfy the request.
 
Methods inherited from interface anthill.util.Clearable
clear
 

Method Detail

getResources

public Resource[] getResources(java.lang.Object request)
Returns the set of resources stored locally which satisfy the request. If no resource can be found, a null value is returned.
Parameters:
request - the request to be satisfied

addAntResource

public void addAntResource(Resource resource)
Adds a resource to the storage. This method is invoked from a nest on behalf of an ant.
Parameters:
resource - the resource to be added

addClientResource

public void addClientResource(Resource resource)
Add a resource to the storage. This method is invoked from a nest on behalf of a nest user.
Parameters:
resource - the resource to be added