Commit 65e4595c authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[1061] Yet another renaming

This time to DatabaseAccessor, Abstraction might be misleading in other
ways.
parent 97153d16
......@@ -23,7 +23,7 @@ libdatasrc_la_SOURCES += result.h
libdatasrc_la_SOURCES += logger.h logger.cc
libdatasrc_la_SOURCES += client.h
libdatasrc_la_SOURCES += database.h database.cc
libdatasrc_la_SOURCES += sqlite3_database.h sqlite3_database.cc
libdatasrc_la_SOURCES += sqlite3_accessor.h sqlite3_accessor.cc
nodist_libdatasrc_la_SOURCES = datasrc_messages.h datasrc_messages.cc
libdatasrc_la_LIBADD = $(top_builddir)/src/lib/exceptions/libexceptions.la
......
......@@ -22,7 +22,7 @@ using isc::dns::Name;
namespace isc {
namespace datasrc {
DatabaseClient::DatabaseClient(boost::shared_ptr<DatabaseAbstraction>
DatabaseClient::DatabaseClient(boost::shared_ptr<DatabaseAccessor>
database) :
database_(database)
{
......@@ -55,7 +55,7 @@ DatabaseClient::findZone(const Name& name) const {
return (FindResult(result::NOTFOUND, ZoneFinderPtr()));
}
DatabaseClient::Finder::Finder(boost::shared_ptr<DatabaseAbstraction>
DatabaseClient::Finder::Finder(boost::shared_ptr<DatabaseAccessor>
database, int zone_id) :
database_(database),
zone_id_(zone_id)
......
......@@ -43,7 +43,7 @@ namespace datasrc {
* allows having multiple open queries at one connection, the connection
* class may share it.
*/
class DatabaseAbstraction : boost::noncopyable {
class DatabaseAccessor : boost::noncopyable {
public:
/**
* \brief Destructor
......@@ -51,7 +51,7 @@ public:
* It is empty, but needs a virtual one, since we will use the derived
* classes in polymorphic way.
*/
virtual ~DatabaseAbstraction() { }
virtual ~DatabaseAccessor() { }
/**
* \brief Retrieve a zone identifier
*
......@@ -79,14 +79,14 @@ public:
*
* This class (together with corresponding versions of ZoneFinder,
* ZoneIterator, etc.) translates high-level data source queries to
* low-level calls on DatabaseAbstraction. It calls multiple queries
* low-level calls on DatabaseAccessor. It calls multiple queries
* if necessary and validates data from the database, allowing the
* DatabaseAbstraction to be just simple translation to SQL/other
* DatabaseAccessor to be just simple translation to SQL/other
* queries to database.
*
* While it is possible to subclass it for specific database in case
* of special needs, it is not expected to be needed. This should just
* work as it is with whatever DatabaseAbstraction.
* work as it is with whatever DatabaseAccessor.
*/
class DatabaseClient : public DataSourceClient {
public:
......@@ -102,7 +102,7 @@ public:
* suggests, the client takes ownership of the database and will
* delete it when itself deleted.
*/
DatabaseClient(boost::shared_ptr<DatabaseAbstraction> database);
DatabaseClient(boost::shared_ptr<DatabaseAccessor> database);
/**
* \brief Corresponding ZoneFinder implementation
*
......@@ -126,10 +126,10 @@ public:
* \param database The database (shared with DatabaseClient) to
* be used for queries (the one asked for ID before).
* \param zone_id The zone ID which was returned from
* DatabaseAbstraction::getZone and which will be passed to further
* DatabaseAccessor::getZone and which will be passed to further
* calls to the database.
*/
Finder(boost::shared_ptr<DatabaseAbstraction> database, int zone_id);
Finder(boost::shared_ptr<DatabaseAccessor> database, int zone_id);
// The following three methods are just implementations of inherited
// ZoneFinder's pure virtual methods.
virtual isc::dns::Name getOrigin() const;
......@@ -154,11 +154,11 @@ public:
* passed to the constructor. This is meant for testing purposes and
* normal applications shouldn't need it.
*/
const DatabaseAbstraction& database() const {
const DatabaseAccessor& database() const {
return (*database_);
}
private:
boost::shared_ptr<DatabaseAbstraction> database_;
boost::shared_ptr<DatabaseAccessor> database_;
const int zone_id_;
};
/**
......@@ -178,7 +178,7 @@ public:
virtual FindResult findZone(const isc::dns::Name& name) const;
private:
/// \brief Our database.
const boost::shared_ptr<DatabaseAbstraction> database_;
const boost::shared_ptr<DatabaseAccessor> database_;
};
}
......
......@@ -14,7 +14,7 @@
#include <sqlite3.h>
#include <datasrc/sqlite3_database.h>
#include <datasrc/sqlite3_accessor.h>
#include <datasrc/logger.h>
#include <datasrc/data_source.h>
......
......@@ -13,8 +13,8 @@
// PERFORMANCE OF THIS SOFTWARE.
#ifndef __DATASRC_SQLITE3_CONNECTION_H
#define __DATASRC_SQLITE3_CONNECTION_H
#ifndef __DATASRC_SQLITE3_ACCESSOR_H
#define __DATASRC_SQLITE3_ACCESSOR_H
#include <datasrc/database.h>
......@@ -45,13 +45,13 @@ public:
struct SQLite3Parameters;
/**
* \brief Concrete implementation of DatabaseAbstraction for SQLite3 databases
* \brief Concrete implementation of DatabaseAccessor for SQLite3 databases
*
* This opens one database file with our schema and serves data from there.
* According to the design, it doesn't interpret the data in any way, it just
* provides unified access to the DB.
*/
class SQLite3Database : public DatabaseAbstraction {
class SQLite3Database : public DatabaseAccessor {
public:
/**
* \brief Constructor
......@@ -77,7 +77,7 @@ public:
/**
* \brief Look up a zone
*
* This implements the getZone from DatabaseAbstraction and looks up a zone
* This implements the getZone from DatabaseAccessor and looks up a zone
* in the data. It looks for a zone with the exact given origin and class
* passed to the constructor.
*
......
......@@ -29,7 +29,7 @@ run_unittests_SOURCES += zonetable_unittest.cc
run_unittests_SOURCES += memory_datasrc_unittest.cc
run_unittests_SOURCES += logger_unittest.cc
run_unittests_SOURCES += database_unittest.cc
run_unittests_SOURCES += sqlite3_database_unittest.cc
run_unittests_SOURCES += sqlite3_accessor_unittest.cc
run_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
run_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
......
......@@ -30,7 +30,7 @@ namespace {
* A virtual database connection that pretends it contains single zone --
* example.org.
*/
class MockAbstraction : public DatabaseAbstraction {
class MockAccessor : public DatabaseAccessor {
public:
virtual std::pair<bool, int> getZone(const Name& name) const {
if (name == Name("example.org")) {
......@@ -51,12 +51,12 @@ public:
* times per test.
*/
void createClient() {
current_database_ = new MockAbstraction();
client_.reset(new DatabaseClient(shared_ptr<DatabaseAbstraction>(
current_database_ = new MockAccessor();
client_.reset(new DatabaseClient(shared_ptr<DatabaseAccessor>(
current_database_)));
}
// Will be deleted by client_, just keep the current value for comparison.
MockAbstraction* current_database_;
MockAccessor* current_database_;
shared_ptr<DatabaseClient> client_;
/**
* Check the zone finder is a valid one and references the zone ID and
......@@ -92,7 +92,7 @@ TEST_F(DatabaseClientTest, superZone) {
}
TEST_F(DatabaseClientTest, noConnException) {
EXPECT_THROW(DatabaseClient(shared_ptr<DatabaseAbstraction>()),
EXPECT_THROW(DatabaseClient(shared_ptr<DatabaseAccessor>()),
isc::InvalidParameter);
}
......
......@@ -12,7 +12,7 @@
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
#include <datasrc/sqlite3_database.h>
#include <datasrc/sqlite3_accessor.h>
#include <datasrc/data_source.h>
#include <dns/rrclass.h>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment