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

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

public class VirtualScopeStore<T extends VirtualTopicMapStore>
extends ScopeStore
implements IVirtualStore

Author:
Sven Krosse

Field Summary
private  java.util.Set<java.lang.String> modifiedScopeables
           
 
Constructor Summary
VirtualScopeStore(T store)
          constructor
 
Method Summary
 void close()
          Remove all items from the internal store.
protected  de.topicmapslab.majortom.model.core.IScope createEmptyScope()
          Generates a new empty scope construct
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getAssociationScopes()
          Return all scopes used by association items.
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getNameScopes()
          Return all scopes used by name items.
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getOccurrenceScopes()
          Return all scopes used by occurrence items.
 de.topicmapslab.majortom.model.core.IScope getScope(java.util.Collection<de.topicmapslab.majortom.model.core.ITopic> themes)
          Returns the scope instance for the given themes
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IAssociation scoped)
          Returns the scope of the scoped construct
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IName scoped)
          Returns the scope of the scoped construct
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IOccurrence scoped)
          Returns the scope of the scoped construct
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.ITopic... themes)
          Returns the scope instance for the given themes
 de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IVariant scoped)
          Returns the scope of the scoped construct
 java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getScopedAssociations(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped association items of the given scope.
 java.util.Set<de.topicmapslab.majortom.model.core.IName> getScopedNames(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped name items of the given scope.
 java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getScopedOccurrences(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped occurrences of the given scope.
 java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getScopedVariants(de.topicmapslab.majortom.model.core.IScope scope)
          Returns all scoped variant items of the given scope.
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getScopes(de.topicmapslab.majortom.model.core.ITopic theme)
          Return all scopes containing the given theme
protected  T getStore()
          Returns the internal reference of the topic map store.
 java.util.Set<de.topicmapslab.majortom.model.core.IScope> getVariantScopes()
          Return all scopes used by variant items.
protected  VirtualIdentityStore<T> getVirtualIdentityStore()
          Internal method to access the virtual-identity
private
<X extends de.topicmapslab.majortom.model.core.IScopable>
java.util.Set<X>
internalGetScoped(de.topicmapslab.majortom.model.core.IScope scope, java.lang.Class<? extends X> clazz)
          Returns all scoped items of the given scope and given type.
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IAssociation scoped)
          Remove the relation between the scoped construct and the stored scope.
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IName scoped)
          Remove the relation between the scoped construct and the stored scope.
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IOccurrence scoped)
          Remove the relation between the scoped construct and the stored scope.
 de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IVariant scoped)
          Remove the relation between the scoped construct and the stored scope.
private  void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IAssociation construct, de.topicmapslab.majortom.model.core.IAssociation 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)
           
private  void removeVirtualConstruct(de.topicmapslab.majortom.model.core.ITopic construct, de.topicmapslab.majortom.model.core.ITopic newConstruct)
           
private  void removeVirtualConstruct(de.topicmapslab.majortom.model.core.IVariant construct, de.topicmapslab.majortom.model.core.IVariant newConstruct)
           
 void setScope(de.topicmapslab.majortom.model.core.IAssociation scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 void setScope(de.topicmapslab.majortom.model.core.IName scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 void setScope(de.topicmapslab.majortom.model.core.IOccurrence scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 void setScope(de.topicmapslab.majortom.model.core.IVariant scoped, de.topicmapslab.majortom.model.core.IScope s)
          Store the relation between the given scoped item and the scope.
 
Methods inherited from class de.topicmapslab.majortom.inmemory.store.internal.ScopeStore
containsScopeable, getAssociationScopeMap, getEmptyScope, getNameScopesMap, getOccurrenceScopesMap, getScope, getScoped, getScopedAssociationMap, getScopedNamesMap, getScopedOccurrencesMap, getScopedVariantsMap, getScopes, getScopesMap, getVariantScopesMap, removeScoped, removeScopes, replace, setScope, usedAsTheme
 
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

modifiedScopeables

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

VirtualScopeStore

public VirtualScopeStore(T store)
constructor

Parameters:
store - the topic map store
Method Detail

createEmptyScope

protected de.topicmapslab.majortom.model.core.IScope createEmptyScope()
Generates a new empty scope construct

Overrides:
createEmptyScope in class ScopeStore
Returns:
the scope construct

close

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

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

getVirtualIdentityStore

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

Returns:
the virtual identity store

getStore

protected T getStore()
Returns the internal reference of the topic map store.

Overrides:
getStore in class ScopeStore
Returns:
the topic map store

getAssociationScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getAssociationScopes()
Return all scopes used by association items.

Overrides:
getAssociationScopes in class ScopeStore
Returns:
all scopes

getNameScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getNameScopes()
Return all scopes used by name items.

Overrides:
getNameScopes in class ScopeStore
Returns:
all scopes

getOccurrenceScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getOccurrenceScopes()
Return all scopes used by occurrence items.

Overrides:
getOccurrenceScopes in class ScopeStore
Returns:
all scopes

getVariantScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getVariantScopes()
Return all scopes used by variant items.

Overrides:
getVariantScopes in class ScopeStore
Returns:
all scopes

getScope

public de.topicmapslab.majortom.model.core.IScope getScope(java.util.Collection<de.topicmapslab.majortom.model.core.ITopic> themes)
Returns the scope instance for the given themes

Overrides:
getScope in class ScopeStore
Parameters:
themes - the themes
Returns:
the scope instance

getScope

public de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.ITopic... themes)
Returns the scope instance for the given themes

Overrides:
getScope in class ScopeStore
Parameters:
themes - the themes
Returns:
the scope instance

getScope

public de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IAssociation scoped)
Returns the scope of the scoped construct

Overrides:
getScope in class ScopeStore
Parameters:
scoped - the scoped construct
Returns:
the scope and never null

getScope

public de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IName scoped)
Returns the scope of the scoped construct

