net.ontopia.topicmaps.impl.rdbms
Class RDBMSTopicMapStore

java.lang.Object
  extended by net.ontopia.topicmaps.impl.utils.AbstractTopicMapStore
      extended by net.ontopia.topicmaps.impl.rdbms.RDBMSTopicMapStore
All Implemented Interfaces:
TopicMapStoreIF

public class RDBMSTopicMapStore
extends AbstractTopicMapStore

PUBLIC: The rdbms topic map store implementation.


Field Summary
protected  java.util.Map properties
           
protected  java.lang.String propfile
           
protected  RDBMSStorage storage
           
protected  boolean storage_local
           
protected  RDBMSTopicMapTransaction transaction
           
protected static java.lang.Class[] types
           
 
Fields inherited from class net.ontopia.topicmaps.impl.utils.AbstractTopicMapStore
base_address, closed, deleted, open, readonly, readonlySet, reference, topic_listeners
 
Fields inherited from interface net.ontopia.topicmaps.core.TopicMapStoreIF
IN_MEMORY_IMPLEMENTATION, RDBMS_IMPLEMENTATION
 
Constructor Summary
RDBMSTopicMapStore()
          PUBLIC: Creates a new topic map store without a specified database property file.
RDBMSTopicMapStore(long topicmap_id)
          PUBLIC: Creates a new topic map store without a specified database property file.
RDBMSTopicMapStore(java.util.Map properties)
          PUBLIC: Creates a new topic map store with the specified database properties.
RDBMSTopicMapStore(java.util.Map properties, long topicmap_id)
          PUBLIC: Creates a new topic map store with the specified database properties.
RDBMSTopicMapStore(StorageIF storage)
          INTERNAL:
RDBMSTopicMapStore(StorageIF storage, long topicmap_id)
          INTERNAL:
RDBMSTopicMapStore(java.lang.String propfile)
          PUBLIC: Creates a new topic map store with the database property file set.
RDBMSTopicMapStore(java.lang.String propfile, long topicmap_id)
          PUBLIC: Creates a new topic map store with the database property file set.
 
Method Summary
 void abort()
          PUBLIC: Aborts and deactivates the top-level transaction; all changes made inside the root transaction are lost.
 void clear()
           
 void clearCache()
          INTERNAL: Empties the shared RDBMS caches.
 void close()
          PUBLIC: Closes the store and aborts the transaction if active.
 void close(boolean returnStore)
           
 void commit()
          PUBLIC: Commits and deactivates the top-level transaction.
 void delete(boolean force)
          PUBLIC: Deletes the TopicMapIF from the data store.
 void evictObject(java.lang.String object_id)
          INTERNAL: Evicts the given object from the shared RDBMS caches.
protected  void finalize()
           
 void flush()
           
 LocatorIF getBaseAddress()
          PUBLIC: Gets a locator of the topic map in the store.
 java.sql.Connection getConnection()
           
 ConnectionFactoryIF getConnectionFactory(boolean readonly)
           
 EventManagerIF getEventManager()
           
protected  IdentityIF getIdentityForObjectId(TransactionIF txn, java.lang.String object_id)
           
 int getImplementation()
          PUBLIC: Returns the topic map implementation identifier.
 long getLongId()
           
 long getLongId(TMObjectIF o)
           
 java.lang.String getProperty(java.lang.String name)
          INTERNAL: Gets the value of the specified store property.
 java.lang.String getQueryString(java.lang.String name)
           
 RDBMSStorage getStorage()
          INTERNAL: Returns the proxy storage implementation used by the topic map store.
 TopicMapIF getTopicMap()
          PUBLIC: Gets the topic map that is accessible through the root transaction of the store.
 TopicMapTransactionIF getTransaction()
           
 TransactionIF getTransactionIF()
           
 boolean isTransactional()
          PUBLIC: Returns true if the store supports transactions.
 boolean prefetch(int type, int[] fields, boolean[] traverse, java.util.Collection objects)
           
 boolean prefetch(int type, int field, boolean traverse, java.util.Collection objects)
           
 boolean prefetchFieldsById(java.util.Collection object_ids, int field)
           
 boolean prefetchObjectsById(java.util.Collection object_ids)
           
 void prefetchRolesByType(java.util.Collection players, TopicIF rtype, TopicIF atype)
           
 void setBaseAddress(LocatorIF base_address)
          EXPERIMENTAL: Sets the persistent base address of the store.
 void setBaseAddressOverride(LocatorIF base_address)
          INTERNAL: Sets the apparent base address of the store.
 boolean validate()
           
 void writeIdentityMap(java.io.Writer out, boolean dump)
          EXPERIMENTAL: Dumps the identity map to the given writer.
 void writeReport(java.lang.String filename, boolean dumpCaches)
          EXPERIMENTAL: Writes a cache statistics report to the given file.
 void writeReport(java.io.Writer out, boolean dumpCaches)
          EXPERIMENTAL: Writes a cache statistics report to the given writer.
 
