org.placelab.midp
Class Storage

java.lang.Object
  extended byorg.placelab.midp.Storage

public class Storage
extends java.lang.Object

General storage infrastructure for placelab on midp phones, using the phones' RMS storage


Nested Class Summary
 class Storage.StorageEditorUI
           
 class Storage.StorageUI
           
 
Field Summary
static java.lang.String FALSE
           
static java.lang.String PREFS_EMULATOR
           
 javax.microedition.rms.RecordStore rms
           
static java.lang.String STORE_NAME
           
static java.lang.String TRUE
           
static java.lang.String TYPE_PREFS
           
 
Constructor Summary
protected Storage()
           
 
Method Summary
static void add(java.lang.String type, java.lang.String key, java.lang.String value)
          Add an entry into the uberstore.
static boolean delete(java.lang.String record)
          delete a record.
static void deleteAll()
           
static java.lang.String get(java.lang.String type, java.lang.String key)
          returns the record corresponding to this type and key.
static boolean getBooleanPref(java.lang.String name, boolean defaultValue)
          gets a boolean preference from TYPE_PREFS
static javax.microedition.rms.RecordEnumeration getByType(java.lang.String type)
          get all records for a type
protected static Storage getInst()
           
static java.lang.String getKey(java.lang.String record)
          Get the key for a record
static int getRecordCount()
           
static java.lang.String getType(java.lang.String record)
          Get the type for a record
static UIComponent getUI(javax.microedition.lcdui.Display display, UIComponent back)
           
static java.lang.String getValue(java.lang.String record)
          Get the value for a record
static boolean replace(java.lang.String oldRecord, java.lang.String type, java.lang.String key, java.lang.String val)
           
static void toggleBooleanPref(java.lang.String name, boolean defaultBeforeToggle)
          toggles a boolean of TYPE_PREFS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STORE_NAME

public static final java.lang.String STORE_NAME
See Also:
Constant Field Values

TYPE_PREFS

public static final java.lang.String TYPE_PREFS
See Also:
Constant Field Values

PREFS_EMULATOR

public static final java.lang.String PREFS_EMULATOR
See Also:
Constant Field Values

TRUE

public static final java.lang.String TRUE
See Also:
Constant Field Values

FALSE

public static final java.lang.String FALSE
See Also:
Constant Field Values

rms

public javax.microedition.rms.RecordStore rms
Constructor Detail

Storage

protected Storage()
           throws javax.microedition.rms.RecordStoreException
Method Detail

getRecordCount

public static int getRecordCount()

getInst

protected static Storage getInst()
                          throws javax.microedition.rms.RecordStoreException
Throws:
javax.microedition.rms.RecordStoreException

add

public static void add(java.lang.String type,
                       java.lang.String key,
                       java.lang.String value)
                throws javax.microedition.rms.RecordStoreException
Add an entry into the uberstore. Example: add(Preferences.TYPE_PREFS,Preferences.PREFS_EMULATOR,"t");

Throws:
javax.microedition.rms.RecordStoreException

get

public static java.lang.String get(java.lang.String type,
                                   java.lang.String key)
returns the record corresponding to this type and key. Use getValue() to get the value.


delete

public static boolean delete(java.lang.String record)
                      throws javax.microedition.rms.RecordStoreException
delete a record. You must pass the record string in, not the value

Throws:
javax.microedition.rms.RecordStoreException

replace

public static boolean replace(java.lang.String oldRecord,
                              java.lang.String type,
                              java.lang.String key,
                              java.lang.String val)
                       throws javax.microedition.rms.RecordStoreException
Throws:
javax.microedition.rms.RecordStoreException

getByType

public static javax.microedition.rms.RecordEnumeration getByType(java.lang.String type)
get all records for a type


deleteAll

public static void deleteAll()
                      throws javax.microedition.rms.RecordStoreException
Throws:
javax.microedition.rms.RecordStoreException

getType

public static java.lang.String getType(java.lang.String record)
Get the type for a record


getKey

public static java.lang.String getKey(java.lang.String record)
Get the key for a record


getValue

public static java.lang.String getValue(java.lang.String record)
Get the value for a record


toggleBooleanPref

public static void toggleBooleanPref(java.lang.String name,
                                     boolean defaultBeforeToggle)
                              throws javax.microedition.rms.RecordStoreException
toggles a boolean of TYPE_PREFS

Throws:
javax.microedition.rms.RecordStoreException

getBooleanPref

public static boolean getBooleanPref(java.lang.String name,
                                     boolean defaultValue)
gets a boolean preference from TYPE_PREFS


getUI

public static UIComponent getUI(javax.microedition.lcdui.Display display,
                                UIComponent back)
                         throws javax.microedition.rms.RecordStoreException
Throws:
javax.microedition.rms.RecordStoreException