The Mighty Shoechicken (Not Actual Size) Shoechicken: AI Learning Agent

Home | F.A.Q | Documentation | Links | Blog | Wiki | Project Home | Download |
Valid XHTML 1.0 Strict Valid CSS!

It has been decided that the individual Shoechicken modules should not directly interact with the database, but should instead use proxy objects to perform database requests. Using this approach, the design of the database may change over time, but as long as the interface to the proxy objects does not change the Shoechicken modules will not be affected. This will also isolate the SQL used to perform database requests in the appropriate proxies.

The following designs have been decided upon to support the modules which require database access:


ConnectionManager

It has been decided that to improve efficiency and reduce the strain on the database, a connection manager will be employed to control the maximum number of open connections to the database. The reasoning is that it is wasteful for each request to create a connection to the database, perform a query/insert/update, and then tear down the connection. The ConnectionManager class will be responsible for creating connections to the database, and will dole them out as requested. These connections will always remain active, so there will be no need to create more. This approach will also limit the number of connections to the database, as this can be enforced by the ConnectionManager.

com.shoechicken.util.ConnectionManager
Method Returns Parameters Throws Description
ConnectionManager None None None The ConnectionManager constructor creates the initial connections to the database. The ConnectionManager will retrieve information about the database (such as the driver to use and the connection string) and about the number of connections (initial and maximum) from a properties file.
getConnection Connection None None A blocking call which will wait until a connection is available and then return an open Connection to the database.
getConnection Connection int timeout NoAvailableConnectionsException Returns an open Connection to the database from the connection pool. If a Connection is not available before the amount of time specified by the timeout, a NoAvailableConnectionsException is thrown.
releaseConnection void Connection connection None Returns a connection to the pool of available connections.
getInstance ConnectionManager None None A static method which returns a singleton instance of the ConnectionManager. This is provided so that other modules can easily have access to the ConnectionManager.

BufunkaloDatabaseHelper

The BufunkaloDatabaseHelper class is designed to aid the Bufunkalo module in its task of weeding out feed items before processing and and adding feeds to the database.

com.shoechicken.sc.bfnklo.BufunkaloDatabaseHelper
Method Returns Parameters Throws Description
getFeedItems List<gFeedItem> String url, String title, String description None Queries the database for all FeedItems which have the url, title, and description specified. The result set is returned as a List of FeedItems.
getFeed Feed String url None Queries the database and returns the Feed specified by the url.
addFeed boolean Feed feed None Adds the Feed provided to the database and returns whether the operation was successful.

ShredderDatabaseHelper

The ShredderDatabaseHelper class is designed to aid the Shredder module in its task of adding FeedItems, contexts, and keywords to the database.

com.shoechicken.sc.bfnklo.shred.ShredderDatabaseHelper
Method Returns Parameters Throws Description
addFeedItem int FeedItem feedItem None Adds the FeedItem to the database and returns the unique ID associated with that FeedItem.
getFeedItemId int FeedItem feedItem None Queries the database and returns the unique ID associated with the FeedItem in the database.
addContext int String context None Adds the context to the database and returns the unique ID associated with that context.
getContextId int String context None Queries the database and returns the unique ID associated with the context in the database.
addKeyword boolean String keyword, int contextId, int itemId, int count None Adds a keyword and its count to the database for a given item and context and returns whether the operation was successful.

ShoechickenDatabaseHelper

The ShoechickenDatabaseHelper class is designed to aid the Shoechicken module in its task of retrieving unrated FeedItems, keywords counts for items, and context information.

com.shoechicken.sc.ShoechickenDatabaseHelper
Method Returns Parameters Throws Description
getUnratedFeedItems List<FeedItem> String username, URL feedUrl None Queries the database and returns a List of FeedItem objects that the Shoechicken has not yet rated for the given user and feed.
getContexts List<String> FeedItem feedItem None Queries the database and returns all of the contexts related to a FeedItem.
getKeywordCounts Map<String, Integer> FeedItem feedItem, String context None Queries the database and returns a mapping between the keywords within a particular FeedItem and context and their associated counts.
getContexts List<String> String username None Queries the database and returns all of the contexts related to a user.
getKeywordCounts Map<String, Integer> String username, String context None Queries the database and returns a mapping between the keywords within a particular user and context and their associated counts.