de.topicmapslab.majortom.store
Class TopicMapStoreImpl

java.lang.Object
  extended by de.topicmapslab.majortom.store.TopicMapStoreImpl
All Implemented Interfaces:
de.topicmapslab.majortom.model.store.ITopicMapStore
Direct Known Subclasses:
QueuedTopicMapStore, ReadOnlyTopicMapStoreImpl

public abstract class TopicMapStoreImpl
extends java.lang.Object
implements de.topicmapslab.majortom.model.store.ITopicMapStore

Base implementation of a read only ITopicMapStore.

Author:
Sven Krosse

Field Summary
private  de.topicmapslab.majortom.model.core.ILocator baseLocator
          the base locator of the topic map
private  boolean connected
           
private  de.topicmapslab.majortom.model.core.IConstructFactory factory
           
private  boolean featureAutomaticMerging
          feature FeatureStrings.AUTOMATIC_MERGING
private  boolean featureConcurrentCollections
          feature FeatureStrings.CONCURRENT_COLLECTIONS
private  boolean featureDeletionConstraintReification
          feature FeatureStrings.DELETION_CONSTRAINTS_REIFICATION
private  boolean featureMergingByName
          feature FeatureStrings.MERGING_SUPPORT_FEATURE_BY_TOPIC_NAME
private  boolean featureReadOnlyStore
          feature FeatureStrings.READ_ONLY_SYSTEM
private  boolean featureRevisionManagement
          feature FeatureStrings.SUPPORT_HISTORY
private  boolean featureSupertypeSubtypeAssociation
          feature FeatureStrings.TOPIC_MAPS_SUPERTYPE_SUBTYPE_ASSOCIATION
private  boolean featureSupportTransaction
          feature FeatureStrings.SUPPORT_TRANSACTION
private  boolean featureTypeInstanceAssociation
          feature FeatureStrings.TOPIC_MAPS_TYPE_INSTANCE_ASSOCIATION
private  java.util.Set<de.topicmapslab.majortom.model.event.ITopicMapListener> listeners
           
private  de.topicmapslab.majortom.model.store.ITopicMapStoreMetaData metaData
           
static boolean OUTPUT
           
private  cern.jet.random.engine.RandomEngine random
           
private  boolean revisionManagementEnabled
          current state of revision management
private  java.util.concurrent.ThreadPoolExecutor threadPool
           
private  de.topicmapslab.majortom.model.core.ITopicMap topicMap
           
private  java.lang.String topicMapBaseLocatorReference
           
private  de.topicmapslab.majortom.model.core.ITopicMapSystem topicMapSystem
           
 
Constructor Summary
TopicMapStoreImpl()
          constructor
TopicMapStoreImpl(de.topicmapslab.majortom.model.core.ITopicMapSystem topicMapSystem)
          constructor
 
Method Summary
protected  void addTaskToThreadPool(java.lang.Runnable task)
          Adding the given task to the internal thread pool of the topic map store.
 void addTopicMapListener(de.topicmapslab.majortom.model.event.ITopicMapListener listener)
          
 void close()
          
 void connect()
          
protected  de.topicmapslab.majortom.model.core.IConstructFactory createConstructFactory()
          Creates a new construct factory instance
protected  de.topicmapslab.majortom.model.store.ITopicMapStoreMetaData createMetaDataInstance()
          Internal called method to create a new meta data instance
 boolean doAutomaticMerging()
          Method checks if the feature 'http://tmapi.org/features/automerge/' for automatic merging is set.
 boolean doMergingByTopicName()
          Method checks if the feature 'http://tmapi.org/features/merge/byTopicName/' for merging topics by name is set.
 void enableRevisionManagement(boolean enabled)
          
 long generateId()
          
protected  java.lang.String generateStringId()
          generates a new ID for a new construct
 de.topicmapslab.majortom.model.core.IConstructFactory getConstructFactory()
          
 java.util.Set<de.topicmapslab.majortom.model.event.ITopicMapListener> getListeners()
           
 de.topicmapslab.majortom.model.store.ITopicMapStoreMetaData getMetaData()
          
