de.topicmapslab.majortom.inmemory.virtual.internal
Class VirtualTypedStore<T extends VirtualTopicMapStore>

java.lang.Object
  extended by de.topicmapslab.majortom.inmemory.store.internal.TypedStore
      extended by de.topicmapslab.majortom.inmemory.virtual.internal.VirtualTypedStore<T>
All Implemented Interfaces:
IDataStore, IVirtualStore
Direct Known Subclasses:
LazyTypedStore

public class VirtualTypedStore<T extends VirtualTopicMapStore>
extends TypedStore
implements IVirtualStore

Author:
Sven Krosse

Field Summary
private  java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITypeable>> changedTypes
           
private  java.util.Set<de.topicmapslab.majortom.model.core.ITypeable> modifiedConstructs
           
 
Constructor Summary
VirtualTypedStore(T store)
           
 
Method Summary
 void close()
          Remove all items from the internal store.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getAssociationTypes()
          Return a set containing all topic types used as type of an association item.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getNameTypes()
          Return a set containing all topic types used as type of a name item.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getOccurrenceTypes()
          Return a set containing all topic types used as type of an occurrence item.
 java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getRoleTypes()
          Return a set containing all topic types used as type of a role item.
protected  T getStore()
          Return the internal stored store instance.
 de.topicmapslab.majortom.model.core.ITopic getType(de.topicmapslab.majortom.model.core.IAssociation typed)
          Return the type of the typed attribute
 de.topicmapslab.majortom.model.core.ITopic getType(de.topicmapslab.majortom.model.core.IAssociationRole typed)
          Return the type of the typed attribute
 de.topicmapslab.majortom.model.core.ITopic getType(de.topicmapslab.majortom.model.core.IName typed)
          Return the type of the typed attribute
 de.topicmapslab.majortom.model.core.ITopic getType(de.topicmapslab.majortom.model.core.IOccurrence typed)
          Return the type of the typed attribute
 java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getTypedAssociations(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the typed items of the given type.
 java.util.Set<de.topicmapslab.majortom.model.core.IName> getTypedNames(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the typed names items of the given type.
 java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getTypedOccurrences(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the typed names items of the given type.
 java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole> getTypedRoles(de.topicmapslab.majortom.model.core.ITopic t)
          Returns the typed association role items of the given type.
protected  VirtualIdentityStore<T> getVirtualIdentityStore()
          Internal method to access the virtual-identity store
 de.topicmapslab.majortom.model.core.ITopic removeType(de.topicmapslab.majortom.model.core.IAssociation typed)
          Remove the given type for the typed attribute
 de.topicmapslab.majortom.model.core.ITopic removeType(de.topicmapslab.majortom.model.core.IAssociationRole typed)
          Remove the given type for the typed attribute
 de.topicmapslab.majortom.model.core.ITopic removeType(de.topicmapslab.majortom.model.core.IName typed)
          Remove the given type for the typed attribute
 de.topicmapslab.majortom.model.core.ITopic removeType(de.topicmapslab.majortom.model.core.IOccurrence typed)
          Remove the given type for the typed attribute
private  void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IAssociation construct, de.topicmapslab.majortom.model.core.IAssociation newConstruct)
           
private  void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IAssociationRole construct, de.topicmapslab.majortom.model.core.IAssociationRole newConstruct)
           
 void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IConstruct construct, de.topicmapslab.majortom.model.core.IConstruct newConstruct)
          Removes the virtual construct from the internal memory layer.
private  void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IName construct, de.topicmapslab.majortom.model.core.IName newConstruct)
           
private  void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IOccurrence construct, de.topicmapslab.majortom.model.core.IOccurrence newConstruct)
           
 void setType(de.topicmapslab.majortom.model.core.IAssociation typed, de.topicmapslab.majortom.model.core.ITopic t)
          Store the given type for the typed attribute
 void setType(de.topicmapslab.majortom.model.core.IAssociationRole typed, de.topicmapslab.majortom.model.core.ITopic t)
          Store the given type for the typed attribute
 void setType(de.topicmapslab.majortom.model.core.IName typed, de.topicmapslab.majortom.model.core.ITopic t)
          Store the given type for the typed attribute
 void setType(de.topicmapslab.majortom.model.core.IOccurrence typed, de.topicmapslab.majortom.model.core.ITopic t)
          Store the given type for the typed attribute
