#include <PostgresqlBackup.h>
Inheritance diagram for LiveSupport::Scheduler::PostgresqlBackup:
This an implementation of the BackupInterface type. It stores the token used for the createBackupXxxx() functions in a PostgreSQL database.
This object has to be configured with a simple empty element, as the following:
<postgresqlBackup/>
The DTD for the above element is:
<!ELEMENT postgresqlBackup EMPTY >
Definition at line 89 of file PostgresqlBackup.h.
Public Member Functions | |
| PostgresqlBackup (Ptr< ConnectionManagerInterface >::Ref connectionManager, Ptr< StorageClientInterface >::Ref storage, Ptr< ScheduleInterface >::Ref schedule) throw () | |
| Construct a PostgresqlBackup. | |
| virtual | ~PostgresqlBackup (void) throw () |
| A virtual destructor, as this class has virtual functions. | |
| virtual void | configure (const xmlpp::Element &element) throw (std::invalid_argument, std::logic_error) |
| Configure the object based on the XML element supplied. | |
| virtual Ptr< Glib::ustring >::Ref | createBackupOpen (Ptr< SessionId >::Ref sessionId, Ptr< SearchCriteria >::Ref criteria, Ptr< ptime >::Ref fromTime, Ptr< ptime >::Ref toTime) throw (XmlRpcException) |
| Start to create a backup by calling the storage, and also adding a backup of the schedule. | |
| virtual AsyncState | createBackupCheck (const Glib::ustring &token, Ptr< const Glib::ustring >::Ref &url, Ptr< const Glib::ustring >::Ref &path, Ptr< const Glib::ustring >::Ref &errorMessage) throw (XmlRpcException) |
| Check the status of a storage backup. | |
| virtual void | createBackupClose (const Glib::ustring &token) throw (XmlRpcException) |
| Close the storage backup process. | |
| virtual void | restoreBackup (Ptr< SessionId >::Ref sessionId, Ptr< const Glib::ustring >::Ref path) throw (XmlRpcException) |
| Restore a schedule backup. | |
Static Public Member Functions | |
| static const std::string | getConfigElementName (void) throw () |
| Return the name of the XML element this object expects to be sent to a call to configure(). | |
| LiveSupport::Scheduler::PostgresqlBackup::PostgresqlBackup | ( | Ptr< ConnectionManagerInterface >::Ref | connectionManager, | |
| Ptr< StorageClientInterface >::Ref | storage, | |||
| Ptr< ScheduleInterface >::Ref | schedule | |||
| ) | throw () [inline] |
Construct a PostgresqlBackup.
| cm | the connection manager the PostgresqlBackup will use to connect to the database. |
Definition at line 171 of file PostgresqlBackup.h.
| virtual LiveSupport::Scheduler::PostgresqlBackup::~PostgresqlBackup | ( | void | ) | throw () [inline, virtual] |
A virtual destructor, as this class has virtual functions.
Definition at line 186 of file PostgresqlBackup.h.
| void PostgresqlBackup::configure | ( | const xmlpp::Element & | element | ) | throw (std::invalid_argument, std::logic_error) [virtual] |
Configure the object based on the XML element supplied.
The supplied element is expected to be of the name returned by configElementName().
| element | the XML element to configure the object from. |
| std::invalid_argument | if the supplied XML element contains bad configuraiton information | |
| std::logic_error | if the object has already been configured, and can not be reconfigured. |
Implements LiveSupport::Core::Configurable.
Definition at line 161 of file PostgresqlBackup.cxx.
| AsyncState PostgresqlBackup::createBackupCheck | ( | const Glib::ustring & | token, | |
| Ptr< const Glib::ustring >::Ref & | url, | |||
| Ptr< const Glib::ustring >::Ref & | path, | |||
| Ptr< const Glib::ustring >::Ref & | errorMessage | |||
| ) | throw (XmlRpcException) [virtual] |
Check the status of a storage backup.
| token | the identifier of this backup task. | |
| url | return parameter; if the status is “success”, it contains the URL of the created backup file. | |
| path | return parameter; if the status is “success”, it contains the local access path of the created backup file. | |
| errorMessage | return parameter; if the status is “fault”, it contains the fault string. |
| XmlRpcException | if there is a problem with the XML-RPC call. |
Implements LiveSupport::Scheduler::BackupInterface.
Definition at line 230 of file PostgresqlBackup.cxx.
References getBackupStmt, and updateBackupStmt.
| void PostgresqlBackup::createBackupClose | ( | const Glib::ustring & | token | ) | throw (XmlRpcException) [virtual] |
Close the storage backup process.
Frees up all resources allocated to the backup.
| token | the identifier of this backup task. |
| XmlRpcException | if there is a problem with the XML-RPC call. |
Implements LiveSupport::Scheduler::BackupInterface.
Definition at line 343 of file PostgresqlBackup.cxx.
References deleteBackupStmt.
| Ptr< Glib::ustring >::Ref PostgresqlBackup::createBackupOpen | ( | Ptr< SessionId >::Ref | sessionId, | |
| Ptr< SearchCriteria >::Ref | criteria, | |||
| Ptr< ptime >::Ref | fromTime, | |||
| Ptr< ptime >::Ref | toTime | |||
| ) | throw (XmlRpcException) [virtual] |
Start to create a backup by calling the storage, and also adding a backup of the schedule.
To check if the backup procedure is still pending, call createBackupCheck() regularly. Make sure to close the backup by calling createBackupClose().
| sessionId | a valid session ID to use for accessing the storage | |
| criteria | the criteria to use for backing up the storage | |
| fromTime | entries are included in the schedule export starting from this time. | |
| toTime | entries as included in the schedule export up to but not including this time. |
| XmlRpcException | on XML-RPC issues. |
Implements LiveSupport::Scheduler::BackupInterface.
Definition at line 179 of file PostgresqlBackup.cxx.
References storeBackupStmt.
| static const std::string LiveSupport::Scheduler::PostgresqlBackup::getConfigElementName | ( | void | ) | throw () [inline, static] |
Return the name of the XML element this object expects to be sent to a call to configure().
Definition at line 197 of file PostgresqlBackup.h.
Referenced by LiveSupport::Scheduler::BackupFactory::configure().
| void PostgresqlBackup::restoreBackup | ( | Ptr< SessionId >::Ref | sessionId, | |
| Ptr< const Glib::ustring >::Ref | path | |||
| ) | throw (XmlRpcException) [virtual] |
Restore a schedule backup.
All playlist IDs contained in the backup should already be in the storage. If this is a combined backup, with both storage and schedule components, then restore this backup to the storage first, and then call this function.
| sessionId | a valid session ID to identify the user. | |
| path | the location of the archive to upload. |
| XmlRpcException | if there is an error. |
Implements LiveSupport::Scheduler::BackupInterface.
Definition at line 401 of file PostgresqlBackup.cxx.
References scheduleExportFileName.