de.topicmapslab.majortom.database.transaction.cache
Class ReificationCache

java.lang.Object
  extended by de.topicmapslab.majortom.database.transaction.cache.ReificationCache
All Implemented Interfaces:
IDataStore

public class ReificationCache
extends java.lang.Object
implements IDataStore

Internal data store of reifier-reified relations.

Author:
Sven Krosse

Field Summary
private  org.apache.commons.collections.bidimap.TreeBidiMap reification
          internal storage map if reifier-reified relation
private  org.apache.commons.collections.bidimap.TreeBidiMap removedReifications
          internal storage map if reifier-reified relation
private  TransactionTopicMapStore topicMapStore
          the parent store
 
Constructor Summary
ReificationCache(TransactionTopicMapStore topicMapStore)
          constructor
 
Method Summary
 void close()
          Remove all items from the internal store.
 de.topicmapslab.majortom.model.core.IReifiable getReified(de.topicmapslab.majortom.model.core.ITopic reifier)
          Returns the reified item of the given reifier
 de.topicmapslab.majortom.model.core.ITopic getReifier(de.topicmapslab.majortom.model.core.IReifiable reifiable)
          Returns the current stored reifier of the given reified item.
protected  ModifableTopicMapStoreImpl getTopicMapStore()
          Return the internal stored store instance.
 TransactionTopicMapStore getTransactionStore()
           
protected  boolean isRemovedConstruct(de.topicmapslab.majortom.model.core.IConstruct c)
          Redirect method call to identity store and check if construct is marked as removed.
 void removeReification(de.topicmapslab.majortom.model.core.IReifiable reifiable)
          Remove the reification from the internal store.
 de.topicmapslab.majortom.model.core.IReifiable removeReifier(de.topicmapslab.majortom.model.core.ITopic reifier)
          Remove the reifier from the internal store.
 void replace(de.topicmapslab.majortom.model.core.ITopic topic, de.topicmapslab.majortom.model.core.ITopic replacement, de.topicmapslab.majortom.model.revision.IRevision revision)
          Replace each reference of the given topic by the given replacement.
 de.topicmapslab.majortom.model.core.ITopic setReifier(de.topicmapslab.majortom.model.core.IReifiable reifiable, de.topicmapslab.majortom.model.core.ITopic reifier)
          Create a new relation between the given reifier and the reified construct
private  de.topicmapslab.majortom.model.core.ITopic storeOldReification(de.topicmapslab.majortom.model.core.IReifiable reifiable)
          Internal method to store old reification
private  de.topicmapslab.majortom.model.core.IReifiable storeOldReification(de.topicmapslab.majortom.model.core.ITopic reifier)
          Internal method to store old reification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reification

private org.apache.commons.collections.bidimap.TreeBidiMap reification
internal storage map if reifier-reified relation


removedReifications

private org.apache.commons.collections.bidimap.TreeBidiMap removedReifications
internal storage map if reifier-reified relation


topicMapStore

private final TransactionTopicMapStore topicMapStore
the parent store

Constructor Detail

ReificationCache

public ReificationCache(TransactionTopicMapStore topicMapStore)
constructor

Parameters:
topicMapStore - the transaction store
Method Detail

close

public void close()
Remove all items from the internal store.

Specified by:
close in interface IDataStore

getReifier

public de.topicmapslab.majortom.model.core.ITopic getReifier(de.topicmapslab.majortom.model.core.IReifiable reifiable)
Returns the current stored reifier of the given reified item.

Parameters:
reifiable - the reified item
Returns:
the reifier or null

getReified

public de.topicmapslab.majortom.model.core.IReifiable getReified(de.topicmapslab.majortom.model.core.ITopic reifier)
Returns the reified item of the given reifier

Parameters:
reifier - the reifier
Returns:
the reified item or null

setReifier

public de.topicmapslab.majortom.model.core.ITopic setReifier(de.topicmapslab.majortom.model.core.IReifiable reifiable,
                                                             de.topicmapslab.majortom.model.core.ITopic reifier)
Create a new relation between the given reifier and the reified construct

Parameters:
reifiable - the reified construct
reifier - the reifier
Returns:
the old reifier or null

removeReification

public void removeReification(de.topicmapslab.majortom.model.core.IReifiable reifiable)
Remove the reification from the internal store.

Parameters:
reifiable - reified item

removeReifier

public de.topicmapslab.majortom.model.core.IReifiable removeReifier(de.topicmapslab.majortom.model.core.ITopic reifier)
Remove the reifier from the internal store.

Parameters:
reifiable - reified item
Returns:
the reified item

storeOldReification

private de.topicmapslab.majortom.model.core.ITopic storeOldReification(de.topicmapslab.majortom.model.core.IReifiable reifiable)
Internal method to store old reification

Parameters:
reifiable - the reifiable
Returns:
the old reifier

storeOldReification

private de.topicmapslab.majortom.model.core.IReifiable storeOldReification(de.topicmapslab.majortom.model.core.ITopic reifier)
Internal method to store old reification

Parameters:
reifier - the reifier
Returns:
the old reifiable

replace

public void replace(de.topicmapslab.majortom.model.core.ITopic topic,
                    de.topicmapslab.majortom.model.core.ITopic replacement,
                    de.topicmapslab.majortom.model.revision.IRevision revision)
Replace each reference of the given topic by the given replacement.

Specified by:
replace in interface IDataStore
Parameters:
topic - the topic
replacement - the replacement
revision - the revision

getTopicMapStore

protected ModifableTopicMapStoreImpl getTopicMapStore()
Return the internal stored store instance.

Returns:
the store the store instance

getTransactionStore

public TransactionTopicMapStore getTransactionStore()
Returns:
the topicMapStore

isRemovedConstruct

protected boolean isRemovedConstruct(de.topicmapslab.majortom.model.core.IConstruct c)
Redirect method call to identity store and check if construct is marked as removed.

Parameters:
c - the construct
Returns:
true if the construct was marked as removed, false otherwise.