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

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

public class CharacteristicsCache
extends java.lang.Object
implements IDataStore

Author:
Sven Krosse

Field Summary
private  java.util.Set<java.lang.String> changedDatatypes
           
private  java.util.Map<de.topicmapslab.majortom.model.core.ILocator,java.util.Set<de.topicmapslab.majortom.model.core.IDatatypeAware>> dataTyped
          storage map of datatype mapping
private  java.util.Map<de.topicmapslab.majortom.model.core.IDatatypeAware,de.topicmapslab.majortom.model.core.ILocator> dataTypes
          storage map of datatype mapping
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.IName>> names
          storage map of topic-name mapping
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence>> occurrences
          storage map of topic-occurrence mapping
private  TransactionTopicMapStore topicMapStore
           
private  java.util.Map<de.topicmapslab.majortom.model.core.IConstruct,java.lang.Object> values
          storage map of characteristics-value mapping
private  java.util.Map<de.topicmapslab.majortom.model.core.IName,java.util.Set<de.topicmapslab.majortom.model.core.IVariant>> variants
          storage map of name-variant mapping
private  de.topicmapslab.majortom.model.core.ILocator xsdString
          the xsd:any locator
 
Constructor Summary
CharacteristicsCache(TransactionTopicMapStore topicMapStore, de.topicmapslab.majortom.model.core.ILocator xsdString)
          constructor
 
Method Summary
 void addName(de.topicmapslab.majortom.model.core.ITopic t, de.topicmapslab.majortom.model.core.IName n)
          Add the given name to the internal data store.
 void addOccurrence(de.topicmapslab.majortom.model.core.ITopic t, de.topicmapslab.majortom.model.core.IOccurrence o)
          Add the given occurrence to the internal data store.
 void addVariant(de.topicmapslab.majortom.model.core.IName n, de.topicmapslab.majortom.model.core.IVariant v)
          Add the given variant to the internal data store.
 void close()
          Remove all items from the internal store.
protected  boolean containsDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware aware)
          Checks if the store contains any locator of the given IDatatypeAware.
 java.util.Set<de.topicmapslab.majortom.model.core.ICharacteristics> getCharacteristics()
          Returns the characteristics of all topics.
 java.util.Set<de.topicmapslab.majortom.model.core.ICharacteristics> getCharacteristics(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the characteristics of the given topic.
 de.topicmapslab.majortom.model.core.ILocator getDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware dataTypeAware)
          Returns the data type of the given data-type-aware
 java.util.Set<de.topicmapslab.majortom.model.core.IDatatypeAware> getDatatypeAwares(de.topicmapslab.majortom.model.core.ILocator locator)
          Returns all data-typed items with the given data type.
 java.util.Set<de.topicmapslab.majortom.model.core.IName> getNames()
          Returns the names of all topics.
 java.util.Set<de.topicmapslab.majortom.model.core.IName> getNames(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the names of the given topic.
 java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getOccurrences()
          Returns the occurrences of all topics.
 java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getOccurrences(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the occurrences of the given topic.
 ModifableTopicMapStoreImpl getTopicMapStore()
           
 TransactionTopicMapStore getTransactionStore()
           
 java.lang.Object getValue(de.topicmapslab.majortom.model.core.IConstruct obj)
          Returns the value of the given object
 java.lang.String getValueAsString(de.topicmapslab.majortom.model.core.IConstruct obj)
          Returns the value of the given object
 java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getVariants()
          Returns the variants of the all names.
 java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getVariants(de.topicmapslab.majortom.model.core.IName n)
          Returns the variants of the given name.
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 removeName(de.topicmapslab.majortom.model.core.IName n)
          Remove the given name from the internal data store.
 void removeOccurrence(de.topicmapslab.majortom.model.core.IOccurrence o)
          Remove the given occurrence from the internal data store.
 void removeTopic(de.topicmapslab.majortom.model.core.ITopic topic)
          Remove the given topic as parent from the internal store
 void removeVariant(de.topicmapslab.majortom.model.core.IVariant v)
          Remove the given occurrence from the internal data 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.ILocator setDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware dataTypeAware, de.topicmapslab.majortom.model.core.ILocator dataType)
          Modify the data type of the given data-type-aware
 java.lang.Object setValue(de.topicmapslab.majortom.model.core.IConstruct obj, java.lang.Object value)
          Modify the value of the given object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

names

private java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.IName>> names
storage map of topic-name mapping


occurrences

private java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence>> occurrences
storage map of topic-occurrence mapping


variants

private java.util.Map<de.topicmapslab.majortom.model.core.IName,java.util.Set<de.topicmapslab.majortom.model.core.IVariant>> variants
storage map of name-variant mapping


dataTypes

private java.util.Map<de.topicmapslab.majortom.model.core.IDatatypeAware,de.topicmapslab.majortom.model.core.ILocator> dataTypes
storage map of datatype mapping


dataTyped

private java.util.Map<de.topicmapslab.majortom.model.core.ILocator,java.util.Set<de.topicmapslab.majortom.model.core.IDatatypeAware>> dataTyped
storage map of datatype mapping


values

private java.util.Map<de.topicmapslab.majortom.model.core.IConstruct,java.lang.Object> values
storage map of characteristics-value mapping


xsdString

private final de.topicmapslab.majortom.model.core.ILocator xsdString
the xsd:any locator


topicMapStore

private final TransactionTopicMapStore topicMapStore

changedDatatypes

private java.util.Set<java.lang.String> changedDatatypes
Constructor Detail

CharacteristicsCache

public CharacteristicsCache(TransactionTopicMapStore topicMapStore,
                            de.topicmapslab.majortom.model.core.ILocator xsdString)
constructor

Parameters:
topicMapStore - the transaction store
xsdString - the locator of XSD string
Method Detail

close

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

Specified by:
close in interface IDataStore

addName

public void addName(de.topicmapslab.majortom.model.core.ITopic t,
                    de.topicmapslab.majortom.model.core.IName n)
Add the given name to the internal data store.

Parameters:
t - the parent topic
n - the name

addOccurrence

public void addOccurrence(de.topicmapslab.majortom.model.core.ITopic t,
                          de.topicmapslab.majortom.model.core.IOccurrence o)
Add the given occurrence to the internal data store.

Parameters:
t - the parent topic
n - the occurrence

addVariant

public void addVariant(de.topicmapslab.majortom.model.core.IName n,
                       de.topicmapslab.majortom.model.core.IVariant v)
Add the given variant to the internal data store.

Parameters:
n - the name
v - the variant

getDatatype

public de.topicmapslab.majortom.model.core.ILocator getDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware dataTypeAware)
Returns the data type of the given data-type-aware