protected  void storeOldRelation(de.topicmapslab.majortom.model.core.ITypeable typed)
          Method checks if the type change of the given construct is the first type change in the transaction context.
 
Methods inherited from class de.topicmapslab.majortom.inmemory.store.internal.TypedStore
getAssociationTypesMap, getCharacteristicTypes, getNameTypesMap, getOccurrenceTypesMap, getRoleTypesMap, getType, getTyped, getTypedAssociationsMap, getTypedCharacteristics, getTypedNamesMap, getTypedOccurrencesMap, getTypedRolesMap, removeType, removeType, replace, setType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.topicmapslab.majortom.inmemory.store.model.IDataStore
replace
 

Field Detail

modifiedConstructs

private java.util.Set<de.topicmapslab.majortom.model.core.ITypeable> modifiedConstructs

changedTypes

private java.util.Map<de.topicmapslab.majortom.model.core.ITopic,java.util.Set<de.topicmapslab.majortom.model.core.ITypeable>> changedTypes
Constructor Detail

VirtualTypedStore

public VirtualTypedStore(T store)
Parameters:
store -
Method Detail

getType

public de.topicmapslab.majortom.model.core.ITopic getType(de.topicmapslab.majortom.model.core.IAssociation typed)
Return the type of the typed attribute

Overrides:
getType in class TypedStore
Parameters:
typed - the typed item
Returns:
the type

getType

public de.topicmapslab.majortom.model.core.ITopic getType(de.topicmapslab.majortom.model.core.IAssociationRole typed)
Return the type of the typed attribute

Overrides:
getType in class TypedStore
Parameters:
typed - the typed item
Returns:
the type

getType

public de.topicmapslab.majortom.model.core.ITopic getType(de.topicmapslab.majortom.model.core.IName typed)
Return the type of the typed attribute

Overrides:
getType in class TypedStore
Parameters:
typed - the typed item
Returns:
the type

getType

public de.topicmapslab.majortom.model.core.ITopic getType(de.topicmapslab.majortom.model.core.IOccurrence typed)
Return the type of the typed attribute

Overrides:
getType in class TypedStore
Parameters:
typed - the typed item
Returns:
the type

getTypedAssociations

public java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getTypedAssociations(de.topicmapslab.majortom.model.core.ITopic t)
Returns the typed items of the given type.

Overrides:
getTypedAssociations in class TypedStore
Parameters:
t - the type
Returns:
a set containing all typed attributes

getTypedRoles

public java.util.Set<de.topicmapslab.majortom.model.core.IAssociationRole> getTypedRoles(de.topicmapslab.majortom.model.core.ITopic t)
Returns the typed association role items of the given type.

Overrides:
getTypedRoles in class TypedStore
Parameters:
t - the type
Returns:
a set containing all typed association role items

getTypedNames

public java.util.Set<de.topicmapslab.majortom.model.core.IName> getTypedNames(de.topicmapslab.majortom.model.core.ITopic t)
Returns the typed names items of the given type.

Overrides:
getTypedNames in class TypedStore
Parameters:
t - the type
Returns:
a set containing all typed characteristics

getTypedOccurrences

public java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getTypedOccurrences(de.topicmapslab.majortom.model.core.ITopic t)
Returns the typed names items of the given type.

Overrides:
getTypedOccurrences in class TypedStore
Parameters:
t - the type
Returns:
a set containing all typed characteristics

setType

public void setType(de.topicmapslab.majortom.model.core.IAssociation typed,
                    de.topicmapslab.majortom.model.core.ITopic t)
Store the given type for the typed attribute

Overrides:
setType in class TypedStore
Parameters:
typed - the typed item
t - the topic

setType

public void setType(de.topicmapslab.majortom.model.core.IAssociationRole typed,
                    de.topicmapslab.majortom.model.core.ITopic t)
Store the given type for the typed attribute

