X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=example%2Fdbos%2Fworkdir%2Fstorage%2FDirectory.cpp;fp=example%2Fdbos%2Fworkdir%2Fstorage%2FDirectory.cpp;h=0000000000000000000000000000000000000000;hb=a3b95648bd76140ef55e0b5941d423eee6c3856f;hp=7c35dc6b097274916f3fe61ca4b35c72be9f886e;hpb=94fc4366adedbf26ca6ef3104f88d41fa85f5a72;p=anna.git diff --git a/example/dbos/workdir/storage/Directory.cpp b/example/dbos/workdir/storage/Directory.cpp deleted file mode 100644 index 7c35dc6..0000000 --- a/example/dbos/workdir/storage/Directory.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// ANNA - Anna is Not Nothingness Anymore // -// // -// (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo // -// // -// See project site at http://redmine.teslayout.com/projects/anna-suite // -// See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE // - - -#include -#include - -#include - -#include -#include - -#include - -#include "../filesystem/Directory.hpp" - -#include "Directory.hpp" - -using namespace std; -using namespace anna; -using namespace workdir; - -/*static*/ -storage::Directory::Loader* storage::Directory::st_loader = NULL; - -/*static*/ -ExclusiveHash storage::Directory::st_hash; - -/*static*/ -int storage::Directory::st_maxSize = 0; - -dbos_prepare_object (storage::Directory); - -void storage::Directory::setup (dbos::Repository& repository, const int maxSize) - throw (RuntimeException) -{ - st_loader = new Directory::Loader (); - st_maxSize = maxSize; - - Directory::setStorageArea ( - repository.createStorageArea ( // (1) - Directory::getStorageAreaId (), Directory::getStorageAreaName (), Directory::getMaxSize (), - Directory::allocator, 2 - ) - ); -} - -storage::Directory* storage::Directory::instantiate (const filesystem::Directory* directory) - throw (RuntimeException) -{ - if (st_loader == NULL) - throw RuntimeException ("storage::Directory::setup no ha sido invocado", ANNA_FILE_LOCATION); - - Directory* result = NULL; - - try { - Guard guard (st_loader, "storage::Directory::Loader"); - result = dbos::ObjectFacade ::instance (st_loader->setKey (directory)); - } - catch (dbms::DatabaseException& edb) { - throw RuntimeException (edb); - } - - return result; -} - -void storage::Directory::initialize (dbos::Loader& loader) - throw (RuntimeException, dbms::DatabaseException) -{ - Directory::Loader& dbLoader = static_cast (loader); - - a_filesystemDirectory = dbLoader.getDirectory (); - a_inode = dbLoader.getINode (); - - LOGINFORMATION ( - string msg ("storage::Directory::initialize | "); - msg += asString (); - Logger::information (msg, ANNA_FILE_LOCATION); - ); -} - -void storage::Directory::destroy () - throw () -{ - LOGINFORMATION ( - string msg ("storage::Directory::destroy | "); - msg += asString (); - Logger::information (msg, ANNA_FILE_LOCATION); - ); -} - -string storage::Directory::asString () const - throw () -{ - std::string result ("storage::Directory { Name: "); - result += a_filesystemDirectory->getPath (); - result += functions::asHexText (" | I-Node: ", a_inode); - return result += " }"; -} - -/* - * Transfiere la información del medio físico al primer nivel de C++. - * Posteriormente será interpretada en storage::Directory::initialize - */ -bool storage::Directory::Loader::load (dbms::Connection*, const dbos::StorageArea* ssaa) - throw (RuntimeException) -{ - a_inode = io::functions::getINode (a_filesystemDirectory->getPath ()); - return true; -} - -dbos::Index storage::Directory::Loader::getIndex () const - throw () -{ - return st_hash.calcule (a_filesystemDirectory->getPath ()); -} - -string storage::Directory::Loader::asString () const - throw () -{ - std::string result ("storage::Loader::Directory { Name: "); - result += a_filesystemDirectory->getPath (); - return result += " }"; -} -