|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjade.domain.KBManagement.KB
jade.domain.KBManagement.DBKB
jade.domain.DFDBKB
public class DFDBKB
This class implements a knowledge base used by the DF which stores its content in an external database.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class jade.domain.KBManagement.DBKB |
|---|
jade.domain.KBManagement.DBKB.ConnectionWrapper, jade.domain.KBManagement.DBKB.EmptyKBIterator |
| Field Summary | |
|---|---|
protected java.lang.String |
DEFAULT_LONGVARCHAR_TYPE
Default data type for very long strings |
| Fields inherited from class jade.domain.KBManagement.DBKB |
|---|
cleanTables, driver |
| Fields inherited from class jade.domain.KBManagement.KB |
|---|
lm, logger, sr |
| Constructor Summary | |
|---|---|
DFDBKB(int maxResultLimit,
java.lang.String drv,
java.lang.String url,
java.lang.String user,
java.lang.String passwd,
boolean cleanTables)
Constructor |
|
| Method Summary | |
|---|---|
protected void |
createDFTables()
Creates the proper DB tables. |
protected void |
createIndices()
Adds explicit indices to the database to speed up queries |
protected void |
createTable(java.lang.String name,
java.lang.String[] entries)
Creates a new DB table |
protected void |
dropDFTables()
Drops all existing DB tables used by the DF. |
protected void |
dropTable(java.sql.Statement stmt,
java.lang.String tableName)
Drops a DB table or does nothing if the table doesn't exist. |
protected java.lang.String |
getGUID()
Returns a global unique identifier |
protected java.lang.String |
getHashValue(java.lang.Object obj)
Returns an MD5 hash value for an object |
protected java.lang.String |
getLongVarCharType()
Returns the name of the SQL type used in the database to represent very long strings. |
java.util.Enumeration |
getSubscriptions()
Return all known subscriptions at the DF |
protected void |
initConnectionWrapper(jade.domain.KBManagement.DBKB.ConnectionWrapper wrapper)
Subclasses can redefine this method to provide implementation specific ConnectionWrapper initializations |
protected java.lang.Object |
insertSingle(java.lang.Object name,
java.lang.Object fact)
Insert a new DFD object. |
protected jade.domain.KBManagement.KBIterator |
iteratorSingle(java.lang.Object template)
|
protected java.lang.String |
prepDBStr(java.lang.String s)
This method must be used when inserting text values into a DB. |
protected java.lang.Object |
removeSingle(java.lang.Object name)
Remove the DFD object corresponding to the indicated AID. |
protected java.lang.String |
replace(java.lang.String str,
java.lang.String pattern,
java.lang.String replaceWith)
Replaces all occurences of a pattern in str
with replaceWith |
protected List |
searchSingle(java.lang.Object template,
int maxResult)
Retrieve the DFDs matching the given template |
void |
setup()
Initializes all used SQL statements, the DB tables and the logging |
protected void |
subscribeSingle(java.lang.Object dfd,
SubscriptionResponder.Subscription s)
|
protected boolean |
tableExists(java.lang.String name)
Check whether a database table already exists |
protected void |
unsubscribeSingle(SubscriptionResponder.Subscription sub)
|
| Methods inherited from class jade.domain.KBManagement.DBKB |
|---|
createDBConnection, getConnectionWrapper, insert, iterator, remove, search, subscribe, unsubscribe |
| Methods inherited from class jade.domain.KBManagement.KB |
|---|
deregister, register, search, setLeaseManager, setSubscriptionResponder |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.String DEFAULT_LONGVARCHAR_TYPE
| Constructor Detail |
|---|
public DFDBKB(int maxResultLimit,
java.lang.String drv,
java.lang.String url,
java.lang.String user,
java.lang.String passwd,
boolean cleanTables)
throws java.sql.SQLException
maxResultLimit - internal limit for the number of maximum search results.drv - database driverurl - database URLuser - database user namepasswd - database passwordcleanTables - specifies whether the KB should delete all existing tables for the DF at startup
java.sql.SQLException - an error occured while opening a connection to the database| Method Detail |
|---|
public void setup()
throws java.sql.SQLException
setup in class jade.domain.KBManagement.DBKBjava.sql.SQLException
protected void initConnectionWrapper(jade.domain.KBManagement.DBKB.ConnectionWrapper wrapper)
throws java.sql.SQLException
jade.domain.KBManagement.DBKB
initConnectionWrapper in class jade.domain.KBManagement.DBKBjava.sql.SQLExceptionprotected java.lang.String getLongVarCharType()
protected java.lang.String getGUID()
protected void dropTable(java.sql.Statement stmt,
java.lang.String tableName)
protected void dropDFTables()
throws java.sql.SQLException
java.sql.SQLExceptionprotected boolean tableExists(java.lang.String name)
name - name of the table
protected void createTable(java.lang.String name,
java.lang.String[] entries)
name - name of the tableentries - array of column and constraint specifications
java.sql.SQLException - If the table cannot be createdprotected void createIndices()
protected void createDFTables()
protected java.lang.Object insertSingle(java.lang.Object name,
java.lang.Object fact)
throws java.sql.SQLException
insertSingle in class jade.domain.KBManagement.DBKBjava.sql.SQLException
protected java.lang.Object removeSingle(java.lang.Object name)
throws java.sql.SQLException
removeSingle in class jade.domain.KBManagement.DBKBjava.sql.SQLException
protected List searchSingle(java.lang.Object template,
int maxResult)
throws java.sql.SQLException
searchSingle in class jade.domain.KBManagement.DBKBjava.sql.SQLException
protected jade.domain.KBManagement.KBIterator iteratorSingle(java.lang.Object template)
throws java.sql.SQLException
iteratorSingle in class jade.domain.KBManagement.DBKBjava.sql.SQLException
protected void subscribeSingle(java.lang.Object dfd,
SubscriptionResponder.Subscription s)
throws java.sql.SQLException,
NotUnderstoodException
subscribeSingle in class jade.domain.KBManagement.DBKBjava.sql.SQLException
NotUnderstoodExceptionpublic java.util.Enumeration getSubscriptions()
getSubscriptions in class jade.domain.KBManagement.DBKBEnumeration with instances of the class
jade.proto.SubscriptionResponder&Subscription
protected void unsubscribeSingle(SubscriptionResponder.Subscription sub)
throws java.sql.SQLException
unsubscribeSingle in class jade.domain.KBManagement.DBKBjava.sql.SQLException
protected java.lang.String getHashValue(java.lang.Object obj)
throws java.lang.Exception
obj - Object to use for the hash value calcualtion
java.lang.Exception - The hash value couldn't be generatedprotected java.lang.String prepDBStr(java.lang.String s)
protected java.lang.String replace(java.lang.String str,
java.lang.String pattern,
java.lang.String replaceWith)
pattern in str
with replaceWith
str - source stringpattern - pattern string to search forreplaceWith - new string
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||