Methods inherited from class net.ontopia.topicmaps.impl.utils.AbstractTopicMapStore
getReference, isOpen, isReadOnly, open, setReadOnly, setReference, setTopicListeners
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

storage

protected RDBMSStorage storage

propfile

protected java.lang.String propfile

properties

protected java.util.Map properties

transaction

protected RDBMSTopicMapTransaction transaction

storage_local

protected boolean storage_local

types

protected static final java.lang.Class[] types
Constructor Detail

RDBMSTopicMapStore

public RDBMSTopicMapStore()
                   throws java.io.IOException
PUBLIC: Creates a new topic map store without a specified database property file. A new topic map is created in the repository with this constructor at the time the topic map is accessed.

Throws:
java.io.IOException

RDBMSTopicMapStore

public RDBMSTopicMapStore(long topicmap_id)
                   throws java.io.IOException
PUBLIC: Creates a new topic map store without a specified database property file. The store references an existing topic map with the specified id.

Throws:
java.io.IOException

RDBMSTopicMapStore

public RDBMSTopicMapStore(java.lang.String propfile)
                   throws java.io.IOException
PUBLIC: Creates a new topic map store with the database property file set. A new topic map is created in the repository with this constructor at the time the topic map is accessed.

Parameters:
propfile - Path reference to a Java properties file.
Throws:
java.io.IOException

RDBMSTopicMapStore

public RDBMSTopicMapStore(java.lang.String propfile,
                          long topicmap_id)
                   throws java.io.IOException
PUBLIC: Creates a new topic map store with the database property file set. The store references an existing topic map with the specified id.

Parameters:
propfile - Path reference to a Java properties file.
topicmap_id - The ID of the topic map in the database.
Throws:
java.io.IOException

RDBMSTopicMapStore

public RDBMSTopicMapStore(java.util.Map properties)
                   throws java.io.IOException
PUBLIC: Creates a new topic map store with the specified database properties. A new topic map is created in the repository with this constructor at the time the topic map is accessed.

Throws:
java.io.IOException
Since:
1.2.4

RDBMSTopicMapStore

public RDBMSTopicMapStore(java.util.Map properties,
                          long topicmap_id)
                   throws java.io.IOException
PUBLIC: Creates a new topic map store with the specified database properties. The store references an existing topic map with the specified id.

Throws:
java.io.IOException
Since:
1.2.4

RDBMSTopicMapStore

public RDBMSTopicMapStore(StorageIF storage)
INTERNAL:


RDBMSTopicMapStore

public RDBMSTopicMapStore(StorageIF storage,
                          long topicmap_id)
INTERNAL:

Method Detail

getStorage

public RDBMSStorage getStorage()
INTERNAL: Returns the proxy storage implementation used by the topic map store.


getImplementation

public int getImplementation()
Description copied from interface: TopicMapStoreIF
PUBLIC: Returns the topic map implementation identifier.

Returns:
TopicMapStoreIF.IN_MEMORY_IMPLEMENTATION or TopicMapStoreIF.RDBMS_IMPLEMENTATION flags.

isTransactional

public boolean isTransactional()
Description copied from interface: TopicMapStoreIF
PUBLIC: Returns true if the store supports transactions.

