|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.semanticdesktop.aperture.accessor.base.AccessDataImpl
public class AccessDataImpl
Simple AccessData implementation that holds all information in main memory. No persistency facilities are provided, see FileAccessData for that.
FileAccessData
Field Summary | |
---|---|
protected Map<String,org.semanticdesktop.aperture.accessor.base.AccessDataImpl.AggregationNode> |
aggregatedIDMap
A mapping from IDs to Sets of IDs that the former ID aggregates. |
protected Map<String,Map<String,String>> |
idMap
A Map mapping IDs to another Map that contains the key-value pairs for that ID. |
protected Map<String,Set<String>> |
referredIDMap
A mapping from IDs to Sets of IDs that the former ID refers to. |
Fields inherited from interface org.semanticdesktop.aperture.accessor.AccessData |
---|
BYTE_SIZE_KEY, DATE_KEY, REDIRECTS_TO_KEY |
Constructor Summary | |
---|---|
AccessDataImpl()
|
Method Summary | |
---|---|
void |
clear()
Clears this AccessData. |
String |
get(String id,
String key)
Gets specific information about the specified id. |
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 the given id has been touched during the current crawl, false otherwise |
void |
put(String id,
String key,
String value)
Stores information (a key-value pair) for the specified id. |
void |
putAggregatedID(String parentId,
String childID)
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 |
Field Detail |
---|
protected Map<String,Map<String,String>> idMap
protected Map<String,Set<String>> referredIDMap
protected Map<String,org.semanticdesktop.aperture.accessor.base.AccessDataImpl.AggregationNode> aggregatedIDMap
Constructor Detail |
---|
public AccessDataImpl()
Method Detail |
---|
public void initialize() throws IOException
AccessData
initialize
in interface AccessData
IOException
AccessData.initialize()
public void store() throws IOException
AccessData
store
in interface AccessData
IOException
AccessData.store()
public void clear() throws IOException
AccessData
clear
in interface AccessData
IOException
AccessData.clear()
public int getSize()
AccessData
getSize
in interface AccessData
AccessData.getSize()
public Set getStoredIDs()
AccessData
getStoredIDs
in interface AccessData
AccessData.getStoredIDs()
public boolean isKnownId(String id)
AccessData
isKnownId
in interface AccessData
AccessData.isKnownId(String)
public void put(String id, String key, String value)
AccessData
put
in interface AccessData
id
- The resource's ID.key
- The info key.value
- The info value.AccessData.put(String, String, String)
public void putReferredID(String id, String referredID)
AccessData
putReferredID
in interface AccessData
id
- The referring resource's ID.referredID
- The referred resource's ID.AccessData.putReferredID(String, String)
public String get(String id, String key)
AccessData
get
in interface AccessData
id
- The resource's ID.key
- The info key.
AccessData.get(String, String)
public Set getReferredIDs(String id)
AccessData
getReferredIDs
in interface AccessData
AccessData.getReferredIDs(String)
public void remove(String id, String key)
AccessData
remove
in interface AccessData
id
- A resource ID.key
- A key under which info is stored.AccessData.remove(String, String)
public void removeReferredID(String id, String referredID)
AccessData
removeReferredID
in interface AccessData
id
- The referring resource's ID.referredID
- The referred resource's ID.AccessData.removeReferredID(String, String)
public void removeReferredIDs(String id)
AccessData
removeReferredIDs
in interface AccessData
id
- The referring resource's ID.public void remove(String id)
AccessData
remove
in interface AccessData
id
- A resource ID.public Set getAggregatedIDs(String id)
AccessData
getAggregatedIDs
in interface AccessData
public void putAggregatedID(String parentId, String childID)
AccessData
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.
putAggregatedID
in interface AccessData
parentId
- the parent idchildID
- the aggregated idpublic void removeAggregatedID(String id, String aggregatedID)
AccessData
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.
removeAggregatedID
in interface AccessData
public ClosableIterator getUntouchedIDsIterator()
AccessData
AccessData.initialize()
getUntouchedIDsIterator
in interface AccessData
public void removeUntouchedIDs()
AccessData
removeUntouchedIDs
in interface AccessData
public void touchRecursively(String id)
AccessData
touchRecursively
in interface AccessData
public void touch(String id)
AccessData
AccessData.getUntouchedIDsIterator()
and
will not be removed by AccessData.removeUntouchedIDs()
touch
in interface AccessData
public ClosableIterator getAggregatedIDsClosure(String id)
AccessData
getAggregatedIDsClosure
in interface AccessData
id
- the id whose aggregation subtree is to be traversed
public boolean isTouched(String id)
isTouched
in interface AccessData
id
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |