本文整理汇总了C++中ums_data::Machine_ptr类的典型用法代码示例。如果您正苦于以下问题:C++ Machine_ptr类的具体用法?C++ Machine_ptr怎么用?C++ Machine_ptr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Machine_ptr类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: localAccount
/**
* \brief Function to get a certain user account property
* \param machineId The machine identifier of machine on which the user have a account
* \param property The property name
* \return the user account login
*/
std::string
UserServer::getUserAccountProperty(const std::string& machineId, const std::string& property) {
init();
std::string userId = getData().getUserId();
UMS_Data::LocalAccount_ptr account = new UMS_Data::LocalAccount();
account->setMachineId(machineId);
account->setUserId(userId);
LocalAccountServer localAccount(account, *msessionServer);
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(machineId);
MachineServer machineServer(machine);
//To get the database number id of the machine
std::string numMachine = machineServer.getAttribut("where machineid='"+localAccount.getData()->getMachineId()+"'");
//To get the database number id of the user
std::string numUser = getAttribut("where userid='"+localAccount.getData()->getUserId()+"'");
std::string value;
if ((numMachine.size() > 0) && (numUser.size() > 0)) {
value = localAccount.getAttribut("where machine_nummachineid="+numMachine+" and users_numuserid="+numUser, property);
}
if(value.size()==0) {
delete account;
delete machine;
throw UMSVishnuException(ERRCODE_UNKNOWN_LOCAL_ACCOUNT, "You have not a local account on this machine");
}
delete account;
delete machine;
return value;
}
开发者ID:Ecapo,项目名称:vishnu,代码行数:41,代码来源:UserServer.cpp
示例2: sessionProxy
/**
* \brief getJobProgress: function gets the progression status of jobs
* \param sessionKey: The session key
* \param listOfProgress: The object containing jobs progression information
* \param options: The object containing the available options jobs for progression .
* \return int: an error code
*/
int
vishnu::getJobProgress(const std::string& sessionKey,
TMS_Data::ListProgression& listOfProgress,
const TMS_Data::ProgressOptions& options)
throw (UMSVishnuException, TMSVishnuException, UserException, SystemException) {
checkEmptyString(sessionKey, "The session key");
std::string machineId = options.getMachineId();
UMS_Data::ListMachines machines;
if (! machineId.empty() && machineId != ALL_KEYWORD) {
// Use the specified machine
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(machineId);
machines.getMachines().push_back(machine);
} else {
listMachinesWithUserLocalAccount(sessionKey, machines);
}
// Now perform the request
listOfProgress.setNbJobs(0);
for(int i=0; i< machines.getMachines().size(); i++) {
UMS_Data::Machine_ptr machine = machines.getMachines().get(i);
std::string serviceName = (boost::format("%1%@%2%") % SERVICES_TMS[GETJOBSPROGRESSION] % machine->getMachineId()).str();
SessionProxy sessionProxy(sessionKey);
QueryProxy<TMS_Data::ProgressOptions, TMS_Data::ListProgression>
query(options, sessionProxy, serviceName, machine->getMachineId());
TMS_Data::ListProgression* listProgression_ptr = NULL ;
try {
listProgression_ptr = query.list();
} catch(...) {
// Means that the machine is not active or the user doesn't have a local account on it
if(machineId != ALL_KEYWORD) {
throw ;
} else {
continue ;
}
}
if (listProgression_ptr != NULL) {
TMS_Data::TMS_DataFactory_ptr ecoreFactory = TMS_Data::TMS_DataFactory::_instance();
for(unsigned int i = 0; i < listProgression_ptr->getProgress().size(); i++) {
TMS_Data::Progression_ptr progression = ecoreFactory->createProgression();
//To copy the content and not the pointer
*progression = *listProgression_ptr->getProgress().get(i);
listOfProgress.getProgress().push_back(progression);
}
listOfProgress.setNbJobs(listOfProgress.getNbJobs()+listProgression_ptr->getProgress().size());
delete listProgression_ptr;
}
}
return 0;
}
开发者ID:SysFera,项目名称:vishnu,代码行数:64,代码来源:api_tms.cpp
示例3: UMSVishnuException
/**
* \brief Gets standard output files of all completed jobs (applies only once for each job)
* \param sessionKey : The session key
* \param options: object containing options
* \param listOfResults : Is the list of jobs results
* \param options: Object containing options
* \return int : an error code
*/
int
vishnu::getCompletedJobsOutput(const std::string& sessionKey,
TMS_Data::ListJobResults& listOfResults,
const TMS_Data::JobOutputOptions& options)
throw (UMSVishnuException, TMSVishnuException, UserException, SystemException) {
checkEmptyString(sessionKey, "The session key");
std::string outputDir = options.getOutputDir();
if (! outputDir.empty() && ! boost::filesystem::exists(outputDir)) {
throw UMSVishnuException(ERRCODE_INVALID_PARAM, "The ouput directory does not exist: "+outputDir);
}
UMS_Data::ListMachines machines;
if (options.getMachineId().empty()) {
vishnu::listMachinesWithUserLocalAccount(sessionKey, machines);
} else {
UMS_Data::Machine_ptr machine = new UMS_Data::Machine(); // delete by EMF
machine->setMachineId(options.getMachineId());
machines.getMachines().push_back(machine);
}
int machineCount = machines.getMachines().size();
for (int index = 0; index < machineCount; ++index) {
SessionProxy sessionProxy(sessionKey);
JobOutputProxy jobOutputProxy(sessionProxy, machines.getMachines().get(index)->getMachineId());
TMS_Data::ListJobResults_ptr listJobResults_ptr = jobOutputProxy.getCompletedJobsOutput(options);
if (listJobResults_ptr != NULL) {
TMS_Data::TMS_DataFactory_ptr ecoreFactory = TMS_Data::TMS_DataFactory::_instance();
for(unsigned int i = 0; i < listJobResults_ptr->getResults().size(); i++) {
TMS_Data::JobResult_ptr jobResult = ecoreFactory->createJobResult();
//To copy the content and not the pointer
*jobResult = *listJobResults_ptr->getResults().get(i);
listOfResults.getResults().push_back(jobResult);
}
listOfResults.setNbJobs(listJobResults_ptr->getNbJobs());
delete listJobResults_ptr;
}
}
return 0;
}
开发者ID:SysFera,项目名称:vishnu,代码行数:51,代码来源:api_tms.cpp
示例4: list
/**
* \brief Function to list machines information
* \return The pointer to the UMS_Data::ListMachines containing machines information
* \return raises an exception on error
*/
UMS_Data::ListMachines* list(UMS_Data::ListMachineOptions_ptr option) {
std::string sqlListofMachines = boost::str(boost::format("SELECT machineid, address, status, description"
" FROM machine"
" WHERE machine.status != %1%") % vishnu::STATUS_DELETED);
std::vector<std::string>::iterator dbResultIter;
std::vector<std::string> dbResults;
UMS_Data::UMS_DataFactory_ptr ecoreFactory = UMS_Data::UMS_DataFactory::_instance();
mlistObject = ecoreFactory->createListMachines();
//Creation of the object user
UserServer userServer = UserServer(msessionServer);
userServer.init();
//if the user exists
if (userServer.exist()) {
//To process options
processOptions(userServer, option, sqlListofMachines);
boost::scoped_ptr<DatabaseResult> ListofMachines (mdatabase->getResult(sqlListofMachines.c_str()));
if (ListofMachines->getNbTuples() != 0){
for (size_t i = 0; i < ListofMachines->getNbTuples(); ++i) {
dbResults.clear();
dbResults = ListofMachines->get(i);
dbResultIter = dbResults.begin();
UMS_Data::Machine_ptr machine = ecoreFactory->createMachine();
machine->setMachineId(*dbResultIter);
machine->setAddress(*(++dbResultIter));
machine->setStatus(vishnu::convertToInt(*(++dbResultIter)));
machine->setDescription(*(++dbResultIter));
mlistObject->getMachines().push_back(machine);
}
}
} else {
UMSVishnuException e (ERRCODE_UNKNOWN_USER);
throw e;
}
return mlistObject;
}
开发者ID:SysFera,项目名称:vishnu,代码行数:45,代码来源:ListMachinesServer.hpp
示例5: UserException
/**
* \brief The cancelJob function cancels a job from its id
* \param session : The session information
* \param options : An object containing user-provided options
* \param infoMsg : The information message
* \return int : an error code
*/
int
vishnu::cancelJob(const std::string& sessionKey,
const TMS_Data::CancelOptions& options)
throw (UMSVishnuException, TMSVishnuException, UserException, SystemException) {
checkEmptyString(sessionKey, "The session key");
if (options.getJobId().empty() && options.getMachineId().empty() && options.getUser().empty()) {
throw UserException(ERRCODE_INVALID_PARAM, "Neither job, machine, nor user target was specified");
}
int retCode = 0;
if (! options.getJobId().empty()) { // cancel a specific job
TMS_Data::Job job;
if (options.getMachineId().empty()) {
vishnu::getJobInfo(sessionKey, options.getJobId(), "", job);
} else {
job.setMachine(options.getMachineId());
}
retCode = JobProxy(sessionKey, job.getMachine()).cancelJob(options);
} else {
std::string machineId = options.getMachineId();
UMS_Data::ListMachines machines;
if (! machineId.empty() && machineId != ALL_KEYWORD) { // cancel job on the specified machine
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(machineId);
machines.getMachines().push_back(machine);
} else { // cancel job on all machines
listMachinesWithUserLocalAccount(sessionKey, machines);
}
// now perform the request
for (int i=0; i< machines.getMachines().size(); ++i) {
retCode += JobProxy(sessionKey, machines.getMachines().get(i)->getMachineId()).cancelJob(options);
}
}
return retCode;
}
开发者ID:SysFera,项目名称:vishnu,代码行数:44,代码来源:api_tms.cpp
示例6: list
/**
* \brief Function to list machines information
* \fn UMS_Data::ListMachines* list()
* \return The pointer to the UMS_Data::ListMachines containing machines information
* \return raises an exception on error
*/
UMS_Data::ListMachines* list() {
std::string sqlListofMachines = "SELECT machineid, name, site, status, lang, description from machine, description "
"where machine.nummachineid = description.machine_nummachineid";
std::vector<std::string>::iterator ii;
std::vector<std::string> results;
UMS_Data::UMS_DataFactory_ptr ecoreFactory = UMS_Data::UMS_DataFactory::_instance();
mlistObject = ecoreFactory->createListMachines();
//Creation of the object user
UserServer userServer = UserServer(msessionServer);
userServer.init();
//if the user exists
if (userServer.exist()) {
//To process options
processOptions(userServer, mparameters, sqlListofMachines);
boost::scoped_ptr<DatabaseResult> ListofMachines (mdatabaseVishnu->getResult(sqlListofMachines.c_str()));
if (ListofMachines->getNbTuples() != 0){
for (size_t i = 0; i < ListofMachines->getNbTuples(); ++i) {
results.clear();
results = ListofMachines->get(i);
ii = results.begin();
UMS_Data::Machine_ptr machine = ecoreFactory->createMachine();
machine->setMachineId(*ii);
machine->setName(*(++ii));
machine->setSite(*(++ii));
machine->setStatus(convertToInt(*(++ii)));
machine->setLanguage(*(++ii));
machine->setMachineDescription(*(++ii));
mlistObject->getMachines().push_back(machine);
}
}
} else {
UMSVishnuException e (ERRCODE_UNKNOWN_USER);
throw e;
}
return mlistObject;
}
开发者ID:Ecapo,项目名称:vishnu,代码行数:48,代码来源:ListMachinesServer.hpp
示例7: tailFile
/* Returns the n last lines of a file to the client application. */
int tailFile(diet_profile_t* profile) {
string localPath, localUser, userKey, tail, acLogin, machineName;
char* path, *user, *host,*sessionKey, *errMsg = NULL, *result = NULL, *optionsSerialized= NULL;
std::string finishError ="";
int mapperkey;
std::string cmd = "";
diet_string_get(diet_parameter(profile, 0), &sessionKey, NULL);
diet_string_get(diet_parameter(profile, 1), &path, NULL);
diet_string_get(diet_parameter(profile, 2), &user, NULL);
diet_paramstring_get(diet_parameter(profile, 3), &host, NULL);
diet_string_get(diet_parameter(profile, 4),&optionsSerialized, NULL);
localUser = user;
localPath = path;
SessionServer sessionServer (sessionKey);
try {
//MAPPER CREATION
Mapper *mapper = MapperRegistry::getInstance()->getMapper(FMSMAPPERNAME);
mapperkey = mapper->code("vishnu_tail");
mapper->code(std::string(host)+":"+std::string(path), mapperkey);
mapper->code(optionsSerialized, mapperkey);
cmd = mapper->finalize(mapperkey);
// check the sessionKey
sessionServer.check();
//
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(host);
MachineServer machineServer(machine);
// check the machine
machineServer.checkMachine();
// get the machineName
machineName = machineServer.getMachineName();
delete machine;
// get the acLogin
acLogin = UserServer(sessionServer).getUserAccountLogin(host);
FileFactory::setSSHServer(machineName);
boost::scoped_ptr<File> file (FileFactory::getFileServer(sessionServer,localPath, acLogin, userKey));
TailOfFileOptions_ptr options_ptr= NULL;
if(!vishnu::parseEmfObject(std::string(optionsSerialized), options_ptr )) {
throw SystemException(ERRCODE_INVDATA, "solve_Tail: TailOfFileOptions object is not well built");
}
tail = file->tail(*options_ptr);
result = strdup(tail.c_str());
//To register the command
sessionServer.finish(cmd, FMS, vishnu::CMDSUCCESS);
} catch (VishnuException& err) {
try {
sessionServer.finish(cmd, FMS, vishnu::CMDFAILED);
} catch (VishnuException& fe) {
finishError = fe.what();
finishError +="\n";
}
err.appendMsgComp(finishError);
result = strdup("");
errMsg = strdup(err.buildExceptionString().c_str());
}
if (errMsg==NULL){
errMsg = strdup("");
}
else {
result = strdup("");
}
diet_string_set(diet_parameter(profile, 5), result, DIET_VOLATILE);
diet_string_set(diet_parameter(profile, 6), errMsg, DIET_VOLATILE);
return 0;
}
开发者ID:Ecapo,项目名称:vishnu,代码行数:83,代码来源:tailSrv.cpp
示例8: solveChangeGroup
/* Returns the n first line of the file to the client application. */
int solveChangeGroup (diet_profile_t* profile) {
string localPath, localUser,userKey="", acLogin, machineName;
char* path, *user, *host,*sessionKey, *group, *errMsg = NULL;
std::string finishError ="";
int mapperkey;
std::string cmd = "";
diet_string_get(diet_parameter(profile, 0), &sessionKey, NULL);
diet_string_get(diet_parameter(profile, 1), &path, NULL);
diet_string_get(diet_parameter(profile, 2), &user, NULL);
diet_paramstring_get(diet_parameter(profile, 3), &host, NULL);
diet_string_get(diet_parameter(profile, 4), &group, NULL);
localUser = user;
localPath = path;
SessionServer sessionServer (sessionKey);
try {
//MAPPER CREATION
Mapper *mapper = MapperRegistry::getInstance()->getMapper(FMSMAPPERNAME);
mapperkey = mapper->code("vishnu_chgrp");
mapper->code(group, mapperkey);
mapper->code(std::string(host)+":"+std::string(path), mapperkey);
cmd = mapper->finalize(mapperkey);
// check the sessionKey
sessionServer.check();
//
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(host);
MachineServer machineServer(machine);
// check the machine
machineServer.checkMachine();
// get the machineName
machineName = machineServer.getMachineName();
delete machine;
// get the acLogin
acLogin = UserServer(sessionServer).getUserAccountLogin(host);
FileFactory::setSSHServer(machineName);
boost::scoped_ptr<File> file (FileFactory::getFileServer(sessionServer,localPath, acLogin, userKey));
file->chgrp(group);
//To register the command
sessionServer.finish(cmd, FMS, vishnu::CMDSUCCESS);
} catch (VishnuException& err) {
try {
sessionServer.finish(cmd, FMS, vishnu::CMDFAILED);
} catch (VishnuException& fe) {
finishError = fe.what();
finishError +="\n";
}
err.appendMsgComp(finishError);
errMsg = strdup(err.buildExceptionString().c_str());
}
if (errMsg==NULL) {
errMsg = strdup("");
}
diet_string_set(diet_parameter(profile, 5), errMsg, DIET_VOLATILE);
return 0;
}
开发者ID:Ecapo,项目名称:vishnu,代码行数:71,代码来源:chgrpSrv.cpp
示例9: solveChangeGroup
/* Returns the n first line of the file to the client application. */
int solveChangeGroup (diet_profile_t* profile) {
std::string localPath, userKey="", acLogin, machineName;
std::string path = "";
std::string host = "";
std::string sessionKey = "";
std::string group = "";
std::string cmd = "";
diet_string_get(profile, 0, sessionKey);
diet_string_get(profile, 1, path);
diet_string_get(profile, 2, host);
diet_string_get(profile, 3, group);
// reset the profile to handle result
diet_profile_reset(profile, 2);
localPath = path;
SessionServer sessionServer (sessionKey);
try {
int mapperkey;
//MAPPER CREATION
Mapper *mapper = MapperRegistry::getInstance()->getMapper(vishnu::FMSMAPPERNAME);
mapperkey = mapper->code("vishnu_chgrp");
mapper->code(group, mapperkey);
mapper->code(host + ":" + path, mapperkey);
cmd = mapper->finalize(mapperkey);
sessionServer.check();
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(host);
MachineServer machineServer(machine);
// check the machine
machineServer.checkMachine();
machineName = machineServer.getMachineName();
delete machine;
// get the acLogin
acLogin = UserServer(sessionServer).getUserAccountLogin(host);
FileFactory fileFactory;
fileFactory.setSSHServer(machineName);
boost::scoped_ptr<File> file (fileFactory.getFileServer(sessionServer,localPath, acLogin, userKey));
file->chgrp(group);
// set success result
diet_string_set(profile, 0, "success");
diet_string_set(profile, 1, "");
//To register the command
sessionServer.finish(cmd, vishnu::FMS, vishnu::CMDSUCCESS);
} catch (VishnuException& err) {
try {
sessionServer.finish(cmd, vishnu::FMS, vishnu::CMDFAILED);
} catch (VishnuException& fe) {
err.appendMsgComp(fe.what());
}
// set error result
diet_string_set(profile, 0, "error");
diet_string_set(profile, 1, err.what());
}
return 0;
}
开发者ID:keoo,项目名称:vishnu,代码行数:67,代码来源:internalApiFMS.cpp
示例10: solveTailFile
/* Returns the n last lines of a file to the client application. */
int solveTailFile(diet_profile_t* profile) {
std::string localPath;
std::string userKey;
std::string acLogin;
std::string machineName;
std::string path = "";
std::string host = "";
std::string sessionKey = "";
std::string optionsSerialized = "";
std::string cmd = "";
diet_string_get(profile, 0, sessionKey);
diet_string_get(profile, 1, path);
diet_string_get(profile, 2, host);
diet_string_get(profile, 3, optionsSerialized);
// reset the profile to handle result
diet_profile_reset(profile, 2);
localPath = path;
SessionServer sessionServer (sessionKey);
try {
sessionServer.check();
//MAPPER CREATION
int mapperkey;
Mapper *mapper = MapperRegistry::getInstance()->getMapper(vishnu::FMSMAPPERNAME);
mapperkey = mapper->code("vishnu_tail_of_file");
mapper->code(host + ":" + path, mapperkey);
mapper->code(optionsSerialized, mapperkey);
cmd = mapper->finalize(mapperkey);
// Check machine
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(host);
MachineServer machineServer(machine);
machineServer.checkMachine();
machineName = machineServer.getMachineName();
delete machine;
// get the acLogin
acLogin = UserServer(sessionServer).getUserAccountLogin(host);
FileFactory ff;
ff.setSSHServer(machineName);
boost::scoped_ptr<File> file (ff.getFileServer(sessionServer,localPath, acLogin, userKey));
FMS_Data::TailOfFileOptions_ptr options_ptr= NULL;
if(!vishnu::parseEmfObject(optionsSerialized, options_ptr )) {
throw SystemException(ERRCODE_INVDATA, "solve_Tail: TailOfFileOptions object is not well built");
}
// set success result
diet_string_set(profile, 1, file->tail(*options_ptr));
diet_string_set(profile, 0, "success");
delete options_ptr;
//To register the command
sessionServer.finish(cmd, vishnu::FMS, vishnu::CMDSUCCESS);
} catch (VishnuException& err) {
try {
sessionServer.finish(cmd, vishnu::FMS, vishnu::CMDFAILED);
} catch (VishnuException& fe) {
err.appendMsgComp(fe.what());
}
// set error result
diet_string_set(profile, 0, "error");
diet_string_set(profile, 1, err.what());
}
return 0;
}
开发者ID:keoo,项目名称:vishnu,代码行数:76,代码来源:internalApiFMS.cpp
示例11: sessionServer
/* The function returns all the information about a file:
* - The local owner
* - The local group
* - The local uid & gid
* - The creation, modification and acces time.
* - The file type.
*/
int
solveGetInfos(diet_profile_t* profile) {
std::string path = "";
std::string host = "";
std::string sessionKey = "";
std::string localPath, userKey, machineName;
std::string cmd = "";
std::string fileStatSerialized = "";
diet_string_get(profile, 0, sessionKey);
diet_string_get(profile, 1, path);
diet_string_get(profile, 2, host);
// reset the profile to handle result
diet_profile_reset(profile, 2);
localPath = path;
SessionServer sessionServer (sessionKey);
try {
int mapperkey;
//MAPPER CREATION
Mapper *mapper = MapperRegistry::getInstance()->getMapper(vishnu::FMSMAPPERNAME);
mapperkey = mapper->code("vishnu_stat");
mapper->code(host + ":" + path, mapperkey);
cmd = mapper->finalize(mapperkey);
// check the sessionKey
sessionServer.check();
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(host);
MachineServer machineServer(machine);
// check the machine
machineServer.checkMachine();
// get the machineName
machineName = machineServer.getMachineName();
delete machine;
std::string acLogin = UserServer(sessionServer).getUserAccountLogin(host);
FileFactory ff;
ff.setSSHServer(machineName);
boost::scoped_ptr<File> file (ff.getFileServer(sessionServer,localPath, acLogin, userKey));
boost::scoped_ptr<FMS_Data::FileStat> fileStat_ptr (new FMS_Data::FileStat());
if ( file->exists()) {
*fileStat_ptr=file->getFileStat();
::ecorecpp::serializer::serializer _ser;
fileStatSerialized = _ser.serialize_str(const_cast<FMS_Data::FileStat_ptr>(fileStat_ptr.get()));
} else {
throw FMSVishnuException(ERRCODE_RUNTIME_ERROR, static_cast<SSHFile*>(file.get())->getErrorMsg());
}
// set success result
diet_string_set(profile, 1, fileStatSerialized);
diet_string_set(profile, 0, "success");
//To register the command
sessionServer.finish(cmd, vishnu::FMS, vishnu::CMDSUCCESS);
} catch (VishnuException& err) {
try {
sessionServer.finish(cmd, vishnu::FMS, vishnu::CMDFAILED);
} catch (VishnuException& fe) {
err.appendMsgComp(fe.what());
}
// set error result
diet_string_set(profile, 0, "error");
diet_string_set(profile, 1, err.what());
}
return 0;
}
开发者ID:keoo,项目名称:vishnu,代码行数:84,代码来源:internalApiFMS.cpp
示例12: sessionServer
int
solveTransferRemoteFile(diet_profile_t* profile){
std::string srcPath = "";
std::string destUser = "";
std::string srcHost = "";
std::string sessionKey = "";
std::string destHost = "";
std::string destPath = "";
std::string optionsSerialized = "";
std::string srcUserKey = "";
std::string srcUserLogin = "";
std::string srcMachineName = "";
std::string errMsg = "";
std::string finishError = "";
std::string fileTransferSerialized = "";
std::string cmd = "";
diet_string_get(profile, 0, sessionKey);
diet_string_get(profile, 1, srcHost);
diet_string_get(profile, 2, srcPath);
diet_string_get(profile, 3, destHost);
diet_string_get(profile, 4, destPath);
diet_string_get(profile, 5, optionsSerialized);
// reset profile to handle result
diet_profile_reset(profile, 2);
SessionServer sessionServer (sessionKey);
try {
int mapperkey;
std::string destUserLogin(destUser);
std::string destMachineName(destHost);
SessionServer sessionServer (sessionKey);
// check the source machine
// and get the source machine if applied
if (destHost != "localhost"){
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(destHost);
MachineServer destMachineServer(machine);
destMachineServer.checkMachine();
destMachineName = destMachineServer.getMachineName();
delete machine;
} else {
destMachineName = destHost;
}
// get the source machine user login
if (destHost != "localhost"){
destUserLogin = UserServer(sessionServer).getUserAccountLogin(destHost);
} else {
destUserLogin = destUser;
}
//MAPPER CREATION
std::string destCpltPath = destPath;
if (destUser.empty()) {
destCpltPath = destHost + ":" + destPath;
}
Mapper *mapper = MapperRegistry::getInstance()->getMapper(vishnu::FMSMAPPERNAME);
if (transferMode == File::sync) {
if(transferType == File::copy) {
mapperkey = mapper->code("vishnu_cp");
}
if(transferType == File::move) {
mapperkey = mapper->code("vishnu_mv");
}
} else{
if (transferType == File::copy) {
mapperkey = mapper->code("vishnu_acp");
}
if (transferType == File::move) {
mapperkey = mapper->code("vishnu_amv");
}
}
mapper->code(srcHost + ":" + srcPath, mapperkey);
mapper->code(destCpltPath, mapperkey);
mapper->code(optionsSerialized, mapperkey);
cmd = mapper->finalize(mapperkey);
// check the sessionKey
sessionServer.check();
// get the source Vishnu machine
UMS_Data::Machine_ptr machine = new UMS_Data::Machine();
machine->setMachineId(srcHost);
MachineServer srcMachineServer(machine);
// check the source machine
if (srcHost != "localhost"){
srcMachineServer.checkMachine();
srcMachineName = srcMachineServer.getMachineName();
} else {
srcMachineName = srcHost;
}
//.........这里部分代码省略.........
开发者ID:absila,项目名称:vishnu,代码行数:101,代码来源:internalApiFMS.hpp
注:本文中的ums_data::Machine_ptr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论