summaryrefslogtreecommitdiffstats
path: root/src/modules/StorageBackendFile/StorageBackendFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/StorageBackendFile/StorageBackendFile.cpp')
-rw-r--r--src/modules/StorageBackendFile/StorageBackendFile.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/modules/StorageBackendFile/StorageBackendFile.cpp b/src/modules/StorageBackendFile/StorageBackendFile.cpp
index c8bc4f7..6a9242d 100644
--- a/src/modules/StorageBackendFile/StorageBackendFile.cpp
+++ b/src/modules/StorageBackendFile/StorageBackendFile.cpp
@@ -150,6 +150,28 @@ boost::shared_ptr<Common::XmlData> StorageBackendFile::load(const std::string &t
return boost::shared_ptr<Common::XmlData>(new Common::XmlData(path.file_string()));
}
+void StorageBackendFile::copy(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception) {
+ boost::lock_guard<boost::shared_mutex> lock(mutex);
+
+ if(!configured)
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
+
+ boost::filesystem::path path = getFileName(type, name);
+ boost::filesystem::path newPath = getFileName(type, newName);
+ boost::filesystem::copy_file(path, newPath);
+}
+
+void StorageBackendFile::rename(const std::string &type, const std::string &name, const std::string &newName) throw (Core::Exception) {
+ boost::lock_guard<boost::shared_mutex> lock(mutex);
+
+ if(!configured)
+ throw Core::Exception(Core::Exception::NOT_AVAILABLE);
+
+ boost::filesystem::path path = getFileName(type, name);
+ boost::filesystem::path newPath = getFileName(type, newName);
+ boost::filesystem::rename(path, newPath);
+}
+
void StorageBackendFile::remove(const std::string &type, const std::string &name) throw (Core::Exception) {
boost::lock_guard<boost::shared_mutex> lock(mutex);