protected  java.util.concurrent.ThreadPoolExecutor getThreadPool()
          Returns the internal thread pool instance
 de.topicmapslab.majortom.model.core.ITopicMap getTopicMap()
          Returns the topic map
 de.topicmapslab.majortom.model.core.ILocator getTopicMapBaseLocator()
          Returns the base locator of the topic map
 java.lang.String getTopicMapBaseLocatorReference()
          The topic map base locator reference
 de.topicmapslab.majortom.model.core.ITopicMapSystem getTopicMapSystem()
          Returns the parent topic map system
 void initialize(org.tmapi.core.Locator topicMapBaseLocator)
          
 boolean isConnected()
          
 boolean isReadOnly()
          
 boolean isReificationDeletionRestricted()
          Method returns checks if the deletion constraint contains the constraint, that topics used as reifier cannot be removed until the reification was destroyed.
 boolean isRevisionManagementEnabled()
          
 boolean isRevisionManagementSupported()
          
 boolean isTransactable()
          
 void notifyListeners(de.topicmapslab.majortom.model.event.TopicMapEventType event, de.topicmapslab.majortom.model.core.IConstruct notifier, java.lang.Object newValue, java.lang.Object oldValue)
          Method called by the topic map store to notify all topic map listeners registered for the given topic map
 boolean recognizingSupertypeSubtypeAssociation()
          Method checks if the feature for supporting supertype-subtype-associations as a supertype relation is set.
 boolean recognizingTypeInstanceAssociation()
          Method checks if the feature for supporting type-instance-associations as a type relation is set.
 void removeTopicMapListener(de.topicmapslab.majortom.model.event.ITopicMapListener listener)
          
 void setTopicMap(de.topicmapslab.majortom.model.core.ITopicMap topicMap)
          
 void setTopicMapSystem(de.topicmapslab.majortom.model.core.ITopicMapSystem topicMapSystem)
          
 
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.model.store.ITopicMapStore
clear, commit, createTransaction, doCreate, doMerge, doModify, doRead, doRemove, doRemove, enableCaching, getIndex, getTopicMapIdentity, isCachingEnabled, removeDuplicates
 

Field Detail

OUTPUT

public static boolean OUTPUT

connected

private boolean connected

listeners

private java.util.Set<de.topicmapslab.majortom.model.event.ITopicMapListener> listeners

topicMapSystem

private de.topicmapslab.majortom.model.core.ITopicMapSystem topicMapSystem

topicMap

private de.topicmapslab.majortom.model.core.ITopicMap topicMap

factory

private de.topicmapslab.majortom.model.core.IConstructFactory factory

threadPool

private java.util.concurrent.ThreadPoolExecutor threadPool

metaData

private de.topicmapslab.majortom.model.store.ITopicMapStoreMetaData metaData

topicMapBaseLocatorReference

private java.lang.String topicMapBaseLocatorReference

random

private cern.jet.random.engine.RandomEngine random

baseLocator

private de.topicmapslab.majortom.model.core.ILocator baseLocator
the base locator of the topic map


featureRevisionManagement

private boolean featureRevisionManagement
feature FeatureStrings.SUPPORT_HISTORY


featureTypeInstanceAssociation

private boolean featureTypeInstanceAssociation
feature FeatureStrings.TOPIC_MAPS_TYPE_INSTANCE_ASSOCIATION


featureSupertypeSubtypeAssociation

private boolean featureSupertypeSubtypeAssociation
feature FeatureStrings.TOPIC_MAPS_SUPERTYPE_SUBTYPE_ASSOCIATION


featureReadOnlyStore

private boolean featureReadOnlyStore
feature FeatureStrings.READ_ONLY_SYSTEM


featureSupportTransaction

private boolean featureSupportTransaction
feature FeatureStrings.SUPPORT_TRANSACTION


featureAutomaticMerging

