jimmc.roots
Class DatabaseModel

java.lang.Object
  |
  +--jimmc.roots.DatabaseModel

public class DatabaseModel
extends java.lang.Object

The model for the database.


Field Summary
protected  CommandInterpreter interp
          Our command interpreter.
protected  java.io.PrintWriter logWriter
          Our log stream.
protected  java.lang.String path
          Our location.
protected  RootsBase rootsBase
          Our RootsBase.
 
Constructor Summary
DatabaseModel(java.lang.String filename)
          Create a model for the database in the specified file.
DatabaseModel(java.lang.String filename, java.io.PrintWriter logStream)
          Create a model for the specified database file, with the log output specified.
 
Method Summary
protected  void doCommand(java.io.PrintWriter pw, java.lang.String cmd)
          Execute a command, print results to the specified stream.
protected  java.lang.String doCommand(java.lang.String cmd)
          Execute a command, return the results as a string.
 void doCommandToLog(java.lang.String cmd)
          Execute a command, print the results in our log.
 RootsBase getBase()
          Get the base database this model is attached to.
 java.lang.String[] getKeySummaries(java.lang.String[] keys)
          Get a list of summary strings for the specified keys.
 java.lang.String getPath()
          Get the path to the database.
 PolyModel getPolyModel(java.lang.String key)
          Get a model for one record.
 PolyModel getPolyModel(java.lang.String[] keys)
          Get a model for one or multiple records.
 int getRecordCount()
          Get the number of records in this database.
 java.lang.String[] getSelectedKeys()
          Get the current selection.
protected  void log(java.lang.String s)
          Log the string to the output.
protected  void logCommand(java.lang.String cmd)
          Log a command to the output.
 void select(java.lang.String txt)
          Select one or multiple records.
 void setLogWriter(java.io.PrintWriter pw)
          Set the writer to which we log our output.
protected  void setupBase(java.lang.String filename)
          Set up the RootsBase
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootsBase

protected RootsBase rootsBase
Our RootsBase.

interp

protected CommandInterpreter interp
Our command interpreter.

path

protected java.lang.String path
Our location.

logWriter

protected java.io.PrintWriter logWriter
Our log stream.
Constructor Detail

DatabaseModel

public DatabaseModel(java.lang.String filename,
                     java.io.PrintWriter logStream)
Create a model for the specified database file, with the log output specified.

DatabaseModel

public DatabaseModel(java.lang.String filename)
Create a model for the database in the specified file.
Method Detail

setupBase

protected void setupBase(java.lang.String filename)
Set up the RootsBase

getPath

public java.lang.String getPath()
Get the path to the database.

getBase

public RootsBase getBase()
Get the base database this model is attached to.

getRecordCount

public int getRecordCount()
Get the number of records in this database.

select

public void select(java.lang.String txt)
Select one or multiple records.

getSelectedKeys

public java.lang.String[] getSelectedKeys()
Get the current selection.

getKeySummaries

public java.lang.String[] getKeySummaries(java.lang.String[] keys)
Get a list of summary strings for the specified keys.

getPolyModel

public PolyModel getPolyModel(java.lang.String[] keys)
Get a model for one or multiple records.

getPolyModel

public PolyModel getPolyModel(java.lang.String key)
Get a model for one record.

doCommand

protected java.lang.String doCommand(java.lang.String cmd)
Execute a command, return the results as a string.

doCommandToLog

public void doCommandToLog(java.lang.String cmd)
Execute a command, print the results in our log.

doCommand

protected void doCommand(java.io.PrintWriter pw,
                         java.lang.String cmd)
Execute a command, print results to the specified stream.

setLogWriter

public void setLogWriter(java.io.PrintWriter pw)
Set the writer to which we log our output.

logCommand

protected void logCommand(java.lang.String cmd)
Log a command to the output.

log

protected void log(java.lang.String s)
Log the string to the output.