Returns:
Boolean: true if transactional, false if not.

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 interface TopicMapStoreIF
Overrides:
getBaseAddress in class AbstractTopicMapStore
Returns:
A locator to the topic map in the store; an object implementing LocatorIF.

setBaseAddress

public void setBaseAddress(LocatorIF base_address)
Description copied from interface: TopicMapStoreIF
EXPERIMENTAL: Sets the persistent base address of the store.


setBaseAddressOverride

public void setBaseAddressOverride(LocatorIF base_address)
INTERNAL: Sets the apparent base address of the store. The value of this field is not considered persistent and may for that reason be transaction specific.


getTransactionIF

public TransactionIF getTransactionIF()

getTransaction

public TopicMapTransactionIF getTransaction()
Specified by:
getTransaction in class AbstractTopicMapStore

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 interface TopicMapStoreIF
Overrides:
getTopicMap in class AbstractTopicMapStore
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.


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 interface TopicMapStoreIF
Overrides:
commit in class AbstractTopicMapStore

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 interface TopicMapStoreIF
Overrides:
abort in class AbstractTopicMapStore

clear

public void clear()

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 interface TopicMapStoreIF
Overrides:
delete in class AbstractTopicMapStore
Throws:
NotRemovableException

getProperty

public java.lang.String getProperty(java.lang.String name)
INTERNAL: Gets the value of the specified store property.


finalize

protected void finalize()
Overrides:
finalize in class java.lang.Object

close

public void close()
Description copied from interface: TopicMapStoreIF
PUBLIC: Closes the store and aborts the transaction if active.


close

public void close(boolean returnStore)
Specified by:
close in class AbstractTopicMapStore

validate

public boolean validate()
Overrides:
validate in class AbstractTopicMapStore

evictObject

public void evictObject(java.lang.String object_id)
INTERNAL: Evicts the given object from the shared RDBMS caches.

Since:
3.3.0

clearCache

public void clearCache()
INTERNAL: Empties the shared RDBMS caches.

Since:
2.2.1

writeReport

public void writeReport(java.lang.String filename,
                        boolean dumpCaches)
                 throws java.io.IOException
EXPERIMENTAL: Writes a cache statistics report to the given file.

Parameters:
filename - the name of the file to write the report to
dumpCaches - whether to include detailed cache dumps
Throws:
java.io.IOException
Since:
2.2.1

writeReport

public void writeReport(java.io.Writer out,
                        boolean dumpCaches)
                 throws java.io.IOException
EXPERIMENTAL: Writes a cache statistics report to the given writer.

Parameters:
out - the writer to write the report to
dumpCaches - whether to include detailed cache dumps
Throws:
java.io.IOException
Since:
2.2.1

writeIdentityMap

public void writeIdentityMap(java.io.Writer out,
                             boolean dump)
                      throws java.io.IOException
EXPERIMENTAL: Dumps the identity map to the given writer.

Parameters:
out - the writer to write the report to
Throws:
java.io.IOException
Since:
3.0

prefetchObjectsById

public boolean prefetchObjectsById(java.util.Collection object_ids)

prefetchFieldsById

public boolean prefetchFieldsById(java.util.Collection object_ids,
                                  int field)

getIdentityForObjectId

protected IdentityIF getIdentityForObjectId(TransactionIF txn,
                                            java.lang.String object_id)

prefetch

public boolean prefetch(int type,
                        int field,
                        boolean traverse,
                        java.util.Collection objects)

prefetch

public boolean prefetch(int type,
                        int[] fields,
                        boolean[] traverse,
                        java.util.Collection objects)

prefetchRolesByType

public void prefetchRolesByType(java.util.Collection players,
                                TopicIF rtype,
                                TopicIF atype)

getLongId

public long getLongId()

getLongId

public long getLongId(TMObjectIF o)

flush

public void flush()

getConnection

public java.sql.Connection getConnection()

getConnectionFactory

public ConnectionFactoryIF getConnectionFactory(boolean readonly)

getQueryString

public java.lang.String getQueryString(java.lang.String name)

getEventManager

public EventManagerIF getEventManager()
Specified by:
getEventManager in class AbstractTopicMapStore


Copyright © 2000-2012 Ontopia.