private boolean featureAutomaticMerging
feature FeatureStrings.AUTOMATIC_MERGING


featureDeletionConstraintReification

private boolean featureDeletionConstraintReification
feature FeatureStrings.DELETION_CONSTRAINTS_REIFICATION


featureMergingByName

private boolean featureMergingByName
feature FeatureStrings.MERGING_SUPPORT_FEATURE_BY_TOPIC_NAME


featureConcurrentCollections

private boolean featureConcurrentCollections
feature FeatureStrings.CONCURRENT_COLLECTIONS


revisionManagementEnabled

private boolean revisionManagementEnabled
current state of revision management

Constructor Detail

TopicMapStoreImpl

public TopicMapStoreImpl(de.topicmapslab.majortom.model.core.ITopicMapSystem topicMapSystem)
constructor

Parameters:
topicMapSystem - the parent system

TopicMapStoreImpl

public TopicMapStoreImpl()
constructor

Method Detail

addTopicMapListener

public void addTopicMapListener(de.topicmapslab.majortom.model.event.ITopicMapListener listener)

Specified by:
addTopicMapListener in interface de.topicmapslab.majortom.model.store.ITopicMapStore

removeTopicMapListener

public void removeTopicMapListener(de.topicmapslab.majortom.model.event.ITopicMapListener listener)

Specified by:
removeTopicMapListener in interface de.topicmapslab.majortom.model.store.ITopicMapStore

getListeners

public java.util.Set<de.topicmapslab.majortom.model.event.ITopicMapListener> getListeners()
Returns:
the listeners

notifyListeners

public void notifyListeners(de.topicmapslab.majortom.model.event.TopicMapEventType event,
                            de.topicmapslab.majortom.model.core.IConstruct notifier,
                            java.lang.Object newValue,
                            java.lang.Object oldValue)
Method called by the topic map store to notify all topic map listeners registered for the given topic map

Parameters:
event - the event type
notifier - the construct changed
newValue - the new value
oldValue - the old value

setTopicMapSystem

public void setTopicMapSystem(de.topicmapslab.majortom.model.core.ITopicMapSystem topicMapSystem)

Specified by:
setTopicMapSystem in interface de.topicmapslab.majortom.model.store.ITopicMapStore

getTopicMapSystem

public de.topicmapslab.majortom.model.core.ITopicMapSystem getTopicMapSystem()
Returns the parent topic map system

Returns:
the topicMapSystem

isReadOnly

public boolean isReadOnly()

Specified by:
isReadOnly in interface de.topicmapslab.majortom.model.store.ITopicMapStore

isRevisionManagementSupported

public boolean isRevisionManagementSupported()

Specified by:
isRevisionManagementSupported in interface de.topicmapslab.majortom.model.store.ITopicMapStore

isRevisionManagementEnabled

public boolean isRevisionManagementEnabled()

Specified by:
isRevisionManagementEnabled in interface de.topicmapslab.majortom.model.store.ITopicMapStore

enableRevisionManagement

public void enableRevisionManagement(boolean enabled)
                              throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

Specified by:
enableRevisionManagement in interface de.topicmapslab.majortom.model.store.ITopicMapStore
Throws:
de.topicmapslab.majortom.model.exception.TopicMapStoreException

doAutomaticMerging

public boolean doAutomaticMerging()
Method checks if the feature 'http://tmapi.org/features/automerge/' for automatic merging is set.

Returns:
true if automatic merging is enabled, false otherwise.

doMergingByTopicName

public boolean doMergingByTopicName()
Method checks if the feature 'http://tmapi.org/features/merge/byTopicName/' for merging topics by name is set.

Returns:
true if merging by name is enabled, false otherwise.

recognizingTypeInstanceAssociation

public boolean recognizingTypeInstanceAssociation()
Method checks if the feature for supporting type-instance-associations as a type relation is set.

Returns:
true if the associations should recognized, false otherwise.

recognizingSupertypeSubtypeAssociation

