org.semanticdesktop.aperture.accessor.base
Class FilterAccessData

java.lang.Object
  extended by org.semanticdesktop.aperture.accessor.base.FilterAccessData
All Implemented Interfaces:
AccessData

public abstract class FilterAccessData
extends Object
implements AccessData

Abstract superclass for AccessData implementations that wrap other AccessData instances in order to filter certain information. The abstract class FilterAccessData itself provides default methods that pass requests to the contained AccessData. Subclasses of FilterAccessData should override some of these methods and may also provide additional methods and fields.


Field Summary
 
Fields inherited from interface org.semanticdesktop.aperture.accessor.AccessData
BYTE_SIZE_KEY, DATE_KEY, REDIRECTS_TO_KEY
 
Constructor Summary
FilterAccessData(AccessData accessData)
           
 
Method Summary
 void clear()
          Clears this AccessData.
 String get(String id, String key)
          Gets specific information about the specified id.
 AccessData getAccessData()
           
 Set getAggregatedIDs(String id)
          Returns a set of id's that are aggregated immediately below the given one.
 ClosableIterator getAggregatedIDsClosure(String id)
          Returns an iterator over all ids aggregated within the given one, both directly and indirectly.
 Set getReferredIDs(String id)
          Returns all referred resources of the specified resource.
 int getSize()
          Gets the number of resources for which information has been stored in this AccessData.
 Set getStoredIDs()
          Gets the IDs of all resources for which information has been stored in this AccessData.
 ClosableIterator getUntouchedIDsIterator()
          Returns an iterator over all ID's in this access data instance that have not been touched since the last call to AccessData.initialize()
 void initialize()
          Prepares the AccessData for operation.
 boolean isKnownId(String id)
          Returns whether this AccessData holds any information about the specified ID.
 boolean isTouched(String id)
          Returns true if this id is known and has been touched since the last call to AccessData.initialize(), false if the id is not known, or hasn't been touched since the last call to AccessData.initialize().
 void put(String id, String key, String value)
          Stores information (a key-value pair) for the specified id.
 void putAggregatedID(String id, String aggregatedID)
          Puts a link between the given id and the aggregated ID.
 void putReferredID(String id, String referredID)
          Stores a reference relation between two resources, modeling e.g. a link.
 void remove(String id)
          Removes all information about the resource with the specified ID.
 void remove(String id, String key)
          Removes the value for the specified id and key.
 void removeAggregatedID(String id, String aggregatedID)
          Removes the link between the given id and the aggregated ID.
 void removeReferredID(String id, String referredID)
          Removes a reference relationship between two resources.
 void removeReferredIDs(String id)
          Removes all referred IDs of a resource.
 void removeUntouchedIDs()
          Removes all untouched IDS
 void store()
          Informs the AccessData that processing has completed and, in case of a persistent storage, now is a good time to write or flush results.
 void touch(String id)
          Touches an id.
 void touchRecursively(String id)
          Recursively touches all ids within the aggregation subtree beginning with the given id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterAccessData

public FilterAccessData(AccessData accessData)
Method Detail

getAccessData

public AccessData getAccessData()

clear

public void clear()
           throws IOException
Description copied from interface: AccessData
Clears this AccessData. This may be invoked on initialized and unititialized AccessData's. Both in-memory information as any persistent storage will be cleared. Afterwards the AccessData may be in an unusable state until 'initialize' is invoked again.

Specified by:
clear in interface AccessData
Throws:
IOException

get

public String get(String id,
                  String key)
Description copied from interface: AccessData
Gets specific information about the specified id.

Specified by:
get in interface AccessData
Parameters:
id - The resource's ID.
key - The info key.
Returns:
The stored info value, or null if no info has been stored for the specified id and key.

getReferredIDs

public Set getReferredIDs(String id)
Description copied from interface: AccessData
Returns all referred resources of the specified resource.

Specified by:
getReferredIDs in interface AccessData
Returns:
A Set of Strings, or null when there are no referred resources registered for this resource.

getSize

public int getSize()
Description copied from interface: AccessData
Gets the number of resources for which information has been stored in this AccessData.

Specified by:
getSize in interface AccessData
Returns:
The number of registered resources.

getStoredIDs

public Set getStoredIDs()
Description copied from interface: AccessData
Gets the IDs of all resources for which information has been stored in this AccessData.

Specified by:
getStoredIDs in interface AccessData
Returns:
A Set of Strings.

initialize

public void initialize()
                throws IOException
Description copied from interface: AccessData
Prepares the AccessData for operation. This may for example mean reading files or opening repositories that hold the stored data.

Specified by:
initialize in interface AccessData
Throws:
IOException

isKnownId

public boolean isKnownId(String id)
Description copied from interface: AccessData
Returns whether this AccessData holds any information about the specified ID.

Specified by:
isKnownId in interface AccessData
Returns:
"true" when this AccessData has information about the specified ID, "false" otherwise.

put

public void put(String id,
                String key,
                String value)
Description copied from interface: AccessData
Stores information (a key-value pair) for the specified id.

Specified by:
put in interface AccessData
Parameters:
id - The resource's ID.
key - The info key.
value - The info value.

putReferredID

public void putReferredID(String id,
                          String referredID)
Description copied from interface: AccessData
Stores a reference relation between two resources, modeling e.g. a link.

