Package net.ontopia.topicmaps.impl.utils
Class AbstractTopicMapStore
- java.lang.Object
-
- net.ontopia.topicmaps.impl.utils.AbstractTopicMapStore
-
- All Implemented Interfaces:
AutoCloseable
,TopicMapStoreIF
- Direct Known Subclasses:
InMemoryTopicMapStore
,RDBMSTopicMapStore
public abstract class AbstractTopicMapStore extends Object implements TopicMapStoreIF
INTERNAL: An abstract TopicMapStoreIF implementation.
-
-
Field Summary
Fields Modifier and Type Field Description protected LocatorIF
base_address
protected boolean
closed
protected boolean
deleted
protected boolean
open
protected boolean
readonly
protected boolean
readonlySet
protected TopicMapReferenceIF
reference
TopicMapListenerIF[]
topic_listeners
-
Fields inherited from interface net.ontopia.topicmaps.core.TopicMapStoreIF
IN_MEMORY_IMPLEMENTATION, RDBMS_IMPLEMENTATION
-
-
Constructor Summary
Constructors Constructor Description AbstractTopicMapStore()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
abort()
PUBLIC: Aborts and deactivates the top-level transaction; all changes made inside the root transaction are lost.abstract void
close(boolean returnToPool)
void
commit()
PUBLIC: Commits and deactivates the top-level transaction.void
delete(boolean force)
PUBLIC: Deletes the TopicMapIF from the data store.LocatorIF
getBaseAddress()
PUBLIC: Gets a locator of the topic map in the store.abstract EventManagerIF
getEventManager()
TopicMapReferenceIF
getReference()
INTERNAL: Returns a topic map reference for this store.TopicMapIF
getTopicMap()
PUBLIC: Gets the topic map that is accessible through the root transaction of the store.abstract TopicMapTransactionIF
getTransaction()
boolean
isOpen()
PUBLIC: Returns true if the store is open (because opening a transactional store starts a transaction, "true" also means a transaction is in progress).boolean
isReadOnly()
PUBLIC: Returns true if the store is usable for read-only purposes only.void
open()
PUBLIC: Opens the store, and starts a new transaction on a transactional store.void
setReadOnly(boolean readonly)
void
setReference(TopicMapReferenceIF reference)
INTERNAL: Sets the topic map reference for this store.void
setTopicListeners(TopicMapListenerIF[] listeners)
boolean
validate()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.ontopia.topicmaps.core.TopicMapStoreIF
close, getImplementation, getProperty, isTransactional, setBaseAddress
-
-
-
-
Field Detail
-
base_address
protected LocatorIF base_address
-
open
protected boolean open
-
closed
protected boolean closed
-
deleted
protected boolean deleted
-
readonly
protected boolean readonly
-
readonlySet
protected boolean readonlySet
-
reference
protected TopicMapReferenceIF reference
-
topic_listeners
public TopicMapListenerIF[] topic_listeners
-
-
Method Detail
-
isOpen
public boolean isOpen()
Description copied from interface:TopicMapStoreIF
PUBLIC: Returns true if the store is open (because opening a transactional store starts a transaction, "true" also means a transaction is in progress).- Specified by:
isOpen
in interfaceTopicMapStoreIF
- Returns:
- Boolean: true if open, false if not open (either not yet opened, or closed).
-
open
public void open()
Description copied from interface:TopicMapStoreIF
PUBLIC: Opens the store, and starts a new transaction on a transactional store.- Specified by:
open
in interfaceTopicMapStoreIF
-
getTransaction
public abstract TopicMapTransactionIF getTransaction()
-
getTopicMap
public TopicMapIF getTopicMap()
Description copied from interface:TopicMapStoreIF
PUBLIC: Gets the topic map that is accessible through the root transaction of the store.- Specified by:
getTopicMap
in interfaceTopicMapStoreIF
- Returns:
- The topic map in the root transaction; an object implementing TopicMapIF. This method is a shorthand for getTransaction().getTopicMap(). If the store is not open when this method is called it will be opened automatically.
-
getBaseAddress
public LocatorIF getBaseAddress()
Description copied from interface:TopicMapStoreIF
PUBLIC: Gets a locator of the topic map in the store. This can be used as a locator for the topic map as a whole. The locator can be resolved to a store that holds the topic map.- Specified by:
getBaseAddress
in interfaceTopicMapStoreIF
- Returns:
- A locator to the topic map in the store; an object implementing LocatorIF.
-
commit
public void commit()
Description copied from interface:TopicMapStoreIF
PUBLIC: Commits and deactivates the top-level transaction. This method is a shorthand for getTransaction().commit().- Specified by:
commit
in interfaceTopicMapStoreIF
-
abort
public void abort()
Description copied from interface:TopicMapStoreIF
PUBLIC: Aborts and deactivates the top-level transaction; all changes made inside the root transaction are lost. This method is a shorthand for getTransaction().abort().- Specified by:
abort
in interfaceTopicMapStoreIF
-
delete
public void delete(boolean force) throws NotRemovableException
Description copied from interface:TopicMapStoreIF
PUBLIC: Deletes the TopicMapIF from the data store. The store is closed after the topic map has been deleted. A deleted store cannot be reopened.If the force flag is false and the topic map contains any objects, i.e. topics and associations, a NotRemovableException will be thrown. The topic map will not be modified or closed if this is so.
If the force flag is true, the topic map will be deleted even if it contains any objects.
Note: if you're retrieved the store via a TopicMapReferenceIF then call delete(boolean) on the reference instead.
- Specified by:
delete
in interfaceTopicMapStoreIF
- Throws:
NotRemovableException
-
isReadOnly
public boolean isReadOnly()
Description copied from interface:TopicMapStoreIF
PUBLIC: Returns true if the store is usable for read-only purposes only.- Specified by:
isReadOnly
in interfaceTopicMapStoreIF
- Returns:
- True if the store is a read-only store, otherwise false.
-
setReadOnly
public void setReadOnly(boolean readonly)
-
getReference
public TopicMapReferenceIF getReference()
Description copied from interface:TopicMapStoreIF
INTERNAL: Returns a topic map reference for this store.- Specified by:
getReference
in interfaceTopicMapStoreIF
-
setReference
public void setReference(TopicMapReferenceIF reference)
Description copied from interface:TopicMapStoreIF
INTERNAL: Sets the topic map reference for this store. Warning: Intended for internal use only.- Specified by:
setReference
in interfaceTopicMapStoreIF
-
validate
public boolean validate()
-
close
public abstract void close(boolean returnToPool)
-
setTopicListeners
public void setTopicListeners(TopicMapListenerIF[] listeners)
-
getEventManager
public abstract EventManagerIF getEventManager()
-
-