public boolean recognizingSupertypeSubtypeAssociation()
Method checks if the feature for supporting supertype-subtype-associations as a supertype relation is set.

Returns:
true if the associations should recognized, false otherwise.

isReificationDeletionRestricted

public boolean isReificationDeletionRestricted()
Method returns checks if the deletion constraint contains the constraint, that topics used as reifier cannot be removed until the reification was destroyed.

Returns:
true if a topic cannot be removed if it is used as reifier , false otherwise.
See Also:
TopicMapStoreProperty#DELETION_CONSTRAINTS_REIFICATION

isTransactable

public boolean isTransactable()

Specified by:
isTransactable in interface de.topicmapslab.majortom.model.store.ITopicMapStore

connect

public void connect()
             throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

Specified by:
connect in interface de.topicmapslab.majortom.model.store.ITopicMapStore
Throws:
de.topicmapslab.majortom.model.exception.TopicMapStoreException

initialize

public void initialize(org.tmapi.core.Locator topicMapBaseLocator)
                throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

Specified by:
initialize in interface de.topicmapslab.majortom.model.store.ITopicMapStore
Throws:
de.topicmapslab.majortom.model.exception.TopicMapStoreException

createConstructFactory

protected de.topicmapslab.majortom.model.core.IConstructFactory createConstructFactory()
Creates a new construct factory instance

Returns:
the construct factory

close

public void close()
           throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

Specified by:
close in interface de.topicmapslab.majortom.model.store.ITopicMapStore
Throws:
de.topicmapslab.majortom.model.exception.TopicMapStoreException

isConnected

public boolean isConnected()

Specified by:
isConnected in interface de.topicmapslab.majortom.model.store.ITopicMapStore

getTopicMap

public de.topicmapslab.majortom.model.core.ITopicMap getTopicMap()
Returns the topic map

Specified by:
getTopicMap in interface de.topicmapslab.majortom.model.store.ITopicMapStore
Returns:
the topicMap

setTopicMap

public void setTopicMap(de.topicmapslab.majortom.model.core.ITopicMap topicMap)
                 throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

Throws:
de.topicmapslab.majortom.model.exception.TopicMapStoreException

addTaskToThreadPool

protected void addTaskToThreadPool(java.lang.Runnable task)
Adding the given task to the internal thread pool of the topic map store.

Parameters:
task - the task to add

getThreadPool

protected final java.util.concurrent.ThreadPoolExecutor getThreadPool()
Returns the internal thread pool instance

Returns:
the threadPool

getConstructFactory

public de.topicmapslab.majortom.model.core.IConstructFactory getConstructFactory()

Specified by:
getConstructFactory in interface de.topicmapslab.majortom.model.store.ITopicMapStore

createMetaDataInstance

protected de.topicmapslab.majortom.model.store.ITopicMapStoreMetaData createMetaDataInstance()
Internal called method to create a new meta data instance

Returns:
the generated meta data instance

getMetaData

public de.topicmapslab.majortom.model.store.ITopicMapStoreMetaData getMetaData()

Specified by:
getMetaData in interface de.topicmapslab.majortom.model.store.ITopicMapStore

getTopicMapBaseLocator

public de.topicmapslab.majortom.model.core.ILocator getTopicMapBaseLocator()
Returns the base locator of the topic map

Specified by:
getTopicMapBaseLocator in interface de.topicmapslab.majortom.model.store.ITopicMapStore
Returns:
the base locator

getTopicMapBaseLocatorReference

public java.lang.String getTopicMapBaseLocatorReference()
The topic map base locator reference

Specified by:
getTopicMapBaseLocatorReference in interface de.topicmapslab.majortom.model.store.ITopicMapStore
Returns:
the topicMapBaseLocator

generateStringId

protected java.lang.String generateStringId()
generates a new ID for a new construct

Returns:
the id

generateId

public long generateId()

Specified by:
generateId in interface de.topicmapslab.majortom.model.store.ITopicMapStore