org.fosstrak.llrp.client.repository.sql
Class MySQLRepository

java.lang.Object
  extended by org.fosstrak.llrp.client.repository.sql.AbstractSQLRepository
      extended by org.fosstrak.llrp.client.repository.sql.MySQLRepository
All Implemented Interfaces:
Repository

public class MySQLRepository
extends AbstractSQLRepository

The MySQLRepository provides the basis for a MySQL repository back-end. The SQL-server is accessed via the MySQL-JDBC connector.

NOTICE:

We share most SQL statements with the Derby implementation of the SQL repository. However, the statement to create the LLRP messages table, and the way how the connection gets established, differ.
The user credentials as well as the JDBC connector URL are both obtained from the eclipse preference store (The user can configure the settings in the Preferences page in the tab LLRP-Commander).

Author:
sawielan

Field Summary
protected  java.lang.String DBDRIVER
          the MySQL JDBC driver.
static java.lang.String JDBC_STR
          default JDBC Connector URL.
protected  DerbyROAccessReportsRepository repoROAccessReports
           
 
Fields inherited from class org.fosstrak.llrp.client.repository.sql.AbstractSQLRepository
args, conn, connectURL, DB_DRIVER, DB_NAME, isHealth, logROAccess, NUM_TABLE_COLUMNS, password, SELECTOR_ADAPTOR, SELECTOR_COMMENT, SELECTOR_CONTENT, SELECTOR_ID, SELECTOR_MARK, SELECTOR_MESSAGE_TYPE, SELECTOR_READER, SELECTOR_STATUS, SELECTOR_TIMESTAMP, TABLE_LLRP_REPOSITORY, username, wipe, wipeROAccess
 
Fields inherited from interface org.fosstrak.llrp.client.Repository
RETRIEVE_ALL
 
Constructor Summary
MySQLRepository()
           
 
Method Summary
protected  java.lang.String getDBDriver()
          Returns the class name of the JDBC driver to be used.
 ROAccessReportsRepository getROAccessRepository()
          The ROAccessReportsRepository is implemented via the strategy pattern.
protected  java.sql.Connection openConnection()
          Opens the JDBC connection to the database.
protected  java.lang.String sqlCreateTable()
          NOTICE: this SQL command corresponds to derby SQL!.
 
Methods inherited from class org.fosstrak.llrp.client.repository.sql.AbstractSQLRepository
clearAdapter, clearAll, clearReader, close, count, createTable, dropTable, existsTable, get, get, getArgs, getDBConnection, initialize, isHealth, loadDriver, put, sqlDropTable, sqlInsertMessage, sqlRemoveAllAdapterMessages, sqlRemoveAllMessages, sqlRemoveAllReaderMessages, sqlSelectByAdapterAndReaderWithContent, sqlSelectByAdapterAndReaderWithoutContent, sqlSelectByAdapterWithContent, sqlSelectByAdapterWithoutContent, sqlSelectMessageByID, sqlSelectMessagesWithContent, sqlSelectMessagesWithoutContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBDRIVER

protected final java.lang.String DBDRIVER
the MySQL JDBC driver.

See Also:
Constant Field Values

repoROAccessReports

protected DerbyROAccessReportsRepository repoROAccessReports

JDBC_STR

public static final java.lang.String JDBC_STR
default JDBC Connector URL.

Constructor Detail

MySQLRepository

public MySQLRepository()
Method Detail

getDBDriver

protected java.lang.String getDBDriver()
Description copied from class: AbstractSQLRepository
Returns the class name of the JDBC driver to be used. NOTICE : you should override this method if you use a database other than derby.

Overrides:
getDBDriver in class AbstractSQLRepository
Returns:
a class name of the JDBC driver to be used.

openConnection

protected java.sql.Connection openConnection()
                                      throws java.lang.Exception
Description copied from class: AbstractSQLRepository
Opens the JDBC connection to the database.

Specified by:
openConnection in class AbstractSQLRepository
Returns:
a handle to the Connection item.
Throws:
java.lang.Exception - whenever the connection could not be established.

sqlCreateTable

protected java.lang.String sqlCreateTable()
Description copied from class: AbstractSQLRepository
NOTICE: this SQL command corresponds to derby SQL!.

Overrides:
sqlCreateTable in class AbstractSQLRepository
Returns:
a SQL command that creates the table.

getROAccessRepository

public ROAccessReportsRepository getROAccessRepository()
Description copied from interface: Repository
The ROAccessReportsRepository is implemented via the strategy pattern. Depending on the type of the repository, you will get a different implementation of this handle at runtime. The respective implementation will setup the data-structures used to log RO_ACCESS_REPORTS and ease the access to the stored information.

Returns:
a handle to the RO_ACCESS_REPORTS repository. if the implementation of the repository does not implement this functionality, it shall return null.


Copyright © 2009. All Rights Reserved.