com.jxml.qare.qhome
Class AppData

java.lang.Object
  |
  +--com.jxml.qare.qhome.SDO
        |
        +--com.jxml.qare.qhome.AppData
All Implemented Interfaces:
Item
Direct Known Subclasses:
RegisterAppDataBase

public abstract class AppData
extends SDO

This is the base class for all Application Data


Field Summary
 DBAppData.Row appDataRow
          The DBAppData.Row containing this AppData.
 
Constructor Summary
AppData()
           
 
Method Summary
 void dbAdd(P2PPlugin qapp)
          Add this object to the database using a randomly generated key.
 void dbAdd(P2PPlugin qapp, String key)
          Add to the database.
 void dbAddRoot(P2PPlugin qapp)
          Add this object to the database as the application root.
 void dbDelete()
          Remove from the database.
static AppData dbGet(P2PPlugin qapp, String key)
          Fetch from the database, given a unique key.
static AppData dbGetRoot(P2PPlugin qapp)
          Fetch the application root object from the database.
 void dbUpdate()
          Update the database.
 void emptyTable(String tableName)
          Empty table.
 void emptyWithKey(String entryKey)
          Remove all content from all tables with the given entryKey.
 void eval(Map properties, List args, ClassLoader cl)
          P2P response messages are not displayed in inbox.
 String getAction()
          This method specifies the action defined by all application data.
abstract  QSchemaFactory getAppDataFactory()
          Returns the QSchemaFactory for processing the application's data.
 DBApplication.Row getApplication()
          Returns the application
 List getContents(String tableName, String entryKey)
          Returns a List of AppData objects with matching tableName and entryKey.
 List getContentsWithKey(String entryKey)
          Returns a List of AppData objects with matching entryKey ordered by tableName.
 QSchemaFactory getFactory()
          Returns the QSchemaFactory for processing the application's data.
 int getId()
          Returns the appData ID
 String getKey()
          Returns the unique key
 List getKeys(String tableName)
          Returns a List of entry keys.
 P2PPlugin getPlugin()
          Returns the application plugin
 List getTable(String tableName)
          Returns a List of DBAppTable.Row objects describing the table, ordered by entryKey.
 List getTables()
          Returns a List of table names with this as the container.
 List getWithKey(String entryKey)
          Returns a List of DBAppTable.Row objects describing the table, ordered by tableName.
 boolean inDB()
          Return true if this object has been added to the database.
 boolean inTable(AppData container, String tableName, String entryKey)
          Returns true when the entry is in the table.
 void peerDeleted()
          Deletes this object from the database when an inbox peer object has been deleted.
 String process(String arg, InboxAgent inboxAgent)
          Process the template arguments.
 void removedFromTable(AppData container, String tableName, String entryKey)
          Deletes this object from the database when removed from an appData table.
 void tableAdd(AppData container, String tableName)
          Add to table using the time as the key.
 void tableAdd(AppData container, String tableName, String entryKey)
          Add to table.
 void tableDelete(AppData container, String tableName)
          Remove from table.
 void tableDelete(AppData container, String tableName, String entryKey)
          Remove from table.
 
Methods inherited from class com.jxml.qare.qhome.SDO
createInboxMsg, createInboxMsg, exceptionTraceString, getFactoryClassName, getQDoc, getSchema, toXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

appDataRow

public DBAppData.Row appDataRow
The DBAppData.Row containing this AppData.
Constructor Detail

AppData

public AppData()
Method Detail

dbGetRoot

public static final AppData dbGetRoot(P2PPlugin qapp)
                               throws Exception
Fetch the application root object from the database.

dbGet

public static final AppData dbGet(P2PPlugin qapp,
                                  String key)
                           throws Exception
Fetch from the database, given a unique key.

getAppDataFactory

public abstract QSchemaFactory getAppDataFactory()
Returns the QSchemaFactory for processing the application's data. This method is implemented by the application's own base AppData class.

process

public String process(String arg,
                      InboxAgent inboxAgent)
               throws Exception
Process the template arguments. Override this method to support display by the application's inboxAgent.

peerDeleted

public void peerDeleted()
                 throws Exception
Deletes this object from the database when an inbox peer object has been deleted. Override this method to change the default behavior.

removedFromTable

public void removedFromTable(AppData container,
                             String tableName,
                             String entryKey)
                      throws Exception
Deletes this object from the database when removed from an appData table. Override this method to change the default behavior.

getFactory

public final QSchemaFactory getFactory()
Returns the QSchemaFactory for processing the application's data.
Overrides:
getFactory in class SDO

inDB

public final boolean inDB()
Return true if this object has been added to the database.

dbAdd

public final void dbAdd(P2PPlugin qapp)
                 throws Exception
Add this object to the database using a randomly generated key.

dbAddRoot

public final void dbAddRoot(P2PPlugin qapp)
                     throws Exception
Add this object to the database as the application root.

dbAdd

public final void dbAdd(P2PPlugin qapp,
                        String key)
                 throws Exception
Add to the database. Use when appData has an inbox peer object, or when a key is otherwise pre-defined.

dbUpdate

public void dbUpdate()
              throws Exception
Update the database.

dbDelete

public final void dbDelete()
                    throws Exception
Remove from the database.

tableAdd

public final void tableAdd(AppData container,
                           String tableName)
                    throws Exception
Add to table using the time as the key.

tableAdd

public final void tableAdd(AppData container,
                           String tableName,
                           String entryKey)
                    throws Exception
Add to table.

emptyTable

public final void emptyTable(String tableName)
                      throws Exception
Empty table.

emptyWithKey

public final void emptyWithKey(String entryKey)
                        throws Exception
Remove all content from all tables with the given entryKey.

tableDelete

public final void tableDelete(AppData container,
                              String tableName)
                       throws Exception
Remove from table.

tableDelete

public final void tableDelete(AppData container,
                              String tableName,
                              String entryKey)
                       throws Exception
Remove from table.

getTable

public final List getTable(String tableName)
                    throws Exception
Returns a List of DBAppTable.Row objects describing the table, ordered by entryKey.

getWithKey

public final List getWithKey(String entryKey)
                      throws Exception
Returns a List of DBAppTable.Row objects describing the table, ordered by tableName.

getTables

public final List getTables()
                     throws Exception
Returns a List of table names with this as the container.

inTable

public final boolean inTable(AppData container,
                             String tableName,
                             String entryKey)
                      throws Exception
Returns true when the entry is in the table.

getKeys

public final List getKeys(String tableName)
                   throws Exception
Returns a List of entry keys.

getContents

public final List getContents(String tableName,
                              String entryKey)
                       throws Exception
Returns a List of AppData objects with matching tableName and entryKey.

getContentsWithKey

public final List getContentsWithKey(String entryKey)
                              throws Exception
Returns a List of AppData objects with matching entryKey ordered by tableName.

getPlugin

public final P2PPlugin getPlugin()
Returns the application plugin

getApplication

public final DBApplication.Row getApplication()
Returns the application

getKey

public final String getKey()
                    throws Exception
Returns the unique key

getId

public final int getId()
Returns the appData ID

getAction

public final String getAction()
This method specifies the action defined by all application data.
Overrides:
getAction in class SDO

eval

public final void eval(Map properties,
                       List args,
                       ClassLoader cl)
                throws Exception
P2P response messages are not displayed in inbox.
Overrides:
eval in class SDO