diff options
23 files changed, 33 insertions, 29 deletions
diff --git a/mythfs/service/dbimpl.cpp b/mythfs/service/dbimpl.cpp index 3891722..c3d1b3d 100644 --- a/mythfs/service/dbimpl.cpp +++ b/mythfs/service/dbimpl.cpp @@ -8,7 +8,7 @@ namespace MythFS { } Recordeds - DBImpl::getRecorded(const Ice::Current &) + DBImpl::getRecorded() { return fetchCache<Recordeds>(sql::getRecorded, 10); } diff --git a/mythfs/service/dbimpl.h b/mythfs/service/dbimpl.h index 6726826..e6c4b19 100644 --- a/mythfs/service/dbimpl.h +++ b/mythfs/service/dbimpl.h @@ -5,11 +5,11 @@ #include <abstractCachingDatabaseClient.h> namespace MythFS { - class DBImpl : public DB, ::IceTray::AbstractCachingDatabaseClient { + class DLL_PUBLIC DBImpl : public DB, ::IceTray::AbstractCachingDatabaseClient { public: DBImpl(IceTray::DatabasePoolPtr); - Recordeds getRecorded(const Ice::Current &); + Recordeds getRecorded() override; }; } diff --git a/mythfs/service/inodes/allDirectory.cpp b/mythfs/service/inodes/allDirectory.cpp index d7745f6..d7278a3 100644 --- a/mythfs/service/inodes/allDirectory.cpp +++ b/mythfs/service/inodes/allDirectory.cpp @@ -4,7 +4,7 @@ #include <exceptions.h> namespace MythFS { - AllDirectory::AllDirectory(const DBPrx & d) : db(d) { } + AllDirectory::AllDirectory(const DBPtr & d) : db(d) { } NetFS::NameList AllDirectory::getContents() const diff --git a/mythfs/service/inodes/allDirectory.h b/mythfs/service/inodes/allDirectory.h index 67165ef..6486f77 100644 --- a/mythfs/service/inodes/allDirectory.h +++ b/mythfs/service/inodes/allDirectory.h @@ -7,14 +7,14 @@ namespace MythFS { class AllDirectory : public AbstractDynamicDirectory { public: - AllDirectory(const DBPrx &); + AllDirectory(const DBPtr &); protected: NetFS::NameList getContents() const override; PointerType getChild(const std::string &) const override; private: - DBPrx db; + DBPtr db; }; } diff --git a/mythfs/service/inodes/filterByDateDirectory.cpp b/mythfs/service/inodes/filterByDateDirectory.cpp index a8964c0..53298e9 100644 --- a/mythfs/service/inodes/filterByDateDirectory.cpp +++ b/mythfs/service/inodes/filterByDateDirectory.cpp @@ -5,7 +5,7 @@ #include <boost/algorithm/string/predicate.hpp> namespace MythFS { - FilterByDateDirectory::FilterByDateDirectory(DBPrx db, const std::string & d) : + FilterByDateDirectory::FilterByDateDirectory(DBPtr db, const std::string & d) : FilteringDirectory<std::string>(db), date(d) { diff --git a/mythfs/service/inodes/filterByDateDirectory.h b/mythfs/service/inodes/filterByDateDirectory.h index 84da471..16a9402 100644 --- a/mythfs/service/inodes/filterByDateDirectory.h +++ b/mythfs/service/inodes/filterByDateDirectory.h @@ -8,7 +8,7 @@ namespace MythFS { class FilterByDateDirectory : public FilteringDirectory<std::string> { public: - FilterByDateDirectory(DBPrx db, const std::string &); + FilterByDateDirectory(DBPtr db, const std::string &); protected: std::string attribute(const MythFS::RecordedPtr &) const; diff --git a/mythfs/service/inodes/filterByTitleDirectory.cpp b/mythfs/service/inodes/filterByTitleDirectory.cpp index d17999f..3d8f4bd 100644 --- a/mythfs/service/inodes/filterByTitleDirectory.cpp +++ b/mythfs/service/inodes/filterByTitleDirectory.cpp @@ -4,7 +4,7 @@ #include <exceptions.h> namespace MythFS { - FilterByTitleDirectory::FilterByTitleDirectory(DBPrx db, const std::string & t) : + FilterByTitleDirectory::FilterByTitleDirectory(DBPtr db, const std::string & t) : FilteringDirectory<std::string>(db), title(t) { diff --git a/mythfs/service/inodes/filterByTitleDirectory.h b/mythfs/service/inodes/filterByTitleDirectory.h index 31c35fa..dda090b 100644 --- a/mythfs/service/inodes/filterByTitleDirectory.h +++ b/mythfs/service/inodes/filterByTitleDirectory.h @@ -8,7 +8,7 @@ namespace MythFS { class FilterByTitleDirectory : public FilteringDirectory<std::string> { public: - FilterByTitleDirectory(DBPrx db, const std::string &); + FilterByTitleDirectory(DBPtr db, const std::string &); protected: std::string attribute(const MythFS::RecordedPtr &) const; diff --git a/mythfs/service/inodes/filteringDirectory.cpp b/mythfs/service/inodes/filteringDirectory.cpp index efac165..2a6743b 100644 --- a/mythfs/service/inodes/filteringDirectory.cpp +++ b/mythfs/service/inodes/filteringDirectory.cpp @@ -3,7 +3,7 @@ namespace MythFS { template<typename T> - FilteringDirectory<T>::FilteringDirectory(DBPrx d) : + FilteringDirectory<T>::FilteringDirectory(DBPtr d) : db(d) { } diff --git a/mythfs/service/inodes/filteringDirectory.h b/mythfs/service/inodes/filteringDirectory.h index 3f6fc68..9343544 100644 --- a/mythfs/service/inodes/filteringDirectory.h +++ b/mythfs/service/inodes/filteringDirectory.h @@ -9,14 +9,14 @@ namespace MythFS { template <typename T> class FilteringDirectory : public AbstractDynamicDirectory { public: - FilteringDirectory(DBPrx db); + FilteringDirectory(DBPtr db); protected: virtual bool matches(const MythFS::RecordedPtr &) const = 0; virtual T attribute(const MythFS::RecordedPtr &) const = 0; NetFS::NameList getContents() const override; - DBPrx db; + DBPtr db; }; } diff --git a/mythfs/service/inodes/groupingByDateDirectory.cpp b/mythfs/service/inodes/groupingByDateDirectory.cpp index 1ab83a2..6aa842e 100644 --- a/mythfs/service/inodes/groupingByDateDirectory.cpp +++ b/mythfs/service/inodes/groupingByDateDirectory.cpp @@ -4,7 +4,7 @@ #include <exceptions.h> namespace MythFS { - ByDateDirectory::ByDateDirectory(DBPrx db) : + ByDateDirectory::ByDateDirectory(DBPtr db) : GroupingDirectory<std::string>(db) { } diff --git a/mythfs/service/inodes/groupingByDateDirectory.h b/mythfs/service/inodes/groupingByDateDirectory.h index 1fef9e5..587ab16 100644 --- a/mythfs/service/inodes/groupingByDateDirectory.h +++ b/mythfs/service/inodes/groupingByDateDirectory.h @@ -6,7 +6,7 @@ namespace MythFS { class ByDateDirectory : public GroupingDirectory<std::string> { public: - ByDateDirectory(DBPrx db); + ByDateDirectory(DBPtr db); protected: std::string attribute(const MythFS::RecordedPtr &) const override; diff --git a/mythfs/service/inodes/groupingByTitleDirectory.cpp b/mythfs/service/inodes/groupingByTitleDirectory.cpp index e215e55..a87687c 100644 --- a/mythfs/service/inodes/groupingByTitleDirectory.cpp +++ b/mythfs/service/inodes/groupingByTitleDirectory.cpp @@ -4,7 +4,7 @@ #include <exceptions.h> namespace MythFS { - ByTitleDirectory::ByTitleDirectory(DBPrx db) : + ByTitleDirectory::ByTitleDirectory(DBPtr db) : GroupingDirectory<std::string>(db) { } diff --git a/mythfs/service/inodes/groupingByTitleDirectory.h b/mythfs/service/inodes/groupingByTitleDirectory.h index 2d88b80..94425d2 100644 --- a/mythfs/service/inodes/groupingByTitleDirectory.h +++ b/mythfs/service/inodes/groupingByTitleDirectory.h @@ -6,7 +6,7 @@ namespace MythFS { class ByTitleDirectory : public GroupingDirectory<std::string> { public: - ByTitleDirectory(DBPrx db); + ByTitleDirectory(DBPtr db); protected: std::string attribute(const MythFS::RecordedPtr &) const override; diff --git a/mythfs/service/inodes/groupingDirectory.cpp b/mythfs/service/inodes/groupingDirectory.cpp index 30e71d8..bb45b68 100644 --- a/mythfs/service/inodes/groupingDirectory.cpp +++ b/mythfs/service/inodes/groupingDirectory.cpp @@ -3,7 +3,7 @@ namespace MythFS { template<typename T> - GroupingDirectory<T>::GroupingDirectory(DBPrx d) : db(d) { } + GroupingDirectory<T>::GroupingDirectory(DBPtr d) : db(d) { } template<typename T> NetFS::NameList diff --git a/mythfs/service/inodes/groupingDirectory.h b/mythfs/service/inodes/groupingDirectory.h index 5e587ac..a9ae3c6 100644 --- a/mythfs/service/inodes/groupingDirectory.h +++ b/mythfs/service/inodes/groupingDirectory.h @@ -9,13 +9,13 @@ namespace MythFS { template <typename T> class GroupingDirectory : public AbstractDynamicDirectory { public: - GroupingDirectory(DBPrx db); + GroupingDirectory(DBPtr db); protected: virtual T attribute(const MythFS::RecordedPtr &) const = 0; NetFS::NameList getContents() const override; - DBPrx db; + DBPtr db; }; } diff --git a/mythfs/service/main.cpp b/mythfs/service/main.cpp index 6aafc7a..c0e98ce 100644 --- a/mythfs/service/main.cpp +++ b/mythfs/service/main.cpp @@ -12,8 +12,7 @@ namespace MythFS { { auto dbpool = getConnectionPool(ic, "mysql", "MythFS"); adp->add(new MythFS::Service(), ic->stringToIdentity("Service")); - auto dbservice = DBPrx::uncheckedCast(adp->add(new DBImpl(dbpool), ic->stringToIdentity("DB"))); - adp->add(new RecordingsVolume(dbservice), ic->stringToIdentity("recordings")); + adp->add(new RecordingsVolume(new DBImpl(dbpool)), ic->stringToIdentity("recordings")); } }; diff --git a/mythfs/service/myth-db.ice b/mythfs/service/myth-db.ice index 8164297..fde24be 100644 --- a/mythfs/service/myth-db.ice +++ b/mythfs/service/myth-db.ice @@ -4,7 +4,7 @@ #include "myth-models.ice" module MythFS { - interface DB { + local interface DB { idempotent Recordeds getRecorded(); }; }; diff --git a/mythfs/service/myth-models.ice b/mythfs/service/myth-models.ice index b3fc853..a7bea8d 100644 --- a/mythfs/service/myth-models.ice +++ b/mythfs/service/myth-models.ice @@ -4,7 +4,7 @@ [["cpp:include:boost/date_time/posix_time/posix_time.hpp"]] module MythFS { - class Recorded { + local class Recorded { [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ] string startTime; [ "slicer:conversion:boost.posix_time.ptime:boost.posix_time.to_iso_extended_string:boost.posix_time.time_from_string:nodeclare" ] @@ -21,7 +21,7 @@ module MythFS { long fileSize; string basename; }; - sequence<Recorded> Recordeds; + local sequence<Recorded> Recordeds; }; #endif diff --git a/mythfs/service/recordingsVolume.cpp b/mythfs/service/recordingsVolume.cpp index a476829..3bdc5d2 100644 --- a/mythfs/service/recordingsVolume.cpp +++ b/mythfs/service/recordingsVolume.cpp @@ -10,7 +10,7 @@ #include <sys/statvfs.h> namespace MythFS { - RecordingsVolume::RecordingsVolume(DBPrx db) + RecordingsVolume::RecordingsVolume(DBPtr db) { contents.insert({ "all", new AllDirectory(db) }); contents.insert({ "by title", new ByTitleDirectory(db) }); diff --git a/mythfs/service/recordingsVolume.h b/mythfs/service/recordingsVolume.h index 6887301..c5b3fa8 100644 --- a/mythfs/service/recordingsVolume.h +++ b/mythfs/service/recordingsVolume.h @@ -9,7 +9,7 @@ namespace MythFS { class RecordingsVolume : public ::NetFS::Volume, public StaticDirectory { public: - RecordingsVolume(DBPrx); + RecordingsVolume(DBPtr); virtual NetFS::DirectoryPrx opendir(const NetFS::ReqEnv &, const std::string & path, const Ice::Current&) override; diff --git a/mythfs/unittests/mockDefs.cpp b/mythfs/unittests/mockDefs.cpp index ba233c3..d699f6e 100644 --- a/mythfs/unittests/mockDefs.cpp +++ b/mythfs/unittests/mockDefs.cpp @@ -1,5 +1,7 @@ #include "mockDefs.h" #include <definedDirs.h> +#include <Ice/ObjectAdapter.h> +#include <dbimpl.h> Service::Service() : MySQL::Mock("MythFS", { @@ -11,7 +13,8 @@ Service::Service() : } TestClient::TestClient() : - db(getProxy<MythFS::DBPrx>("DB")), + dbpool(getService()->getConnectionPool(getAdapter()->getCommunicator(), "mock", "MythFS")), + db(new MythFS::DBImpl(dbpool)), s(getProxy<NetFS::ServicePrx>("Service")) { } diff --git a/mythfs/unittests/mockDefs.h b/mythfs/unittests/mockDefs.h index b1975e9..f549e54 100644 --- a/mythfs/unittests/mockDefs.h +++ b/mythfs/unittests/mockDefs.h @@ -6,6 +6,7 @@ #include <dryice.h> #include <service.h> #include <myth-db.h> +#include <abstractDatabaseClient.h> class DLL_PUBLIC Service : MySQL::Mock, public IceTray::DryIce { public: @@ -16,7 +17,8 @@ class DLL_PUBLIC TestClient : public IceTray::DryIceClient { public: TestClient(); - MythFS::DBPrx db; + IceTray::DatabasePoolPtr dbpool; + MythFS::DBPtr db; NetFS::ServicePrx s; }; |