1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
9 #ifndef dbos_workdir_storage_File_hpp
10 #define dbos_workdir_storage_File_hpp
12 #include <anna/dbos/Object.hpp>
13 #include <anna/dbos/ObjectFacade.hpp>
14 #include <anna/dbos/Loader.hpp>
28 namespace filesystem {
38 class File : public dbos::Object, public dbos::ObjectFacade <File> {
40 const Directory* getParent() const throw() { return a_parent; }
41 const filesystem::File* getFilesystemFile() const throw() { return a_filesystemFile; }
42 int getINode() const throw() { return a_inode; }
44 std::string asString() const throw();
46 static void setup(dbos::Repository&, const int maxSize) throw(RuntimeException);
47 static File* instantiate(const filesystem::File*) throw(RuntimeException);
49 static const char* getStorageAreaName() throw() { return "storage::File"; }
50 static const dbos::Size getMaxSize() throw() { return st_maxSize; }
53 class Loader : public dbos::Loader {
55 Loader() : dbos::Loader() {;}
57 Loader& setKey(const filesystem::File* file) throw() {
58 a_filesystemFile = file;
62 const filesystem::File* getFile() const throw() { return a_filesystemFile; }
63 int getINode() const throw() { return a_inode; }
65 dbos::Index getIndex() const throw();
66 std::string asString() const throw();
69 const filesystem::File* a_filesystemFile;
72 // dbms::Statement is not required
73 dbms::Statement* initialize(dbms::Database&) throw(RuntimeException) { return NULL; }
74 bool load(dbms::Connection*, const dbos::StorageArea*) throw(RuntimeException);
78 const filesystem::File* a_filesystemFile;
81 static Loader* st_loader;
82 static ExclusiveHash <std::string> st_hash;
83 static int st_maxSize;
85 File() : a_parent(NULL) { ; }
88 void initialize(dbos::Loader& loader) throw(RuntimeException, dbms::DatabaseException);
89 void destroy() throw();
91 dbos_declare_object(File);