com.martiansoftware.trivialpersist
Class Store

java.lang.Object
  extended bycom.martiansoftware.trivialpersist.Store

public class Store
extends Object

The closest thing to a database provided by TrivialPersist. All Tables must be obtained from a Store; Records can then be created by or loaded from a Table.

Multiple Stores may exist; a singleton instance is available for convenience via the public field Store.SINGLETON.

Author:
Marty Lamb

Field Summary
static Store SINGLETON
          Singleton instance for convenience
 
Constructor Summary
Store()
          Creates a new Store
 
Method Summary
 Table getTable(String tableName)
          Obtains a reference to the specified table.
 void init(File base)
          Initializes the Store to use the specified base directory.
 Iterator iterator()
          Returns an Iterator over all Tables in this Store.
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON

public static final Store SINGLETON
Singleton instance for convenience

Constructor Detail

Store

public Store()
Creates a new Store

Method Detail

init

public void init(File base)
          throws TrivialPersistException
Initializes the Store to use the specified base directory. Loads all table definitions and table data into memory.

Parameters:
base - the base directory for this Store
Throws:
TrivialPersistException - if any errors occur during initialization

getTable

public Table getTable(String tableName)
Obtains a reference to the specified table.

Parameters:
tableName - the name of the table to obtain
Returns:
a reference to the specified table, or null if no such table exists in this Store

iterator

public Iterator iterator()
Returns an Iterator over all Tables in this Store.

Returns:
an Iterator over all Tables in this Store.

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception


Copyright © 2004, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/trivialpersist