SkillManagerComponentPluginUser.cpp
Go to the documentation of this file.
2
3#include <mutex>
4#include <optional>
5#include <string>
6#include <vector>
7
8#include <boost/uuid/uuid_io.hpp>
9
10#include <Ice/Exception.h>
11#include <Ice/OutputStream.h>
12#include <IceUtil/Exception.h>
13#include <IceUtil/Optional.h>
14
18#include <ArmarXCore/interface/core/time.h>
19
27#include <RobotAPI/interface/aron/Aron.h>
28#include <RobotAPI/interface/skills/SkillManagerInterface.h>
29#include <RobotAPI/libraries/skills/core/aron/FluxioProfile.aron.generated.h>
30#include <RobotAPI/libraries/skills/core/aron/FluxioSkill.aron.generated.h>
31
32namespace armarx
33{
38
39 void
40 SkillManagerComponentPluginUser::addProvider(const skills::manager::dto::ProviderInfo& info,
41 const Ice::Current&)
42 {
43 auto i = skills::ProviderInfo::FromIce(info);
44 this->plugin->addProvider(i);
45 std::string providerId = boost::uuids::to_string(
46 armarx::plugins::SkillManagerComponentPlugin::createUuidWithString(
47 info.providerId.providerName));
48 std::optional<std::vector<skills::manager::arondto::FluxioSkill>> opt =
50
51 if (!opt.has_value())
52 {
53 ARMARX_ERROR << "Failed to load composite skills for provider "
54 << info.providerId.providerName;
55 return;
56 }
57
58 for (const auto& skill : opt.value())
59 {
60 // TODO: Implement a proper way to load all skills from memory without breaking dependencies etc.
61 }
62 }
63
64 void
66 const skills::manager::dto::ProviderID& provider,
67 const Ice::Current&)
68 {
69 auto i = skills::ProviderID::FromIce(provider);
70 this->plugin->removeProvider(i);
71 }
72
73 skills::manager::dto::SkillStatusUpdate
75 const skills::manager::dto::SkillExecutionRequest& info,
76 const Ice::Current&)
77 {
79 return this->plugin->executeSkill(e).toManagerIce();
80 }
81
82 skills::manager::dto::SkillExecutionID
84 const skills::manager::dto::SkillExecutionRequest& info,
85 const Ice::Current& current)
86 {
88 return this->plugin->executeSkillAsync(e).toManagerIce();
89 }
90
91 skills::provider::dto::ParameterUpdateResult
93 const skills::manager::dto::SkillExecutionID& info,
94 const aron::data::dto::DictPtr& params,
95 const Ice::Current& current)
96 {
97 skills::provider::dto::ParameterUpdateResult ret;
100 ret.success = this->plugin->updateSkillParameters(e, a);
101 return ret;
102 }
103
104 skills::provider::dto::AbortSkillResult
105 SkillManagerComponentPluginUser::abortSkill(const skills::manager::dto::SkillExecutionID& id,
106 const Ice::Current& current)
107 {
108 skills::provider::dto::AbortSkillResult ret;
110 ret.success = this->plugin->abortSkill(i);
111 return ret;
112 }
113
114 skills::provider::dto::AbortSkillResult
116 const skills::manager::dto::SkillExecutionID& id,
117 const Ice::Current& /*unused*/)
118 {
119 skills::provider::dto::AbortSkillResult ret;
121 ret.success = this->plugin->abortSkillAsync(i);
122 return ret;
123 }
124
125 std::vector<skills::provider::dto::AbortSkillResult>
127 {
128 ARMARX_IMPORTANT << "Stopping all running executions.";
129
130 std::vector<skills::provider::dto::AbortSkillResult> results;
131
132 skills::manager::dto::SkillStatusUpdateMap executions;
133
134 // we ALWAYS want the newest information when stopping all!
135 // e.g. there is some new skill not known to the GUI which we explicitely want to stop too.
136 // the stop-all function is often used in an emergency, so we'll live with the extra call...
137 try
138 {
139 executions = this->getSkillExecutionStatuses(current);
140 }
141 catch (...) // if any error occurs, we use the snapshot as backup. better to miss a skill
142 // than to not do anything.
143 {
144 executions = this->getSkillExecutionStatuses(current);
145 }
146
147 for (auto& [executionId, status] : executions)
148 {
149 // select all running executions...
150 if (status.status != armarx::skills::core::dto::Execution::Aborted and
151 status.status != armarx::skills::core::dto::Execution::Failed)
152 {
153 // ... and kill them.
154 results.push_back(this->abortSkill(executionId, current));
155 }
156 }
157 return results;
158 }
159
160 std::vector<skills::provider::dto::AbortSkillResult>
162 {
163 ARMARX_IMPORTANT << "Stopping all running executions.";
164 std::vector<skills::provider::dto::AbortSkillResult> results;
165
166 skills::manager::dto::SkillStatusUpdateMap executions;
167
168 // we ALWAYS want the newest information when stopping all!
169 // e.g. there is some new skill not known to the GUI which we explicitely want to stop too.
170 // the stop-all function is often used in an emergency, so we'll live with the extra call...
171 try
172 {
173 executions = this->getSkillExecutionStatuses(current);
174 }
175 catch (...) // if any error occurs, we use the snapshot as backup. better to miss a skill
176 // than to not do anything.
177 {
178 executions = this->getSkillExecutionStatuses(current);
179 }
180
181 for (auto& [executionId, status] : executions)
182 {
183 // select all running executions...
184 if (status.status != armarx::skills::core::dto::Execution::Aborted and
185 status.status != armarx::skills::core::dto::Execution::Failed)
186 {
187 // ... and kill them.
188 results.push_back(this->abortSkillAsync(executionId, current));
189 }
190 }
191 return results;
192 }
193
194 void
196 const skills::provider::dto::SkillStatusUpdate& statusUpdate,
197 const skills::callback::dto::ProviderID& pid,
198 const Ice::Current&)
199 {
200 (void)statusUpdate;
201 (void)pid;
202 // If you want to use the status, implement this method!
203 }
204
205 skills::manager::dto::SkillDescriptionMap
207 {
208 skills::manager::dto::SkillDescriptionMap ret;
209
210 auto m = this->plugin->getSkillDescriptions();
211
212 for (const auto& [k, v] : m)
213 {
214 ret.insert({k.toManagerIce(), v.toManagerIce()});
215 }
216
217 return ret;
218 }
219
220 IceUtil::Optional<skills::manager::dto::SkillDescription>
221 SkillManagerComponentPluginUser::getSkillDescription(const skills::manager::dto::SkillID& id,
222 const Ice::Current& current)
223 {
224 auto e = skills::SkillID::FromIce(id);
225 auto o = this->plugin->getSkillDescription(e);
226 if (o.has_value())
227 {
228 return o->toManagerIce();
229 }
230 return {};
231 }
232
233 IceUtil::Optional<skills::manager::dto::SkillStatusUpdate>
235 const skills::manager::dto::SkillExecutionID& executionId,
236 const Ice::Current& current)
237 {
238 auto e = skills::SkillExecutionID::FromIce(executionId);
239 auto o = this->plugin->getSkillExecutionStatus(e);
240 if (o.has_value())
241 {
242 return o->toManagerIce();
243 }
244 return {};
245 }
246
247 skills::manager::dto::SkillStatusUpdateMap
249 {
250 skills::manager::dto::SkillStatusUpdateMap ret;
251
252 auto m = this->plugin->getSkillExecutionStatuses();
253
254 for (const auto& [k, v] : m)
255 {
256 ret.insert({k.toManagerIce(), v.toManagerIce()});
257 }
258
259 return ret;
260 }
261
262 //****************************//
263 //** Fluxio related methods **//
264 //****************************//
265
266 aron::type::dto::AronObjectPtr
267 SkillManagerComponentPluginUser::getTypes(const Ice::Current& current)
268 {
269 const auto& res = this->plugin->getTypes();
270 return res->toAronObjectDTO();
271 }
272
273 IceUtil::Optional<std::string>
275 const std::string& profileId,
276 const Ice::Current& current)
277 {
278 const auto& res = this->plugin->executeFluxioSkill(skillId, profileId, "Fluxio");
279 if (!res.isSuccess())
280 {
281 auto e = res.getError();
282 e.addToContext(std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
283 throw e.toManagerIce();
284 }
285 if (res.getResult() == nullptr)
286 {
287 auto e = res.getError();
288 e.addToContext(std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
289 throw e.toManagerIce();
290 }
291
292 return res.getResult()->id;
293 }
294
295 void
297 const Ice::Current& current)
298 {
299 this->plugin->abortFluxioSkill(executionId);
300 }
301
302 IceUtil::Optional<skills::manager::dto::FluxioSkillStatusUpdateList>
304 const Ice::Current& current)
305 {
306 auto l = this->plugin->getFluxioSkillExecutionStatus(executionId);
307 if (!l.isSuccess())
308 {
309 ARMARX_WARNING << "Error getting FluxioSkillExecutionStatus";
310
311 auto e = l.getError();
312 e.addToContext(std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
313 throw e.toManagerIce();
314 }
315
316 skills::manager::dto::FluxioSkillStatusUpdateList ret;
317
318 for (const auto& s : l.getResult())
319 {
320 ret.push_back(s.toManagerIce());
321 }
322
323 return ret;
324 }
325
326 skills::manager::dto::FluxioSkillList
328 {
329 skills::manager::dto::FluxioSkillList ret;
330
331 auto l = this->plugin->getSkillList();
332
333 if (!l.isSuccess())
334 {
335 auto e = l.getError();
336 e.addToContext(std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
337 throw e.toManagerIce();
338 }
339
340 for (const auto& s : l.getResult())
341 {
342 if (s == nullptr)
343 {
344 ARMARX_WARNING << "Unexpected nullptr!";
345 continue;
346 }
347
348 const auto& skill = s->toManagerIce();
349
350 if (!skill.has_value())
351 {
352 ARMARX_WARNING << "Skill with id " << s->id << " could not be converted";
353 continue;
354 }
355
356 ret.push_back(skill.value());
357 }
358
359 return ret;
360 }
361
362 IceUtil::Optional<skills::manager::dto::FluxioSkill>
363 SkillManagerComponentPluginUser::getSkill(const std::string& id, const Ice::Current& current)
364 {
365 auto result = this->plugin->getSkill(id);
366
367 if (!result.isSuccess())
368 {
369 auto e = result.getError();
370 e.addToContext(std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
371 throw e.toManagerIce();
372 }
373 const auto& skill = result.getResult();
374 if (skill == nullptr)
375 {
376 return {};
377 }
378
379 const auto& s = skill->toManagerIce();
380
381 if (!s.has_value())
382 {
383 return {};
384 }
385
386 return s.value();
387 }
388
389 bool
391 const skills::manager::dto::FluxioSkill& skill,
392 const Ice::Current& current)
393 {
394 std::scoped_lock l(this->plugin->fluxioDC.skillsMutex,
395 this->plugin->fluxioDC.profilesMutex,
396 this->plugin->fluxioDC.providersMutex,
397 this->plugin->fluxioDC.typesMutex);
398 auto& skillsMap = this->plugin->fluxioDC.skills;
399 auto& providersMap = this->plugin->fluxioDC.providers;
400 auto& profilesMap = this->plugin->fluxioDC.profiles;
401 auto& typesMap = this->plugin->fluxioDC.types;
402 const auto& s = skillsMap.find(skill.id);
403
404 // Check if the skill exists
405 if (s == skillsMap.end())
406 {
407 ARMARX_WARNING << "Skill with id " << skill.id << " not found";
408 return false;
409 }
410
411 // Check if the user has the mutex for the skill
412 auto res = this->plugin->getSkillMutex(skill.id, userId);
413 if (!res.isSuccess())
414 {
415 ARMARX_WARNING << "User " << userId << "User does not have Mutex for this Skill"
416 << skill.id;
417
418 auto error = res.getError();
419 error.addToContext(skills::error::createErrorMessage(
421 "SkillManagerComponentPluginUser",
422 __FUNCTION__,
423 __LINE__);
424 throw error.toManagerIce();
425 }
426
427 const bool ret =
428 s->second.updateFromIce(skill, providersMap, profilesMap, skillsMap, typesMap);
429
430 std::optional<skills::manager::arondto::FluxioSkill> opt = s->second.toAronXml();
431
432 if (!opt.has_value())
433 {
434 ARMARX_WARNING << "Skill with id " << skill.id << " could not be converted";
435 return false;
436 }
437
438 saveSkill(opt.value());
439
440 return ret;
441 }
442
443 bool
445 const std::string& userId,
446 const std::string& skillId,
447 const skills::manager::dto::FluxioParameterList& parameters,
448 const Ice::Current& current)
449 {
450 // updateSkillParameterValues for all params
451 for (const auto& param : parameters)
452 {
453 const auto& res =
454 this->updateSkillParameterValues(userId, skillId, param.id, param.values, current);
455 if (!res)
456 {
457 ARMARX_WARNING << "Parameter value of param " << param.id << " and skill "
458 << skillId << " could not be converted";
459 return false;
460 }
461 }
462
463
464 return true;
465 }
466
467 bool
469 const std::string& userId,
470 const std::string& skillId,
471 const std::string& parameterId,
472 const skills::manager::dto::FluxioValueList& values,
473 const Ice::Current& current)
474 {
475 std::scoped_lock l(this->plugin->fluxioDC.skillsMutex,
476 this->plugin->fluxioDC.profilesMutex);
477 auto& skillsMap = this->plugin->fluxioDC.skills;
478 auto& profilesMap = this->plugin->fluxioDC.profiles;
479
480 // check if skill exists
481 const auto& skill = skillsMap.find(skillId);
482
483 if (skill == skillsMap.end())
484 {
485 ARMARX_WARNING << "Skill with id " << skillId << " not found";
486 return false;
487 }
488
489 // Check if the user has the mutex for the skill
490 auto res = this->plugin->getSkillMutex(skillId, userId);
491 if (!res.isSuccess())
492 {
493 ARMARX_WARNING << "User " << userId << "User does not have Mutex for this Skill"
494 << skillId;
495
496 auto error = res.getError();
497 error.addToContext(skills::error::createErrorMessage(
499 "SkillManagerComponentPluginUser",
500 __FUNCTION__,
501 __LINE__);
502 throw error.toManagerIce();
503 }
504
505 // check if parameter exists in skill
506 const auto& p = skill->second.parameters.find(parameterId);
507 if (p == skill->second.parameters.end())
508 {
509 ARMARX_WARNING << "Parameter with id " << parameterId << " not found in skill with id "
510 << skillId;
511 return false;
512 }
513
514 // update values of parameter
515 p->second.updateValuesFromIce(values, profilesMap);
516 return true;
517 }
518
519 IceUtil::Optional<skills::manager::dto::FluxioIdentificatorList>
521 const std::string& userId,
522 const bool dryRun,
523 const Ice::Current& current)
524 {
525 skills::manager::dto::FluxioIdentificatorList ret;
528 res = this->plugin->getSkill(skillId);
529 if (!res.isSuccess())
530 {
531 ARMARX_WARNING << "Error getting skill with id " << skillId;
532 return {};
533 }
535 res.getResult();
536 std::optional<skills::manager::arondto::FluxioSkill> opt = skillptr->toAronXml();
537 if (!opt.has_value())
538 {
539 ARMARX_WARNING << "Skill with id " << skillId << " could not be converted";
540 return {};
541 }
542 skills::manager::arondto::FluxioSkill skill = opt.value();
543
544 auto l = this->plugin->deleteSkill(skillId, userId, dryRun);
545
546 if (!l.has_value())
547 {
548 return {};
549 }
550
551 for (const auto& s : l.value())
552 {
553 if (s == nullptr)
554 {
555 ARMARX_WARNING << "Unexpected nullptr!";
556 continue;
557 }
558 ret.push_back(s->toFluxioIdentificatorIce());
559 }
560
561 if (!dryRun)
562 {
563 skill.deleted = true;
564 saveSkill(skill);
565 }
566
567 return ret;
568 }
569
570 bool
572 const std::string& userId,
573 const Ice::Current& current)
574 {
575 return this->plugin->getSkillMutex(skillId, userId).getResult();
576 }
577
578 void
580 const std::string& userId,
581 const Ice::Current& current)
582 {
583 this->plugin->deleteSkillMutex(skillId, userId);
584 }
585
586 IceUtil::Optional<skills::manager::dto::FluxioIdentificatorList>
588 const std::string& parameterId,
589 const std::string& userId,
590 bool dryRun,
591 const Ice::Current& current)
592 {
593 skills::manager::dto::FluxioIdentificatorList ret;
594 auto res = this->plugin->deleteSkillParameter(skillId, parameterId, userId, dryRun);
595
596 if (!res.isSuccess())
597 {
598 throw res.getError().toManagerIce();
599 }
600
601 for (const auto& s : res.getResult())
602 {
603 if (s == nullptr)
604 {
605 ARMARX_WARNING << "Unexpected nullptr!";
606 continue;
607 }
608 ret.push_back(s->toFluxioIdentificatorIce());
609 }
610
611 return ret;
612 }
613
614 IceUtil::Optional<skills::manager::dto::FluxioIdentificatorList>
616 const std::string& skillId,
617 const skills::manager::dto::FluxioParameter& parameter,
618 const std::string& userId,
619 bool dryRun,
620 const Ice::Current& current)
621 {
622 skills::manager::dto::FluxioIdentificatorList ret;
623 auto res = this->plugin->updateSkillParameter(skillId, parameter, userId, dryRun);
624
625 if (!res.isSuccess())
626 {
627 throw res.getError().toManagerIce();
628 }
629
630 for (const auto& s : res.getResult())
631 {
632 if (s == nullptr)
633 {
634 ARMARX_WARNING << "Unexpected nullptr!";
635 continue;
636 }
637 ret.push_back(s->toFluxioIdentificatorIce());
638 }
639
640 return ret;
641 }
642
643 skills::manager::dto::FluxioProfileList
645 {
646 skills::manager::dto::FluxioProfileList ret;
647
648 auto l = this->plugin->getProfileList();
649
650 for (const auto& p : l.getResult())
651 {
652 if (p == nullptr)
653 {
654 ARMARX_WARNING << "Unexpected nullptr!";
655 continue;
656 }
657 ret.push_back(p->toManagerIce());
658 }
659
660 return ret;
661 }
662
663 IceUtil::Optional<skills::manager::dto::FluxioProfile>
664 SkillManagerComponentPluginUser::getProfile(const std::string& id, const Ice::Current& current)
665 {
666 auto profile = this->plugin->getProfile(id);
667
668 if (!profile.isSuccess())
669 {
670 auto e = profile.getError();
671 e.addToContext(std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
672 throw e.toManagerIce();
673 }
674 return profile.getResult().toManagerIce();
675 }
676
677 skills::manager::dto::FluxioProfile
679 const skills::manager::dto::FluxioProfile& profile,
680 const Ice::Current& current)
681 {
682 std::unique_lock l(this->plugin->fluxioDC.profilesMutex);
683 auto& profilesMap = this->plugin->fluxioDC.profiles;
684
685 const auto& converted = skills::FluxioProfile::FromIce(profile, profilesMap);
686 l.unlock();
687
688 armarx::skills::FluxioProfile ret = this->plugin->createProfile(converted).getResult();
689
691
692 return ret.toManagerIce();
693 }
694
695 void
697 const skills::manager::dto::FluxioProfile& profile,
698 const Ice::Current& current)
699 {
700 std::unique_lock l(this->plugin->fluxioDC.profilesMutex);
701 auto& profilesMap = this->plugin->fluxioDC.profiles;
702 l.unlock();
703
704 this->plugin->updateProfile(skills::FluxioProfile::FromIce(profile, profilesMap));
705 }
706
707 skills::manager::dto::FluxioProviderList
709 {
710 skills::manager::dto::FluxioProviderList ret;
711
712 auto l = this->plugin->getProviderList();
713 if (!l.isSuccess())
714 {
715 auto e = l.getError();
716 e.addToContext(std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
717 throw e.toManagerIce();
718 }
719
720 for (const auto& p : l.getResult())
721 {
722 if (p == nullptr)
723 {
724 ARMARX_WARNING << "Unexpected nullptr!";
725 continue;
726 }
727 ret.push_back(p->toManagerIce());
728 }
729
730 return ret;
731 }
732
733 IceUtil::Optional<skills::manager::dto::FluxioProvider>
734 SkillManagerComponentPluginUser::getProvider(const std::string& id, const Ice::Current& current)
735 {
736 auto provider = this->plugin->getProvider(id);
737
738 if (provider.isSuccess())
739 {
740 auto e = provider.getError();
741 e.addToContext(std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
742 throw e.toManagerIce();
743 }
744 return provider.getResult().toManagerIce();
745 }
746
747 IceUtil::Optional<skills::manager::dto::FluxioSkillList>
749 const Ice::Current& current)
750 {
751 skills::manager::dto::FluxioSkillList ret;
752
753 auto l = this->plugin->getSkillsOfProvider(id);
754
755 if (!l.isSuccess())
756 {
757 auto error = l.getError();
758 error.addToContext(
759 std::nullopt, "SkillManagerComponentPluginUser", __FUNCTION__, __LINE__);
760 throw error.toManagerIce();
761 }
762
763 for (const auto& s : l.getResult())
764 {
765 if (s == nullptr)
766 {
767 ARMARX_WARNING << "Unexpected nullptr!";
768 continue;
769 }
770
771 const auto& skill = s->toManagerIce();
772
773 if (!skill.has_value())
774 {
776 << "SkillManagerComponentPluginUser::getSkillsOfProvider: Skill with id "
777 << s->id << " could not be converted";
778 continue;
779 }
780
781 ret.push_back(skill.value());
782 }
783
784 return ret;
785 }
786
787 IceUtil::Optional<skills::manager::dto::FluxioSkill>
789 const std::string& userId,
790 const std::string& providerId,
791 const skills::manager::dto::FluxioSkill& skill,
792 const Ice::Current& current)
793 {
794 std::unique_lock skillsLock(this->plugin->fluxioDC.skillsMutex, std::defer_lock);
795 std::unique_lock profilesLock(this->plugin->fluxioDC.profilesMutex, std::defer_lock);
796 std::unique_lock providersLock(this->plugin->fluxioDC.providersMutex, std::defer_lock);
797 std::unique_lock typesLock(this->plugin->fluxioDC.typesMutex, std::defer_lock);
798 std::lock(skillsLock, profilesLock, providersLock, typesLock);
799
800 auto& skillsMap = this->plugin->fluxioDC.skills;
801 auto& providersMap = this->plugin->fluxioDC.providers;
802 auto& profilesMap = this->plugin->fluxioDC.profiles;
803 auto& typesMap = this->plugin->fluxioDC.types;
804 auto skillBO =
805 skills::FluxioSkill::FromIce(skill, providersMap, profilesMap, skillsMap, typesMap);
806
807 if (skillBO == nullptr)
808 {
809 ARMARX_WARNING << "Skill with id " << skill.id << " could not be converted";
810
813 {skill.id}),
815 "SkillManagerComponentPluginUser",
816 __FUNCTION__,
817 __LINE__)
818 .toManagerIce();
819 }
820
821 skillsLock.unlock();
822 profilesLock.unlock();
823 providersLock.unlock();
824 typesLock.unlock();
825
826 auto& skillReleased = *skillBO.release();
827 const auto res =
828 this->plugin->addSkillToProvider(userId, providerId, std::move(skillReleased));
829 if (!res.isSuccess())
830 {
831 ARMARX_WARNING << "Skill with id " << skill.id
832 << " could not be added to provider with id " << providerId;
833
834 auto error = res.getError();
835 error.addToContext(
837 {skill.id, providerId})),
838 "SkillManagerComponentPluginUser",
839 __FUNCTION__,
840 __LINE__);
841 throw error.toManagerIce();
842 }
843
844 const auto& s = res.getResult();
845
846 if (s == nullptr)
847 {
848 ARMARX_WARNING << "Skill with id " << skill.id
849 << " could not be added to provider with id " << providerId;
850 return {};
851 }
852
853 const auto& ret = s->toManagerIce();
854 if (!ret.has_value())
855 {
856 ARMARX_WARNING << "Skill with id " << skill.id << " could not be converted";
857 return {};
858 }
859
860 const std::optional<skills::manager::arondto::FluxioSkill> aronSkill = s->toAronXml();
861
862 if (!aronSkill.has_value())
863 {
864 ARMARX_WARNING << "Skill with id " << skill.id << " could not be converted to Aron";
865 return {};
866 }
867
868 saveSkill(aronSkill.value());
869
870 return ret.value();
871 }
872
873 void
874 SkillManagerComponentPluginUser::saveSkill(const skills::manager::arondto::FluxioSkill& skill)
875 {
876 // Implemented in derived class
877 }
878
879 std::optional<std::vector<skills::manager::arondto::FluxioSkill>>
881 {
882 // Implemented in derived class
883 return {};
884 }
885
886 std::optional<std::vector<skills::manager::arondto::FluxioSkill>>
888 {
889 // Implemented in derived class
890 return {};
891 }
892
893 void
895 const skills::manager::arondto::FluxioProfile& profile)
896 {
897 // Implemented in derived class
898 }
899
900 std::optional<std::vector<skills::manager::arondto::FluxioProfile>>
902 {
903 // Implemented in derived class
904 return {};
905 }
906} // namespace armarx
PluginT * addPlugin(const std::string prefix="", ParamsT &&... params)
bool getSkillMutex(const std::string &skillId, const std::string &userId, const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioProvider > getProvider(const std::string &id, const Ice::Current &current) override
virtual std::optional< std::vector< skills::manager::arondto::FluxioSkill > > loadCompositeSkillsOfProvider(const std::string &providerId)
void removeProvider(const skills::manager::dto::ProviderID &provider, const Ice::Current &current) override
void updateProfile(const skills::manager::dto::FluxioProfile &profile, const Ice::Current &current) override
void addProvider(const skills::manager::dto::ProviderInfo &providerInfo, const Ice::Current &current) override
virtual void addProfile(const skills::manager::arondto::FluxioProfile &profile)
aron::type::dto::AronObjectPtr getTypes(const Ice::Current &current) override
skills::manager::dto::SkillStatusUpdateMap getSkillExecutionStatuses(const Ice::Current &current) override
skills::manager::dto::SkillExecutionID executeSkillAsync(const skills::manager::dto::SkillExecutionRequest &skillExecutionRequest, const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::SkillDescription > getSkillDescription(const skills::manager::dto::SkillID &id, const Ice::Current &current) override
virtual void saveSkill(const skills::manager::arondto::FluxioSkill &skill)
virtual std::optional< std::vector< skills::manager::arondto::FluxioSkill > > loadCompositeSkills()
bool updateSkillParameterValues(const std::string &userId, const std::string &skillId, const std::string &parameterId, const skills::manager::dto::FluxioValueList &values, const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioSkill > getSkill(const std::string &id, const Ice::Current &current) override
skills::manager::dto::FluxioProfileList getProfileList(const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioIdentificatorList > updateSkillParameter(const std::string &skillId, const skills::manager::dto::FluxioParameter &parameter, const std::string &userId, bool dryRun, const Ice::Current &current) override
bool updateSkillValues(const std::string &userId, const std::string &skillId, const skills::manager::dto::FluxioParameterList &parameters, const Ice::Current &current) override
IceUtil::Optional< std::string > executeFluxioSkill(const std::string &skillId, const std::string &profileId, const Ice::Current &current) override
void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate &update, const skills::callback::dto::ProviderID &id, const Ice::Current &current) override
skills::manager::dto::SkillDescriptionMap getSkillDescriptions(const Ice::Current &current) override
void deleteSkillMutex(const std::string &skillId, const std::string &userId, const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioIdentificatorList > deleteSkillParameter(const std::string &skillId, const std::string &parameterId, const std::string &userId, bool dryRun, const Ice::Current &current) override
skills::manager::dto::SkillStatusUpdate executeSkill(const skills::manager::dto::SkillExecutionRequest &info, const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioProfile > getProfile(const std::string &id, const Ice::Current &current) override
void abortFluxioSkill(const std::string &executionId, const Ice::Current &current) override
bool updateSkill(const std::string &userId, const skills::manager::dto::FluxioSkill &skill, const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::SkillStatusUpdate > getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID &executionId, const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioSkillStatusUpdateList > getFluxioSkillExecutionStatus(const std::string &executionId, const Ice::Current &current) override
skills::provider::dto::AbortSkillResult abortSkill(const skills::manager::dto::SkillExecutionID &id, const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioIdentificatorList > deleteSkill(const std::string &skillId, const std::string &userId, bool dryRun, const Ice::Current &current) override
skills::manager::dto::FluxioProfile createProfile(const skills::manager::dto::FluxioProfile &profile, const Ice::Current &current) override
skills::manager::dto::FluxioProviderList getProviderList(const Ice::Current &current) override
skills::provider::dto::AbortSkillResult abortSkillAsync(const skills::manager::dto::SkillExecutionID &id, const Ice::Current &current) override
std::vector< skills::provider::dto::AbortSkillResult > abortAllSkills(const Ice::Current &current) override
skills::provider::dto::ParameterUpdateResult updateSkillParameters(const skills::manager::dto::SkillExecutionID &executionId, const aron::data::dto::DictPtr &params, const Ice::Current &current) override
std::vector< skills::provider::dto::AbortSkillResult > abortAllSkillsAsync(const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioSkillList > getSkillsOfProvider(const std::string &id, const Ice::Current &current) override
virtual std::optional< std::vector< skills::manager::arondto::FluxioProfile > > loadProfiles()
skills::manager::dto::FluxioSkillList getSkillList(const Ice::Current &current) override
IceUtil::Optional< skills::manager::dto::FluxioSkill > addSkillToProvider(const std::string &userId, const std::string &providerId, const skills::manager::dto::FluxioSkill &skill, const Ice::Current &current) override
static PointerType FromAronDictDTO(const data::dto::DictPtr &aron)
Definition Dict.cpp:130
static ProviderID FromIce(const manager::dto::ProviderID &)
static ProviderInfo FromIce(const manager::dto::ProviderInfo &)
static SkillExecutionRequest FromIce(const manager::dto::SkillExecutionRequest &)
static SkillID FromIce(const manager::dto::SkillID &)
Definition SkillID.cpp:36
A base class for skill exceptions.
static FluxioException create(const std::string &message, const FluxioExceptionType &type, const std::string &className, const char *function, int line)
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
Definition Logging.h:190
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:193
::IceInternal::Handle< Dict > DictPtr
std::string createErrorMessage(ErrorCode code, const std::vector< std::string > &args)
This file offers overloads of toIce() and fromIce() functions for STL container types.
manager::dto::FluxioProfile toManagerIce() const
manager::arondto::FluxioProfile toManagerAron() const
static FluxioProfile FromIce(const manager::dto::FluxioProfile &i, std::map< std::string, FluxioProfile > &profilesMap)
static std::unique_ptr< FluxioSkill > FromIce(const manager::dto::FluxioSkill &i, std::map< std::string, FluxioProvider > &providersMap, std::map< std::string, FluxioProfile > &profilesMap, std::map< std::string, FluxioSkill > &skillsMap, std::map< std::string, aron::type::ObjectPtr > &typesMap)
static SkillExecutionID FromIce(const skills::manager::dto::SkillExecutionID &)