de.topicmapslab.majortom.queued.store
Class QueuedTopicMapStore

java.lang.Object
  extended by de.topicmapslab.majortom.store.TopicMapStoreImpl
      extended by de.topicmapslab.majortom.queued.store.QueuedTopicMapStore
All Implemented Interfaces:
de.topicmapslab.majortom.model.store.ITopicMapStore, IProcessingListener

public class QueuedTopicMapStore
extends TopicMapStoreImpl
implements IProcessingListener

A queued topic map store, which reads and writes any context to memory and creating a task to persist information to database.

Author:
Sven Krosse

Field Summary
private  ConcurrentIdentityIndex identityIndex
           
private  VirtualInMemoryTopicMapStore inMemoryTopicMapStore
           
private  JdbcTopicMapStore jdbcTopicMapStore
           
private  ConcurrentLiteralIndex literalIndex
           
(package private)  java.util.concurrent.locks.Lock lock
           
private  TopicMapStoreQueue queue
           
private  ConcurrentScopedIndex scopedIndex
           
private  ConcurrentSupertypeSubtypeIndex supertypeSubtypeIndex
           
private  ConcurrentTransitiveTypeInstanceIndex transitiveTypeInstanceIndex
           
private  ConcurrentTypeInstanceIndex typeInstanceIndex
           
 
Fields inherited from class de.topicmapslab.majortom.store.TopicMapStoreImpl
OUTPUT
 
Constructor Summary
QueuedTopicMapStore()
          constructor
QueuedTopicMapStore(de.topicmapslab.majortom.model.core.ITopicMapSystem topicMapSystem)
          constructor
 
Method Summary
 void addTopicMapListener(de.topicmapslab.majortom.model.event.ITopicMapListener listener)
          
 void clear()
          
 void close()
          
 void commit()
          
 void connect()
          
 de.topicmapslab.majortom.model.transaction.ITransaction createTransaction()
          
 java.lang.Object doCreate(de.topicmapslab.majortom.model.core.IConstruct context, de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramType, java.lang.Object... params)
          
<T extends org.tmapi.core.Construct>
void
doMerge(T context, T... others)
          
 void doModify(de.topicmapslab.majortom.model.core.IConstruct context, de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramType, java.lang.Object... params)
          
private  void doQueueShutdown()
          shutdown the worker thread queue
 java.lang.Object doRead(de.topicmapslab.majortom.model.core.IConstruct context, de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramType, java.lang.Object... params)
          
 void doRemove(de.topicmapslab.majortom.model.core.IConstruct context, boolean cascade)
          
 void doRemove(de.topicmapslab.majortom.model.core.IConstruct context, de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramType, java.lang.Object... params)
          
 void enableCaching(boolean enable)
          
 void enableRevisionManagement(boolean enabled)
          
 void finished(IQueueTask task)
          Method which will be notified by the queue if a task was finished.
<I extends org.tmapi.index.Index>
I
getIndex(java.lang.Class<I> clazz)
          
 de.topicmapslab.majortom.model.store.ITopicMapStoreIdentity getTopicMapIdentity()
          
 void initialize(org.tmapi.core.Locator topicMapBaseLocator)
          
 boolean isCachingEnabled()
          
 boolean isReadOnly()
          
 boolean isRevisionManagementSupported()
          
 boolean isTransactable()
          
 void removeDuplicates()
          
 void removeTopicMapListener(de.topicmapslab.majortom.model.event.ITopicMapListener listener)
          
 void setTopicMap(de.topicmapslab.majortom.model.core.ITopicMap topicMap)
          