Overrides:
setType in class TypedStore
Parameters:
typed - the typed item
t - the topic

setType

public void setType(de.topicmapslab.majortom.model.core.IName typed,
                    de.topicmapslab.majortom.model.core.ITopic t)
Store the given type for the typed attribute

Overrides:
setType in class TypedStore
Parameters:
typed - the typed item
t - the topic

setType

public void setType(de.topicmapslab.majortom.model.core.IOccurrence typed,
                    de.topicmapslab.majortom.model.core.ITopic t)
Store the given type for the typed attribute

Overrides:
setType in class TypedStore
Parameters:
typed - the typed item
t - the topic

removeType

public de.topicmapslab.majortom.model.core.ITopic removeType(de.topicmapslab.majortom.model.core.IAssociation typed)
Remove the given type for the typed attribute

Overrides:
removeType in class TypedStore
Parameters:
typed - the typed item
Returns:
the removed type

removeType

public de.topicmapslab.majortom.model.core.ITopic removeType(de.topicmapslab.majortom.model.core.IAssociationRole typed)
Remove the given type for the typed attribute

Overrides:
removeType in class TypedStore
Parameters:
typed - the typed item
Returns:
the removed type

removeType

public de.topicmapslab.majortom.model.core.ITopic removeType(de.topicmapslab.majortom.model.core.IName typed)
Remove the given type for the typed attribute

Overrides:
removeType in class TypedStore
Parameters:
typed - the typed item
Returns:
the removed type

removeType

public de.topicmapslab.majortom.model.core.ITopic removeType(de.topicmapslab.majortom.model.core.IOccurrence typed)
Remove the given type for the typed attribute

Overrides:
removeType in class TypedStore
Parameters:
typed - the typed item
Returns:
the removed type

getAssociationTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getAssociationTypes()
Return a set containing all topic types used as type of an association item.

Overrides:
getAssociationTypes in class TypedStore
Returns:
a set of all types

getRoleTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getRoleTypes()
Return a set containing all topic types used as type of a role item.

Overrides:
getRoleTypes in class TypedStore
Returns:
a set of all types

getNameTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getNameTypes()
Return a set containing all topic types used as type of a name item.

Overrides:
getNameTypes in class TypedStore
Returns:
a set of all types

getOccurrenceTypes

public java.util.Set<de.topicmapslab.majortom.model.core.ITopic> getOccurrenceTypes()
Return a set containing all topic types used as type of an occurrence item.

Overrides:
getOccurrenceTypes in class TypedStore
Returns:
a set of all types

close

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

Specified by:
close in interface IDataStore
Overrides:
close in class TypedStore

storeOldRelation

protected void storeOldRelation(de.topicmapslab.majortom.model.core.ITypeable typed)
Method checks if the type change of the given construct is the first type change in the transaction context. If it is the first, the old relation stored to filter them later.

Parameters:
typed - the typed construct

getVirtualIdentityStore

protected VirtualIdentityStore<T> getVirtualIdentityStore()
Internal method to access the virtual-identity store

Returns:
the virtual identity store

getStore

protected T getStore()
Return the internal stored store instance.

Overrides:
getStore in class TypedStore
Returns:
the store the store instance

removeVirtualConstruct

public void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IConstruct construct,
                                   de.topicmapslab.majortom.model.core.IConstruct newConstruct)
Removes the virtual construct from the internal memory layer. But does not delete the construct in underlying data store.

Specified by:
removeVirtualConstruct in interface IVirtualStore
Parameters:
construct - the construct to remove
newConstruct - the new construct

removeVirtualConstruct

private void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IAssociation construct,
                                    de.topicmapslab.majortom.model.core.IAssociation newConstruct)

removeVirtualConstruct

private void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IAssociationRole construct,
                                    de.topicmapslab.majortom.model.core.IAssociationRole newConstruct)

removeVirtualConstruct

private void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IName construct,
                                    de.topicmapslab.majortom.model.core.IName newConstruct)

removeVirtualConstruct

private void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IOccurrence construct,
                                    de.topicmapslab.majortom.model.core.IOccurrence newConstruct)