Package jade.domain.KBManagement
Class DBKB
- java.lang.Object
-
- jade.domain.KBManagement.KB
-
- jade.domain.KBManagement.DBKB
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classDBKB.ConnectionWrapperprotected classDBKB.EmptyKBIteratorInner class EmptyKBIterator
-
Constructor Summary
Constructors Constructor Description DBKB(String url, int maxResultLimit, boolean cleanTables)Constructs a newDFKBand establishes a connection to the database at the given URL using thesun.jdbc.odbc.JdbcOdbcDriverdriver.DBKB(String drv, String url, int maxResultLimit, boolean cleanTables)Constructs a newDFKBand establishes a connection to the database.DBKB(String drv, String url, String username, String password, int maxResultLimit, boolean cleanTables)Constructs a newDFKBand establishes a connection to the database.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected ConnectioncreateDBConnection(String url, String username, String password)protected DBKB.ConnectionWrappergetConnectionWrapper()abstract EnumerationgetSubscriptions()protected voidinitConnectionWrapper(DBKB.ConnectionWrapper wrapper)Subclasses can redefine this method to provide implementation specific ConnectionWrapper initializationsprotected Objectinsert(Object name, Object fact)protected abstract ObjectinsertSingle(Object name, Object fact)KBIteratoriterator(Object template)protected abstract KBIteratoriteratorSingle(Object template)protected Objectremove(Object name)protected abstract ObjectremoveSingle(Object name)Listsearch(Object template, int maxResult)protected abstract ListsearchSingle(Object template, int maxResult)abstract voidsetup()This method is called by the KB Factory and is a placeholder for implementation specific KB initializations.voidsubscribe(Object template, SubscriptionResponder.Subscription s)protected abstract voidsubscribeSingle(Object template, SubscriptionResponder.Subscription s)voidunsubscribe(SubscriptionResponder.Subscription s)protected abstract voidunsubscribeSingle(SubscriptionResponder.Subscription s)-
Methods inherited from class jade.domain.KBManagement.KB
deregister, register, search, setLeaseManager, setSubscriptionResponder
-
-
-
-
Field Detail
-
driver
protected String driver
Used database driver
-
cleanTables
protected boolean cleanTables
Specifies whether the KB should delete all existing tables for the DF at startup
-
-
Constructor Detail
-
DBKB
public DBKB(String url, int maxResultLimit, boolean cleanTables) throws SQLException
Constructs a newDFKBand establishes a connection to the database at the given URL using thesun.jdbc.odbc.JdbcOdbcDriverdriver.- Parameters:
maxResultLimit- internal limit for the number of maximum search results.url- database URLmaxResultLimit- JADE internal limit for the maximum number of search resultscleanTables- specifies whether the KB should delete all existing tables for the DF at startup- Throws:
SQLException- an error occured while opening a connection to the database
-
DBKB
public DBKB(String drv, String url, int maxResultLimit, boolean cleanTables) throws SQLException
Constructs a newDFKBand establishes a connection to the database.- Parameters:
maxResultLimit- internal limit for the number of maximum search results.drv- database driverurl- database URLuser- database user namepasswd- database passwordmaxResultLimit- JADE internal limit for the maximum number of search resultscleanTables- specifies whether the KB should delete all existing tables for the DF at startup- Throws:
SQLException- an error occured while opening a connection to the database
-
DBKB
public DBKB(String drv, String url, String username, String password, int maxResultLimit, boolean cleanTables) throws SQLException
Constructs a newDFKBand establishes a connection to the database.- Parameters:
maxResultLimit- internal limit for the number of maximum search results.drv- database driverurl- database URLuser- database user namepasswd- database passwordmaxResultLimit- JADE internal limit for the maximum number of search resultscleanTables- specifies whether the KB should delete all existing tables for the DF at startup- Throws:
SQLException- an error occured while opening a connection to the database
-
-
Method Detail
-
setup
public abstract void setup() throws SQLExceptionThis method is called by the KB Factory and is a placeholder for implementation specific KB initializations.- Throws:
SQLException
-
createDBConnection
protected Connection createDBConnection(String url, String username, String password) throws SQLException
- Throws:
SQLException
-
getConnectionWrapper
protected final DBKB.ConnectionWrapper getConnectionWrapper() throws SQLException
- Throws:
SQLException
-
initConnectionWrapper
protected void initConnectionWrapper(DBKB.ConnectionWrapper wrapper) throws SQLException
Subclasses can redefine this method to provide implementation specific ConnectionWrapper initializations- Throws:
SQLException
-
insertSingle
protected abstract Object insertSingle(Object name, Object fact) throws SQLException
- Throws:
SQLException
-
removeSingle
protected abstract Object removeSingle(Object name) throws SQLException
- Throws:
SQLException
-
searchSingle
protected abstract List searchSingle(Object template, int maxResult) throws SQLException
- Throws:
SQLException
-
iterator
public KBIterator iterator(Object template)
-
iteratorSingle
protected abstract KBIterator iteratorSingle(Object template) throws SQLException
- Throws:
SQLException
-
subscribe
public void subscribe(Object template, SubscriptionResponder.Subscription s) throws NotUnderstoodException
- Specified by:
subscribein classKB- Throws:
NotUnderstoodException
-
subscribeSingle
protected abstract void subscribeSingle(Object template, SubscriptionResponder.Subscription s) throws SQLException, NotUnderstoodException
- Throws:
SQLExceptionNotUnderstoodException
-
getSubscriptions
public abstract Enumeration getSubscriptions()
- Specified by:
getSubscriptionsin classKB
-
unsubscribe
public void unsubscribe(SubscriptionResponder.Subscription s)
- Specified by:
unsubscribein classKB
-
unsubscribeSingle
protected abstract void unsubscribeSingle(SubscriptionResponder.Subscription s) throws SQLException
- Throws:
SQLException
-
-