Parameters:
dataTypeAware - the data-type-aware
Returns:
the data type

containsDatatype

protected final boolean containsDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware aware)
Checks if the store contains any locator of the given IDatatypeAware.

Parameters:
aware - the IDatatypeAware
Returns:
true if any locator of the given IDatatypeAware is stored, false otherwise.

getDatatypeAwares

public java.util.Set<de.topicmapslab.majortom.model.core.IDatatypeAware> getDatatypeAwares(de.topicmapslab.majortom.model.core.ILocator locator)
Returns all data-typed items with the given data type.

Parameters:
locator - the data type
Returns:
a set

getNames

public java.util.Set<de.topicmapslab.majortom.model.core.IName> getNames()
Returns the names of all topics.

Returns:
the names

getNames

public java.util.Set<de.topicmapslab.majortom.model.core.IName> getNames(de.topicmapslab.majortom.model.core.ITopic t)
Returns the names of the given topic.

Parameters:
t - the topic
Returns:
the names

getOccurrences

public java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getOccurrences()
Returns the occurrences of all topics.

Returns:
the occurrences

getOccurrences

public java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getOccurrences(de.topicmapslab.majortom.model.core.ITopic t)
Returns the occurrences of the given topic.

Parameters:
t - the topic
Returns:
the occurrences

getVariants

public java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getVariants()
Returns the variants of the all names.

Returns:
the variants

getVariants

public java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getVariants(de.topicmapslab.majortom.model.core.IName n)
Returns the variants of the given name.

Parameters:
n - the name
Returns:
the variants

getValue

public java.lang.Object getValue(de.topicmapslab.majortom.model.core.IConstruct obj)
Returns the value of the given object

Parameters:
obj - the object
Returns:
the value

setValue

public java.lang.Object setValue(de.topicmapslab.majortom.model.core.IConstruct obj,
                                 java.lang.Object value)
Modify the value of the given object

Parameters:
obj - the object
value - the new value
Returns:
the old value

setDatatype

public de.topicmapslab.majortom.model.core.ILocator setDatatype(de.topicmapslab.majortom.model.core.IDatatypeAware dataTypeAware,
                                                                de.topicmapslab.majortom.model.core.ILocator dataType)
Modify the data type of the given data-type-aware

Parameters:
dataTypeAware - the data-type-aware
dataType - the new data type
Returns:
the old data type

removeTopic

public void removeTopic(de.topicmapslab.majortom.model.core.ITopic topic)
Remove the given topic as parent from the internal store

Parameters:
topic - the topic to remove

removeName

public void removeName(de.topicmapslab.majortom.model.core.IName n)
Remove the given name from the internal data store.

Parameters:
n - the name

removeVariant

public void removeVariant(de.topicmapslab.majortom.model.core.IVariant v)
Remove the given occurrence from the internal data store.

Parameters:
v - the variant

removeOccurrence

public void removeOccurrence(de.topicmapslab.majortom.model.core.IOccurrence o)
Remove the given occurrence from the internal data store.

Parameters:
o - the occurrence

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

getCharacteristics

public java.util.Set<de.topicmapslab.majortom.model.core.ICharacteristics> getCharacteristics(de.topicmapslab.majortom.model.core.ITopic t)
Returns the characteristics of the given topic.

Parameters:
t - the topic
Returns:
the characteristics

getCharacteristics

public java.util.Set<de.topicmapslab.majortom.model.core.ICharacteristics> getCharacteristics()
Returns the characteristics of all topics.

Returns:
the characteristics

getValueAsString

public java.lang.String getValueAsString(de.topicmapslab.majortom.model.core.IConstruct obj)
Returns the value of the given object

Parameters:
obj - the object
Returns:
the value

getTopicMapStore

public ModifableTopicMapStoreImpl getTopicMapStore()
Returns:
the topicMapStore

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.