Class TransactionSystem

java.lang.Object
com.mckoi.database.TransactionSystem
Direct Known Subclasses:
DatabaseSystem

public class TransactionSystem extends Object
A class that provides information and global functions for the transaction layer in the engine. Shared information includes configuration details, logging, etc.
Author:
Tobias Downer
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Registers a new FunctionFactory with the database system.
    boolean
    Returns the status of the 'always_reindex_dirty_tables' property.
    Returns the DebugLogger object that is used to log debug message.
    void
    Disposes this object.
    boolean
    Returns true if we shouldn't synchronize with the file system when important indexing information is flushed to the disk.
    void
    Flushes the 'FunctionLookup' object returned by the getFunctionLookup method.
    Returns the LoggingBufferManager object enabling us to create no file stores in the file system.
    final boolean
    getConfigBoolean(String property, boolean default_val)
    Returns a configuration value, or the default if it's not found.
    final int
    getConfigInt(String property, int default_val)
    Returns a configuration value, or the default if it's not found.
    final String
    getConfigString(String property, String default_val)
    Returns a configuration value, or the default if it's not found.
    Returns the path of the database in the local file system if the database exists within the local file system.
    Returns a FunctionLookup object that will search through the function factories in this database system and find and resolve a function.
    final File
    Returns the current log directory or null if no logging should occur.
    Returns the regular expression library from the configuration file.
    boolean
    Returns true if the parser should ignore case when searching for schema/table/column identifiers.
    void
    init(DBConfig config)
    Inits the TransactionSystem with the configuration properties of the system.
    boolean
    Returns true if we should generate lookup caches in InsertSearch otherwise returns false.
    Given a Transaction.CheckExpression, this will prepare the expression and return a new prepared CheckExpression.
    boolean
    Returns true if the database is in read only mode.
    final void
    setDebugLevel(int level)
    Sets the debug minimum level that is output to the logger.
    final void
    Sets the Writer output for the debug logger.
    final void
    Sets the log directory.
    void
    setupRowCache(int max_cache_size, int max_cache_entry_size)
    Hack - set up the DataCellCache in DatabaseSystem so we can use the MasterTableDataSource object without having to boot a new DatabaseSystem.
    boolean
    Returns true if all table indices are kept behind a soft reference that can be garbage collected.
    final Stats
    Returns a com.mckoi.util.Stats object that can be used to keep track of database statistics for this VM.
    final com.mckoi.database.StoreSystem
    Returns the StoreSystem encapsulation being used in this database.
    boolean
    Returns true if the database should perform checking of table locks.
    boolean
    Returns true if during commit the engine should look for any selects on a modified table and fail if they are detected.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TransactionSystem

      public TransactionSystem()
      Constructor.
  • Method Details

    • getConfigString

      public final String getConfigString(String property, String default_val)
      Returns a configuration value, or the default if it's not found.
    • getConfigInt

      public final int getConfigInt(String property, int default_val)
      Returns a configuration value, or the default if it's not found.
    • getConfigBoolean

      public final boolean getConfigBoolean(String property, boolean default_val)
      Returns a configuration value, or the default if it's not found.
    • init

      public void init(DBConfig config)
      Inits the TransactionSystem with the configuration properties of the system. This can only be called once, and should be called at database boot time.
    • setupRowCache

      public void setupRowCache(int max_cache_size, int max_cache_entry_size)
      Hack - set up the DataCellCache in DatabaseSystem so we can use the MasterTableDataSource object without having to boot a new DatabaseSystem.
    • readOnlyAccess

      public boolean readOnlyAccess()
      Returns true if the database is in read only mode. In read only mode, any 'write' operations are not permitted.
    • getDatabasePath

      public File getDatabasePath()
      Returns the path of the database in the local file system if the database exists within the local file system. If the database is not within the local file system then null is returned. It is recommended this method is not used unless for legacy or compatability purposes.
    • tableLockingEnabled

      public boolean tableLockingEnabled()
      Returns true if the database should perform checking of table locks.
    • lookupComparisonListEnabled

      public boolean lookupComparisonListEnabled()
      Returns true if we should generate lookup caches in InsertSearch otherwise returns false.
    • softIndexStorage

      public boolean softIndexStorage()
      Returns true if all table indices are kept behind a soft reference that can be garbage collected.
    • alwaysReindexDirtyTables

      public boolean alwaysReindexDirtyTables()
      Returns the status of the 'always_reindex_dirty_tables' property.
    • dontSynchFileSystem

      public boolean dontSynchFileSystem()
      Returns true if we shouldn't synchronize with the file system when important indexing information is flushed to the disk.
    • transactionErrorOnDirtySelect

      public boolean transactionErrorOnDirtySelect()
      Returns true if during commit the engine should look for any selects on a modified table and fail if they are detected.
    • ignoreIdentifierCase

      public boolean ignoreIdentifierCase()
      Returns true if the parser should ignore case when searching for schema/table/column identifiers.
    • getBufferManager

      public LoggingBufferManager getBufferManager()
      Returns the LoggingBufferManager object enabling us to create no file stores in the file system. This provides access to the buffer scheme that has been configured.
    • getRegexLibrary

      public RegexLibrary getRegexLibrary()
      Returns the regular expression library from the configuration file.
    • storeSystem

      public final com.mckoi.database.StoreSystem storeSystem()
      Returns the StoreSystem encapsulation being used in this database.
    • setDebugOutput

      public final void setDebugOutput(Writer writer)
      Sets the Writer output for the debug logger.
    • setDebugLevel

      public final void setDebugLevel(int level)
      Sets the debug minimum level that is output to the logger.
    • Debug

      public final DebugLogger Debug()
      Returns the DebugLogger object that is used to log debug message. This method must always return a debug logger that we can log to.
    • addFunctionFactory

      public void addFunctionFactory(FunctionFactory factory)
      Registers a new FunctionFactory with the database system. The function factories are used to resolve a function name into a Function object. Function factories are checked in the order they are added to the database system.
    • flushCachedFunctionLookup

      public void flushCachedFunctionLookup()
      Flushes the 'FunctionLookup' object returned by the getFunctionLookup method. This should be called if the function factory list has been modified in some way.
    • getFunctionLookup

      public FunctionLookup getFunctionLookup()
      Returns a FunctionLookup object that will search through the function factories in this database system and find and resolve a function. The returned object may throw an exception from the 'generateFunction' method if the FunctionDef is invalid. For example, if the number of parameters is incorrect or the name can not be found.
    • prepareTransactionCheckConstraint

      public Transaction.CheckExpression prepareTransactionCheckConstraint(DataTableDef table_def, Transaction.CheckExpression check)
      Given a Transaction.CheckExpression, this will prepare the expression and return a new prepared CheckExpression. The default implementation of this is to do nothing. However, a sub-class of the system choose to prepare the expression, such as resolving the functions via the function lookup, and resolving the sub-queries, etc.
    • stats

      public final Stats stats()
      Returns a com.mckoi.util.Stats object that can be used to keep track of database statistics for this VM.
    • setLogDirectory

      public final void setLogDirectory(File log_path)
      Sets the log directory. This should preferably be called during initialization. If the log directory is not set or is set to 'null' then no logging to files occurs.
    • getLogDirectory

      public final File getLogDirectory()
      Returns the current log directory or null if no logging should occur.
    • dispose

      public void dispose()
      Disposes this object.