27 #include "../parser/XMLScenarioParser.h"
31 #include <Ice/Properties.h>
38 : name(name), creationTime(creationTime),
39 lastChangedTime(lastChangedTime),
40 globalConfigName(globalConfigName),
42 deploymentType(deploymentType),
45 globalConfig(new
armarx::PropertyDefinitionContainer(name)),
46 iceEnviromentVariables(iceEnvVariables)
51 nodeName =
"NodeMain";
52 globalConfig->setProperties(cfgProperties);
53 globalConfig->setPrefix(
"");
54 globalConfig->setDescription(
"Global Config from Scenario " + name);
69 return this->creationTime;
74 return this->lastChangedTime;
79 return globalConfigName;
89 std::string scenarioPath = package.lock()->getScenarioPath();
91 if (subfolder.empty())
93 scenarioPath.append(
"/").append(name).append(
"/").append(name).append(
".scx");
97 scenarioPath.append(
"/").append(subfolder).append(
"/").append(name).append(
"/").append(name).append(
".scx");
105 std::string scenarioPath = package.lock()->getScenarioPath();
107 scenarioPath.append(
"/").append(name);
115 ofs.open(getPath().c_str(), std::ofstream::out | std::ofstream::app);
116 ARMARX_DEBUG << getPath() <<
" is writeable: " << ofs.is_open();
118 return ofs.is_open();
121 if ((
s.permissions() & std::filesystem::perms::owner_write) != std::filesystem::perms::none)
130 return package.lock();
136 for (
auto app : *applications)
138 if (!app->getEnabled())
198 this->lastChangedTime = time;
203 globalConfigName = name;
213 for (
auto app : *applications)
215 if (app->getName() == name)
226 applications->push_back(application);
231 for (
auto iter = applications->begin(); iter != applications->end(); ++iter)
233 if (*iter == application)
235 (*iter)->deleteConfig();
236 applications->erase(iter);
257 parser.saveScenario(shared_from_this());
267 if (!std::filesystem::is_symlink(getGlobalConfigPath()))
269 ARMARX_WARNING <<
"Make local called on non-linked global scenario config";
273 std::filesystem::remove(getGlobalConfigPath());
276 this->reloadGlobalConf();
281 return std::filesystem::is_symlink(getGlobalConfigPath());
286 for (
auto it : *applications)
294 if (isGlobalConfigFileexistent())
296 globalConfig->getProperties()->load(getGlobalConfigPath());
307 std::filesystem::path scenarioPath;
308 if (subfolder.empty())
310 scenarioPath = std::filesystem::path(package.lock()->getScenarioPath().append(
"/").append(name).append(
"/"));
314 scenarioPath = std::filesystem::path(package.lock()->getScenarioPath().append(
"/").append(subfolder +
"/").append(name).append(
"/"));
317 scenarioPath = scenarioPath / std::filesystem::path(globalConfigName.empty() ?
"./config/global.cfg" : globalConfigName);
318 return scenarioPath.string();
324 ofs.open(getGlobalConfigPath().c_str(), std::ofstream::out | std::ofstream::app);
325 ARMARX_DEBUG << getGlobalConfigPath() <<
" is writeable: " << ofs.is_open();
327 return ofs.is_open();
332 return std::filesystem::exists(std::filesystem::path(getGlobalConfigPath()));
337 for (
auto app : *applications)
339 if (app->getStatusWriteBlock())
349 for (
auto app : *applications)
351 app->setStatusWriteBlock(state);
357 return deploymentType;
362 deploymentType = type;
367 std::vector<std::string> result;
368 for (
auto app : *applications)
370 result.push_back(app->getEffectiveNodeName());
377 for (
auto app : *applications)
380 if (!app->getFound())
390 iceEnviromentVariables[name] = variable;
395 iceEnviromentVariables[name] =
"";
400 return iceEnviromentVariables;