Specified by:
putReferredID in interface AccessData
Parameters:
id - The referring resource's ID.
referredID - The referred resource's ID.

remove

public void remove(String id,
                   String key)
Description copied from interface: AccessData
Removes the value for the specified id and key.

Specified by:
remove in interface AccessData
Parameters:
id - A resource ID.
key - A key under which info is stored.

remove

public void remove(String id)
Description copied from interface: AccessData
Removes all information about the resource with the specified ID.

Specifically: Note that this method does NOT remove ids this id is referred BY. I.e. it does remove "outgoing" referredID links but it does NOT remove "incomming" referred ID's. To be on the safe side - the crawler should take care about this by itself.

Specified by:
remove in interface AccessData
Parameters:
id - A resource ID.

removeReferredID

public void removeReferredID(String id,
                             String referredID)
Description copied from interface: AccessData
Removes a reference relationship between two resources.

Specified by:
removeReferredID in interface AccessData
Parameters:
id - The referring resource's ID.
referredID - The referred resource's ID.

removeReferredIDs

public void removeReferredIDs(String id)
Description copied from interface: AccessData
Removes all referred IDs of a resource.

Specified by:
removeReferredIDs in interface AccessData
Parameters:
id - The referring resource's ID.

store

public void store()
           throws IOException
Description copied from interface: AccessData
Informs the AccessData that processing has completed and, in case of a persistent storage, now is a good time to write or flush results. Afterwards the AccessData may be in an unusable state until 'initialize' is invoked again.

Specified by:
store in interface AccessData
Throws:
IOException

getAggregatedIDs

public Set getAggregatedIDs(String id)
Description copied from interface: AccessData
Returns a set of id's that are aggregated immediately below the given one.

Specified by:
getAggregatedIDs in interface AccessData
Returns:
a set of id's that are aggregated immediately below the given one.
See Also:
AccessData.getAggregatedIDs(java.lang.String)

getAggregatedIDsClosure

public ClosableIterator getAggregatedIDsClosure(String id)
Description copied from interface: AccessData
Returns an iterator over all ids aggregated within the given one, both directly and indirectly. The iterator will traverse the entire aggregation subtree beginning with the given id.

Specified by:
getAggregatedIDsClosure in interface AccessData
Parameters:
id - the id whose aggregation subtree is to be traversed
Returns:
an iterator over the aggregation subtree
See Also:
AccessData.getAggregatedIDsClosure(java.lang.String)

getUntouchedIDsIterator

public ClosableIterator getUntouchedIDsIterator()
Description copied from interface: AccessData
Returns an iterator over all ID's in this access data instance that have not been touched since the last call to AccessData.initialize()

Specified by:
getUntouchedIDsIterator in interface AccessData
Returns:
an iterator over all untouched IDs
See Also:
AccessData.getUntouchedIDsIterator()

putAggregatedID

public void putAggregatedID(String id,
                            String aggregatedID)
Description copied from interface: AccessData
Puts a link between the given id and the aggregated ID. The aggregated ID will appear in the aggregation closure (returned by AccessData.getAggregatedIDsClosure(String)), will be touched by the AccessData.touchRecursively(String) method, it will be removed if the id is removed (@link AccessData.remove(String)). Note that the aggregation graph must not contain cycles, each id can have at most one parent, the implementations are expected to enforce this. If the aggregatedID had a parent before, the previous link will be removed.

Specified by:
putAggregatedID in interface AccessData
Parameters:
id - the parent id
aggregatedID - the aggregated id
See Also:
AccessData.putAggregatedID(java.lang.String, java.lang.String)

removeAggregatedID

public void removeAggregatedID(String id,
                               String aggregatedID)
Description copied from interface: AccessData
Removes the link between the given id and the aggregated ID. After a call to this method, the aggregated ID will not appear in the aggregation closure (AccessData.getAggregatedIDsClosure(String) and will not be touched by the AccessData.touchRecursively(String) method. A call to remove the id will not remove the aggregated id.

Specified by:
removeAggregatedID in interface AccessData
See Also:
AccessData.removeAggregatedID(java.lang.String, java.lang.String)

removeUntouchedIDs

public void removeUntouchedIDs()
Description copied from interface: AccessData
Removes all untouched IDS

Specified by:
removeUntouchedIDs in interface AccessData
See Also:
AccessData.removeUntouchedIDs()

touchRecursively

public void touchRecursively(String id)
Description copied from interface: AccessData
Recursively touches all ids within the aggregation subtree beginning with the given id

Specified by:
touchRecursively in interface AccessData
See Also:
AccessData.touchRecursively(java.lang.String)

isTouched

public boolean isTouched(String id)
Description copied from interface: AccessData
Returns true if this id is known and has been touched since the last call to AccessData.initialize(), false if the id is not known, or hasn't been touched since the last call to AccessData.initialize().

Specified by:
isTouched in interface AccessData
Parameters:
id - the id to check
Returns:
true if the id has been touched, false if not
See Also:
AccessData.isTouched(java.lang.String)

touch

public void touch(String id)
Description copied from interface: AccessData
Touches an id. This id will not appear on the list returned by AccessData.getUntouchedIDsIterator() and will not be removed by AccessData.removeUntouchedIDs()

Specified by:
touch in interface AccessData
See Also:
AccessData.touch(java.lang.String)


Copyright © 2010 Aperture Development Team. All Rights Reserved.