org.hermit.android.provider
Class DbSchema

java.lang.Object
  extended by org.hermit.android.provider.DbSchema

public abstract class DbSchema
extends java.lang.Object

Class encapsulating the schema for a content provider. Applications must subclass this, and provide the necessary information in the call to this base class's constructor.

An application's subclass will typically provide the following:


Constructor Summary
protected DbSchema(java.lang.String name, int version, java.lang.String auth, TableSchema[] tables)
          Create a database schema instance.
 
Method Summary
 java.lang.String getDbName()
          Get the database name.
 int getDbVersion()
          Get the database version number.
protected  TableSchema getTable(java.lang.String name)
          Get the schema for a specified table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbSchema

protected DbSchema(java.lang.String name,
                   int version,
                   java.lang.String auth,
                   TableSchema[] tables)
Create a database schema instance.

Parameters:
name - Name for the database; e.g. "passages".
version - Version number of the database. The upgrade process will be run when this increments.
auth - Authority name for this content provider; e.g. "org.hermit.provider.PassageData".
tables - List of table schemas.
Method Detail

getDbName

public java.lang.String getDbName()
Get the database name.

Returns:
The name of the database.

getDbVersion

public int getDbVersion()
Get the database version number.

Returns:
The database version number.

getTable

protected TableSchema getTable(java.lang.String name)
                        throws java.lang.IllegalArgumentException
Get the schema for a specified table.

Parameters:
name - The name of the table we want.
Returns:
The schema for the given table.
Throws:
java.lang.IllegalArgumentException - No such table.