33 using namespace Data_Structure;
34 using namespace Generator;
47 admin->enableServer(appId,
false);
49 admin->stopServer(appId);
51 catch (IceGrid::ServerNotExistException& ex)
53 ARMARX_ERROR_S <<
"Unable to stop Application " << application->getName() <<
" because it is not existent";
55 catch (IceGrid::ServerStopException& ex)
57 ARMARX_ERROR_S <<
"Unable to stop Application " << application->getName() <<
" because the server does not react";
59 catch (IceGrid::NodeUnreachableException& ex)
61 ARMARX_ERROR_S <<
"Unable to stop Application " << application->getName() <<
" because the Server node is unreachable";
63 catch (IceGrid::DeploymentException& ex)
65 ARMARX_ERROR_S <<
"Unable to stop Application " << application->getName() <<
" because it is not deployed";
75 admin->enableServer(appId,
false);
77 admin->sendSignal(appId,
"9");
79 catch (IceGrid::ServerNotExistException& ex)
81 ARMARX_ERROR_S <<
"Unable to kill Application " << application->getName() <<
" because it is not existent";
83 catch (IceGrid::BadSignalException& ex)
85 ARMARX_ERROR_S <<
"Unable to kill Application " << application->getName() <<
" because the signal is not recognized by the Server";
87 catch (IceGrid::NodeUnreachableException& ex)
89 ARMARX_ERROR_S <<
"Unable to kill Application " << application->getName() <<
" because the Server node is unreachable";
91 catch (IceGrid::DeploymentException& ex)
93 ARMARX_ERROR_S <<
"Unable to kill Application " << application->getName() <<
" because it is not deployed";
99 std::vector<std::string> appNames = admin->getAllApplicationNames();
101 if (std::find(appNames.begin(), appNames.end(), application->getScenario()->getName()) != appNames.end())
105 IceGridXmlGenerator generator;
106 IceGrid::ApplicationDescriptor descriptor = admin->getApplicationInfo(application->getScenario()->getName()).descriptor;
107 IceGrid::ApplicationUpdateDescriptor appUpdate = generator.generateUpdateDescriptor(descriptor);
108 auto location = std::find_if(appUpdate.nodes.begin(), appUpdate.nodes.end(), [application](
const IceGrid::NodeUpdateDescriptor & d)
110 return d.name == application->getEffectiveNodeName();
112 if (location == appUpdate.nodes.end())
114 ARMARX_ERROR_S <<
"Error while removing an Application in an not exitend node";
118 if ((*location).serverInstances.size() == 1)
125 auto loc = std::find_if((*location).serverInstances.begin(), (*location).serverInstances.end(), [application](
const IceGrid::ServerInstanceDescriptor & d)
127 return d.parameterValues.at(
"component") == application->getName()
128 && d.parameterValues.at(
"componentId") == application->getInstanceName();
130 if (loc != (*location).serverInstances.end())
132 (*location).serverInstances.erase(loc);
134 ARMARX_INFO <<
"Removing application " << application->getName();
135 admin->updateApplication(appUpdate);
136 ARMARX_INFO <<
"Removed application " << application->getName();
139 catch (IceGrid::AccessDeniedException& ex)
141 ARMARX_ERROR_S <<
"Error while removing Application " << application->getName() <<
" another application has the accesss rights to the IceGridAdmin. (Please try again)";
143 catch (IceGrid::ApplicationNotExistException& ex)
145 ARMARX_ERROR_S <<
"ScenarioManager error: this should not happen";
152 std::vector<std::string> appNames = admin->getAllApplicationNames();
153 if (std::find(appNames.begin(), appNames.end(), scenario->getName()) != appNames.end())
157 ARMARX_INFO <<
"Removing scenario " << scenario->getName();
158 admin->removeApplication(scenario->getName());
159 ARMARX_INFO <<
"Removed scenario " << scenario->getName();
162 catch (IceGrid::AccessDeniedException& ex)
164 ARMARX_ERROR_S <<
"Error while deploying Scenario " << scenario->getName() <<
" another application has the accesss rights to the IceGridAdmin. (Please try again)";
166 catch (IceGrid::DeploymentException& ex)
168 ARMARX_ERROR_S <<
"Error while deploying Scenario" << scenario->getName();
170 catch (IceGrid::ApplicationNotExistException& ex)
172 ARMARX_ERROR_S <<
"ScenarioManager error: this should not happen";