ants.jxtagnutant
Class UrlStorage
java.lang.Object
|
+--anthill.storage.impl.LRUKeyStorage
|
+--anthill.storage.impl.LRUQueryStorage
|
+--ants.jxtagnutant.UrlStorage
- All Implemented Interfaces:
- Clearable, GenericStorage, QueryStorage, ResourceManager, Storage
- public class UrlStorage
- extends LRUQueryStorage
- implements QueryStorage
Implementation of an Least Recently Used (LRU) based URL storage.
- Version:
- $Revision: 1.3 $
- Author:
- Hein Meling
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UrlStorage
public UrlStorage(Factory factory,
String name)
addResource
public void addResource(Object resourceKey,
Resource urlResource)
throws CapacityException
- Adds a resource to the storage and associates it to the specified
key. If the remaining capacity of the storage is not sufficient to
store the resource, a
CapacityException
is thrown
containing information about the remaining capacity. Method
size()
may be invoked on the resource
to determine the amount of space required by the resource.
In order to be stored on persistent storage, resource must
implement the Serializable
interface.
This is a specialized implementation that will add URLs pointing
to a file with the same resourceKey
to a URL resource
set before adding that URL set to the storage.
- Specified by:
addResource
in interface GenericStorage
- Overrides:
addResource
in class LRUKeyStorage
- Parameters:
resourceKey
- the key identifying the URL resourceurlResource
- the URL resource to be added
- Throws:
CapacityException
- raised if the given resource object
exceeds the total available capacity for this storage.
getResources
public Resource[] getResources(Object query)
- Description copied from interface:
QueryStorage
- Return the resource associated with the specified query.
- Specified by:
getResources
in interface QueryStorage
- Overrides:
getResources
in class LRUQueryStorage
- Parameters:
query
- whose associated resource to retreive.
- Returns:
- resources found in the storage with which the
specified query matched.