updated the storage client to use the server's changed restore backup functions

This commit is contained in:
fgerlits 2006-11-09 18:35:19 +00:00
parent c1253836d4
commit e9ce767d07
1 changed files with 46 additions and 1 deletions

View File

@ -730,6 +730,12 @@ const std::string createBackupFaultStringParamName = "faultString";
const std::string restoreBackupOpenMethodName
= "locstor.restoreBackupOpen";
/*------------------------------------------------------------------------------
* The name of the 'close put' restore backup method on the storage server
*----------------------------------------------------------------------------*/
const std::string restoreBackupClosePutMethodName
= "locstor.restoreBackupClosePut";
/*------------------------------------------------------------------------------
* The name of the 'check' restore backup method on the storage server
*----------------------------------------------------------------------------*/
@ -752,6 +758,16 @@ const std::string restoreBackupSessionIdParamName = "sessid";
*----------------------------------------------------------------------------*/
const std::string restoreBackupFileNameParamName = "filename";
/*------------------------------------------------------------------------------
* The name of the URL parameter in the input or output structure
*----------------------------------------------------------------------------*/
const std::string restoreBackupUrlParamName = "url";
/*------------------------------------------------------------------------------
* The name of the PUT token parameter in the input or output structure
*----------------------------------------------------------------------------*/
const std::string restoreBackupPutTokenParamName = "token";
/*------------------------------------------------------------------------------
* The name of the token parameter in the input or output structure
*----------------------------------------------------------------------------*/
@ -2515,12 +2531,41 @@ WebStorageClient :: restoreBackupOpen(
execute(restoreBackupOpenMethodName, parameters, result);
checkStruct(restoreBackupOpenMethodName,
result,
restoreBackupUrlParamName,
XmlRpcValue::TypeString);
checkStruct(restoreBackupOpenMethodName,
result,
restoreBackupPutTokenParamName,
XmlRpcValue::TypeString);
std::string url = std::string(result[restoreBackupUrlParamName]);
std::string putToken = std::string(result[restoreBackupPutTokenParamName]);
try {
FileTools::copyFileToUrl(*path, url);
} catch (std::runtime_error &e) {
throw XmlRpcCommunicationException(e.what());
}
parameters.clear();
parameters[restoreBackupSessionIdParamName]
= sessionId->getId();
parameters[restoreBackupPutTokenParamName]
= putToken;
result.clear();
execute(restoreBackupClosePutMethodName, parameters, result);
checkStruct(restoreBackupClosePutMethodName,
result,
restoreBackupTokenParamName,
XmlRpcValue::TypeString);
Ptr<Glib::ustring>::Ref token(new Glib::ustring(
result[createBackupTokenParamName] ));
result[restoreBackupTokenParamName] ));
return token;
}