private  void updateVirtualLayer(CreateTask task)
           
 
Methods inherited from class de.topicmapslab.majortom.store.TopicMapStoreImpl
addTaskToThreadPool, createConstructFactory, createMetaDataInstance, doAutomaticMerging, doMergingByTopicName, generateId, generateStringId, getConstructFactory, getListeners, getMetaData, getThreadPool, getTopicMap, getTopicMapBaseLocator, getTopicMapBaseLocatorReference, getTopicMapSystem, isConnected, isReificationDeletionRestricted, isRevisionManagementEnabled, notifyListeners, recognizingSupertypeSubtypeAssociation, recognizingTypeInstanceAssociation, setTopicMapSystem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inMemoryTopicMapStore

private VirtualInMemoryTopicMapStore inMemoryTopicMapStore

jdbcTopicMapStore

private JdbcTopicMapStore jdbcTopicMapStore

queue

private TopicMapStoreQueue queue

lock

java.util.concurrent.locks.Lock lock

scopedIndex

private ConcurrentScopedIndex scopedIndex

identityIndex

private ConcurrentIdentityIndex identityIndex

typeInstanceIndex

private ConcurrentTypeInstanceIndex typeInstanceIndex

transitiveTypeInstanceIndex

private ConcurrentTransitiveTypeInstanceIndex transitiveTypeInstanceIndex

supertypeSubtypeIndex

private ConcurrentSupertypeSubtypeIndex supertypeSubtypeIndex

literalIndex

private ConcurrentLiteralIndex literalIndex
Constructor Detail

QueuedTopicMapStore

public QueuedTopicMapStore()
constructor


QueuedTopicMapStore

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

Parameters:
topicMapSystem -
Method Detail

setTopicMap

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

Overrides:
setTopicMap in class TopicMapStoreImpl
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
Overrides:
initialize in class TopicMapStoreImpl
Throws:
de.topicmapslab.majortom.model.exception.TopicMapStoreException

connect

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

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

close

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

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

doQueueShutdown

private void doQueueShutdown()
shutdown the worker thread queue


getIndex

public <I extends org.tmapi.index.Index> I getIndex(java.lang.Class<I> clazz)

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

isCachingEnabled

public boolean isCachingEnabled()

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

enableCaching

public void enableCaching(boolean enable)

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

doRead

public java.lang.Object doRead(de.topicmapslab.majortom.model.core.IConstruct context,
                               de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramType,
                               java.lang.Object... params)
                        throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

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

doMerge

public <T extends org.tmapi.core.Construct> void doMerge(T context,
                                                         T... others)
             throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

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

doRemove

public void doRemove(de.topicmapslab.majortom.model.core.IConstruct context,
                     de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramType,
                     java.lang.Object... params)
              throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

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

doRemove

public void doRemove(de.topicmapslab.majortom.model.core.IConstruct context,
                     boolean cascade)
              throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

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

doCreate

public java.lang.Object doCreate(de.topicmapslab.majortom.model.core.IConstruct context,
                                 de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramType,
                                 java.lang.Object... params)
                          throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

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

doModify

public void doModify(de.topicmapslab.majortom.model.core.IConstruct context,
                     de.topicmapslab.majortom.model.store.TopicMapStoreParameterType paramType,
                     java.lang.Object... params)
              throws de.topicmapslab.majortom.model.exception.TopicMapStoreException

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

createTransaction

public de.topicmapslab.majortom.model.transaction.ITransaction createTransaction()

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

isTransactable

public boolean isTransactable()

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

commit

public void commit()

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

removeDuplicates

public void removeDuplicates()

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

clear

public void clear()

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

isRevisionManagementSupported

public boolean isRevisionManagementSupported()

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

enableRevisionManagement

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

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

isReadOnly

public boolean isReadOnly()

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

finished

public void finished(IQueueTask task)
Method which will be notified by the queue if a task was finished.

Specified by:
finished in interface IProcessingListener
Parameters:
task - the task which was finished

addTopicMapListener

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

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

removeTopicMapListener

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

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

getTopicMapIdentity

public de.topicmapslab.majortom.model.store.ITopicMapStoreIdentity getTopicMapIdentity()

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

updateVirtualLayer

private void updateVirtualLayer(CreateTask task)