Overrides:
getScope in class ScopeStore
Parameters:
scoped - the scoped construct
Returns:
the scope and never null

getScope

public de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IOccurrence scoped)
Returns the scope of the scoped construct

Overrides:
getScope in class ScopeStore
Parameters:
scoped - the scoped construct
Returns:
the scope and never null

getScope

public de.topicmapslab.majortom.model.core.IScope getScope(de.topicmapslab.majortom.model.core.IVariant scoped)
Returns the scope of the scoped construct

Overrides:
getScope in class ScopeStore
Parameters:
scoped - the scoped construct
Returns:
the scope and never null

internalGetScoped

private <X extends de.topicmapslab.majortom.model.core.IScopable> java.util.Set<X> internalGetScoped(de.topicmapslab.majortom.model.core.IScope scope,
                                                                                                     java.lang.Class<? extends X> clazz)
Returns all scoped items of the given scope and given type.

Parameters:
scope - the scope
Returns:
the scoped construct

getScopedAssociations

public java.util.Set<de.topicmapslab.majortom.model.core.IAssociation> getScopedAssociations(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped association items of the given scope.

Overrides:
getScopedAssociations in class ScopeStore
Parameters:
scope - the scope
Returns:
the scoped association items

getScopedNames

public java.util.Set<de.topicmapslab.majortom.model.core.IName> getScopedNames(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped name items of the given scope.

Overrides:
getScopedNames in class ScopeStore
Parameters:
scope - the scope
Returns:
the scoped names

getScopedOccurrences

public java.util.Set<de.topicmapslab.majortom.model.core.IOccurrence> getScopedOccurrences(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped occurrences of the given scope.

Overrides:
getScopedOccurrences in class ScopeStore
Parameters:
scope - the scope
Returns:
the scoped occurrences

getScopedVariants

public java.util.Set<de.topicmapslab.majortom.model.core.IVariant> getScopedVariants(de.topicmapslab.majortom.model.core.IScope scope)
Returns all scoped variant items of the given scope.

Overrides:
getScopedVariants in class ScopeStore
Parameters:
scope - the scope
Returns:
the scoped variant items

getScopes

public java.util.Set<de.topicmapslab.majortom.model.core.IScope> getScopes(de.topicmapslab.majortom.model.core.ITopic theme)
Return all scopes containing the given theme

Overrides:
getScopes in class ScopeStore
Parameters:
theme - the theme
Returns:
a collection of all themes

setScope

public void setScope(de.topicmapslab.majortom.model.core.IAssociation scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Overrides:
setScope in class ScopeStore
Parameters:
scoped - the scoped construct
s - the scope

setScope

public void setScope(de.topicmapslab.majortom.model.core.IName scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Overrides:
setScope in class ScopeStore
Parameters:
scoped - the scoped construct
s - the scope

setScope

public void setScope(de.topicmapslab.majortom.model.core.IOccurrence scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Overrides:
setScope in class ScopeStore
Parameters:
scoped - the scoped construct
s - the scope

setScope

public void setScope(de.topicmapslab.majortom.model.core.IVariant scoped,
                     de.topicmapslab.majortom.model.core.IScope s)
Store the relation between the given scoped item and the scope.

Overrides:
setScope in class ScopeStore
Parameters:
scoped - the scoped construct
s - the scope

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IAssociation scoped)
Remove the relation between the scoped construct and the stored scope.

Overrides:
removeScoped in class ScopeStore
Parameters:
scoped - the scoped construct
Returns:
the old scope

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IName scoped)
Remove the relation between the scoped construct and the stored scope.

Overrides:
removeScoped in class ScopeStore
Parameters:
scoped - the scoped construct
Returns:
the old scope

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IOccurrence scoped)
Remove the relation between the scoped construct and the stored scope.

Overrides:
removeScoped in class ScopeStore
Parameters:
scoped - the scoped construct
Returns:
the old scope

removeScoped

public de.topicmapslab.majortom.model.core.IScope removeScoped(de.topicmapslab.majortom.model.core.IVariant scoped)
Remove the relation between the scoped construct and the stored scope.

Overrides:
removeScoped in class ScopeStore
Parameters:
scoped - the scoped construct
Returns:
the old scope

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.ITopic construct,
                                    de.topicmapslab.majortom.model.core.ITopic newConstruct)

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.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)

removeVirtualConstruct

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