tizen 2.3 release
[framework/web/wearable/wrt-security.git] / src / services / ace / logic / attribute_facade.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  *
18  * This file contains classes that implement WRT_INTERFACE.h interfaces,
19  * so that ACE could access  WRT specific and other information during
20  * the decision making.
21  *
22  * @file    attribute_.cpp
23  * @author  Jaroslaw Osmanski (j.osmanski@samsung.com)
24  * @author  Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
25  * @author  Ming Jin(ming79.jin@samsung.com)
26  * @version 1.0
27  * @brief   Implementation file for attributes obtaining.
28  */
29
30 #include <dpl/exception.h>
31 #include <sstream>
32 #include <algorithm>
33 #include <list>
34 #include <string>
35 #include <sstream>
36 #include <stdexcept>
37 #include <map>
38 #include <cstdlib>
39 #include <ace-dao-ro/AceDAOReadOnly.h>
40 #include <ace/WRT_INTERFACE.h>
41 #include <map>
42 #include <dpl/log/log.h>
43 #include <dpl/foreach.h>
44 #include <attribute_facade.h>
45 #include <ace/Request.h>
46 #include <simple_roaming_agent.h>
47
48 namespace // anonymous
49 {
50 typedef std::list<std::string> AttributeHandlerResponse;
51
52 typedef AttributeHandlerResponse (*AttributeHandler)(
53     const WidgetExecutionPhase &phase,
54     const WidgetHandle &widgetHandle);
55 typedef AttributeHandlerResponse (*ResourceAttributeHandler)(
56     const WidgetExecutionPhase &phase,
57     const WidgetHandle &widgetHandle,
58     const Request &request);
59
60 AttributeHandlerResponse AttributeClassHandler(const WidgetExecutionPhase & /*phase*/,
61         const WidgetHandle & /*widgetHandle*/)
62 {
63     AttributeHandlerResponse response;
64     response.push_back("widget");
65     return response;
66 }
67
68 AttributeHandlerResponse AttributeInstallUriHandler(
69         const WidgetExecutionPhase & /*phase*/,
70         const WidgetHandle &widgetHandle)
71 {
72     AttributeHandlerResponse response;
73     std::string value = AceDB::AceDAOReadOnly::getShareHref(widgetHandle);
74     if(!value.empty())
75         response.push_back(value);
76     return response;
77 }
78
79 AttributeHandlerResponse AttributeVersionHandler(const WidgetExecutionPhase & /*phase*/,
80         const WidgetHandle &widgetHandle)
81 {
82     AttributeHandlerResponse response;
83
84     std::string value = AceDB::AceDAOReadOnly::getVersion(widgetHandle);
85
86     if (!value.empty()) {
87         response.push_back(value);
88     }
89
90     return response;
91 }
92
93 AttributeHandlerResponse AttributeDistributorKeyCnHandler(
94         const WidgetExecutionPhase & /*phase*/,
95         const WidgetHandle &widgetHandle)
96 {
97     AttributeHandlerResponse response;
98     response = AceDB::AceDAOReadOnly::getKeyCommonNameList(widgetHandle,
99         AceDB::WidgetCertificateData::DISTRIBUTOR, AceDB::WidgetCertificateData::ENDENTITY);
100     return response;
101 }
102
103 AttributeHandlerResponse AttributeDistributorKeyFingerprintHandler(
104         const WidgetExecutionPhase & /*phase*/,
105         const WidgetHandle &widgetHandle)
106 {
107     AttributeHandlerResponse response;
108     response = AceDB::AceDAOReadOnly::getKeyFingerprints(widgetHandle,
109         AceDB::WidgetCertificateData::DISTRIBUTOR, AceDB::WidgetCertificateData::ENDENTITY);
110     return response;
111 }
112
113 AttributeHandlerResponse AttributeDistributorKeyRootCnHandler(
114         const WidgetExecutionPhase & /*phase*/,
115         const WidgetHandle &widgetHandle)
116 {
117     AttributeHandlerResponse response;
118     response = AceDB::AceDAOReadOnly::getKeyCommonNameList(widgetHandle,
119         AceDB::WidgetCertificateData::DISTRIBUTOR, AceDB::WidgetCertificateData::ROOT);
120     return response;
121 }
122
123 AttributeHandlerResponse AttributeDistributorKeyRootFingerprintHandler(
124         const WidgetExecutionPhase & /*phase*/,
125         const WidgetHandle &widgetHandle)
126 {
127     AttributeHandlerResponse response;
128     response = AceDB::AceDAOReadOnly::getKeyFingerprints(widgetHandle,
129         AceDB::WidgetCertificateData::DISTRIBUTOR, AceDB::WidgetCertificateData::ROOT);
130     return response;
131 }
132
133 AttributeHandlerResponse AttributeAuthorKeyCnHandler(
134         const WidgetExecutionPhase & /*phase*/,
135         const WidgetHandle &widgetHandle)
136 {
137     AttributeHandlerResponse response;
138     response = AceDB::AceDAOReadOnly::getKeyCommonNameList(widgetHandle,
139         AceDB::WidgetCertificateData::AUTHOR, AceDB::WidgetCertificateData::ENDENTITY);
140     return response;
141 }
142
143 AttributeHandlerResponse AttributeAuthorKeyFingerprintHandler(
144         const WidgetExecutionPhase & /*phase*/,
145         const WidgetHandle &widgetHandle)
146 {
147     AttributeHandlerResponse response;
148     response = AceDB::AceDAOReadOnly::getKeyFingerprints(widgetHandle,
149         AceDB::WidgetCertificateData::AUTHOR, AceDB::WidgetCertificateData::ENDENTITY);
150     return response;
151 }
152
153 AttributeHandlerResponse AttributeAuthorKeyRootCnHandler(
154         const WidgetExecutionPhase & /*phase*/,
155         const WidgetHandle &widgetHandle)
156 {
157     AttributeHandlerResponse response;
158     response = AceDB::AceDAOReadOnly::getKeyCommonNameList(widgetHandle,
159         AceDB::WidgetCertificateData::AUTHOR, AceDB::WidgetCertificateData::ROOT);
160     return response;
161 }
162
163 AttributeHandlerResponse AttributeAuthorKeyRootFingerprintHandler(
164         const WidgetExecutionPhase & /*phase*/,
165         const WidgetHandle &widgetHandle)
166 {
167     AttributeHandlerResponse response;
168     response = AceDB::AceDAOReadOnly::getKeyFingerprints(widgetHandle,
169         AceDB::WidgetCertificateData::AUTHOR, AceDB::WidgetCertificateData::ROOT);
170     return response;
171 }
172
173 AttributeHandlerResponse AttributeNetworkAccessUriHandler(
174         const WidgetExecutionPhase & /*phase*/,
175         const WidgetHandle & /*widgetHandle*/)
176 {
177     AttributeHandlerResponse response;
178     return response;
179 }
180
181 AttributeHandlerResponse AttributeIdHandler(const WidgetExecutionPhase & /*phase*/,
182         const WidgetHandle &widgetHandle)
183 {
184     AttributeHandlerResponse response;
185
186     std::string wGUID = AceDB::AceDAOReadOnly::getGUID(widgetHandle);
187
188     if (!wGUID.empty()) {
189         response.push_back(wGUID);
190     }
191     return response;
192 }
193
194 AttributeHandlerResponse AttributeAuthorNameHandler(
195         const WidgetExecutionPhase & /*phase*/,
196         const WidgetHandle &widgetHandle)
197 {
198     AttributeHandlerResponse response;
199
200     std::string value = AceDB::AceDAOReadOnly::getAuthorName(widgetHandle);
201
202     if (!value.empty()) {
203         response.push_back(value);
204     }
205
206     return response;
207 }
208
209 AttributeHandlerResponse AttributeRoamingHandler(
210         const WidgetExecutionPhase &phase,
211         const WidgetHandle & /*widgetHandle*/)
212 {
213     AttributeHandlerResponse response;
214
215     if (WidgetExecutionPhase_WidgetInstall == phase) {
216         // TODO undetermind value
217         response.push_back(std::string(""));
218     } else if (SimpleRoamingAgentSingleton::Instance().IsRoamingOn()) {
219         response.push_back(std::string("true"));
220     } else {
221         response.push_back(std::string("false"));
222     }
223
224     return response;
225 }
226
227 AttributeHandlerResponse AttributeBearerTypeHandler(
228         const WidgetExecutionPhase & /*phase*/,
229         const WidgetHandle & /*widgetHandle*/)
230 {
231     AttributeHandlerResponse response;
232
233     std::string bearerName = "undefined-bearer-name";
234
235     if (bearerName.empty()) {
236         LogWarning("Bearer-type is NOT SET or empty");
237     } else {
238         response.push_back(bearerName);
239     }
240
241     return response;
242 }
243
244 struct AttributeHandlerContext
245 {
246     std::string name;
247     WidgetExecutionPhase allowedPhaseMask;
248     AttributeHandler handler;
249 };
250
251 // Private masks
252 const WidgetExecutionPhase WidgetExecutionPhase_All =
253     static_cast<WidgetExecutionPhase>(
254         WidgetExecutionPhase_WidgetInstall |
255         WidgetExecutionPhase_WidgetInstantiate |
256         WidgetExecutionPhase_WebkitBind |
257         WidgetExecutionPhase_Invoke);
258 const WidgetExecutionPhase WidgetExecutionPhase_NoWidgetInstall =
259     static_cast<WidgetExecutionPhase>(
260         WidgetExecutionPhase_WidgetInstantiate |
261         WidgetExecutionPhase_WebkitBind |
262         WidgetExecutionPhase_Invoke);
263
264 #define ALL_PHASE(name, handler) \
265     { # name, WidgetExecutionPhase_All, handler },
266
267 #define NO_INSTALL(name, handler) \
268     { # name, WidgetExecutionPhase_NoWidgetInstall, handler },
269
270 AttributeHandlerContext HANDLED_ATTRIBUTES_LIST[] = {
271     ALL_PHASE(Class, &AttributeClassHandler)
272     ALL_PHASE(install-uri, &AttributeInstallUriHandler)
273     ALL_PHASE(version, &AttributeVersionHandler)
274     ALL_PHASE(distributor-key-cn, &AttributeDistributorKeyCnHandler)
275     ALL_PHASE(distributor-key-fingerprint,
276               &AttributeDistributorKeyFingerprintHandler)
277     ALL_PHASE(distributor-key-root-cn,
278               &AttributeDistributorKeyRootCnHandler)
279     ALL_PHASE(distributor-key-root-fingerprint,
280               &AttributeDistributorKeyRootFingerprintHandler)
281     ALL_PHASE(author-key-cn, &AttributeAuthorKeyCnHandler)
282     ALL_PHASE(author-key-fingerprint, &AttributeAuthorKeyFingerprintHandler)
283     ALL_PHASE(author-key-root-cn, &AttributeAuthorKeyRootCnHandler)
284     ALL_PHASE(author-key-root-fingerprint,
285               &AttributeAuthorKeyRootFingerprintHandler)
286     ALL_PHASE(network-access-uri, &AttributeNetworkAccessUriHandler)
287     ALL_PHASE(id, &AttributeIdHandler)
288 //    ALL_PHASE(name, &AttributeNameHandler)
289 //    ALL_PHASE(widget-attr:name, &AttributeWidgetAttrNameHandler)
290     ALL_PHASE(author-name, &AttributeAuthorNameHandler)
291     /* Enviroment  attributes*/
292 //    NO_INSTALL(roaming, &AttributeRoamingHandler)
293 //    NO_INSTALL(bearer-type, &AttributeBearerTypeHandler)
294 };
295
296 #undef ALL_PHASE
297 #undef NO_INSTALL
298
299 const size_t HANDLED_ATTRIBUTES_LIST_COUNT =
300     sizeof(HANDLED_ATTRIBUTES_LIST) / sizeof(HANDLED_ATTRIBUTES_LIST[0]);
301
302 template<class T>
303 class lambdaCollectionPusher
304 {
305   public:
306     std::list<T>& m_collection;
307     lambdaCollectionPusher(std::list<T>& collection) : m_collection(collection)
308     {
309     }
310     void operator()(const T& element) const
311     {
312         m_collection.push_back(element);
313     }
314 };
315
316 AttributeHandlerResponse AttributeDeviceCapHandler(const WidgetExecutionPhase & /*phase*/,
317         const WidgetHandle & /*widgetHandle*/,
318         const Request &request)
319 {
320     AttributeHandlerResponse response;
321
322     Request::DeviceCapabilitySet capSet = request.getDeviceCapabilitySet();
323     LogDebug("device caps set contains");
324     FOREACH(dc, capSet)
325     {
326         LogDebug("-> " << *dc);
327     }
328
329     std::for_each(
330         capSet.begin(),
331         capSet.end(),
332         lambdaCollectionPusher<std::string>(response));
333
334     return response;
335 }
336
337 //class lambdaFeatureEquality :
338 //    public std::binary_function<FeatureHandle, int, bool>
339 //{
340 //  public:
341 //    bool operator()(const FeatureHandle& wFeature,
342 //            const int& resurceId) const
343 //    {
344 //        return wFeature == resurceId;
345 //    }
346 //};
347 //
348 //class lambdaPushFeatureName :
349 //    public std::binary_function<WidgetFeature, AttributeHandlerResponse, void>
350 //{
351 //    void operator()(const WidgetFeature& wFeature,
352 //            AttributeHandlerResponse& response) const
353 //    {
354 //        response.push_back(DPL::ToUTF8String(wFeature.name));
355 //    }
356 //};
357
358 AttributeHandlerResponse AttributeApiFeatureHandler(
359         const WidgetExecutionPhase & /* phase */,
360         const WidgetHandle & /* widgetHandle */,
361         const Request & /* request */)
362 {
363     LogDebug("WAC 2.0 does not support api-feature and resource-id in policy.");
364     AttributeHandlerResponse response;
365     return response;
366 }
367
368 AttributeHandlerResponse AttributeFeatureInstallUriHandler(
369         const WidgetExecutionPhase & /* phase */,
370         const WidgetHandle & /* widgetHandle */,
371         const Request & /* request */)
372 {
373     LogDebug("WAC 2.0 does not support feature-install-uri is policy!");
374     AttributeHandlerResponse response;
375     return response;
376 }
377
378 AttributeHandlerResponse AttributeFeatureFeatureKeyCnHandler(
379         const WidgetExecutionPhase & /* phase */,
380         const WidgetHandle & /* widgetHandle */,
381         const Request & /* request */)
382 {
383     LogDebug("WAC 2.0 does not support feature-key-cn is policy!");
384     AttributeHandlerResponse response;
385     return response;
386 }
387
388 AttributeHandlerResponse AttributeFeatureKeyRootCnHandler(
389         const WidgetExecutionPhase & /* phase */,
390         const WidgetHandle & /* widgetHandle */,
391         const Request & /* request */)
392 {
393     LogDebug("WAC 2.0 does not support feature-key-root-cn is policy!");
394     AttributeHandlerResponse response;
395     return response;
396 }
397
398 AttributeHandlerResponse AttributeFeatureKeyRootFingerprintHandler(
399         const WidgetExecutionPhase & /* phase */,
400         const WidgetHandle & /* widgetHandle */,
401         const Request & /* request */)
402 {
403     LogDebug("WAC 2.0 does not support"
404         " feature-key-root-fingerprint is policy!");
405     AttributeHandlerResponse response;
406     return response;
407 }
408
409 struct ResourceAttributeHandlerContext
410 {
411     std::string name;
412     WidgetExecutionPhase allowedPhaseMask;
413     ResourceAttributeHandler handler;
414 };
415
416 #define ALL_PHASE(name, handler) \
417     { # name, WidgetExecutionPhase_All, handler },
418
419 ResourceAttributeHandlerContext HANDLED_RESOURCE_ATTRIBUTES_LIST[] = {
420     ALL_PHASE(device-cap, &AttributeDeviceCapHandler)
421     ALL_PHASE(api-feature, &AttributeApiFeatureHandler)
422     // For compatiblity with older policies we tread resource-id
423     // identically as api-feature
424     ALL_PHASE(resource-id, &AttributeApiFeatureHandler)
425
426     ALL_PHASE(feature-install-uri, &AttributeFeatureInstallUriHandler)
427     ALL_PHASE(feature-key-cn, &AttributeFeatureFeatureKeyCnHandler)
428     ALL_PHASE(feature-key-root-cn, &AttributeFeatureKeyRootCnHandler)
429     ALL_PHASE(feature-key-root-fingerprint,
430               &AttributeFeatureKeyRootFingerprintHandler)
431 };
432
433 #undef ALL_PHASE
434
435 const size_t HANDLED_RESOURCE_ATTRIBUTES_LIST_COUNT =
436     sizeof(HANDLED_RESOURCE_ATTRIBUTES_LIST) /
437     sizeof(HANDLED_RESOURCE_ATTRIBUTES_LIST[0]);
438 } // namespace anonymous
439
440 /*
441  * class WebRuntimeImpl
442  */
443 int WebRuntimeImpl::getAttributesValuesLoop(const Request &request,
444         std::list<ATTRIBUTE>* attributes,
445         WidgetExecutionPhase executionPhase)
446 {
447     UNHANDLED_EXCEPTION_HANDLER_BEGIN
448     {
449         WidgetHandle widgetHandle = request.getWidgetHandle();
450
451         FOREACH(itr, *attributes)
452         {
453             // Get attribute name
454             std::string attribute = *itr->first;
455
456             // Search for attribute handler
457             bool attributeFound = false;
458
459             for (size_t i = 0; i < HANDLED_ATTRIBUTES_LIST_COUNT; ++i) {
460                 if (HANDLED_ATTRIBUTES_LIST[i].name == attribute) {
461                     // Check if execution phase is valid
462                     if ((executionPhase &
463                          HANDLED_ATTRIBUTES_LIST[i].allowedPhaseMask) == 0) {
464                         // Attribute found, but execution state
465                         // forbids to execute handler
466                         LogWarning(
467                             "Request for attribute: '" <<
468                             attribute << "' which is supported " <<
469                             "but forbidden at widget execution phase: "
470                             <<
471                             executionPhase);
472                     } else {
473                         // Execution phase allows handler
474                         AttributeHandlerResponse attributeResponse =
475                             (*HANDLED_ATTRIBUTES_LIST[i].handler)(
476                                 executionPhase,
477                                 widgetHandle);
478                         std::copy(attributeResponse.begin(),
479                                   attributeResponse.end(),
480                                   std::back_inserter(*itr->second));
481                     }
482
483                     attributeFound = true;
484                     break;
485                 }
486             }
487
488             if (!attributeFound) {
489                 LogWarning("Request for attribute: '" <<
490                            attribute << "' which is not supported");
491             }
492         }
493
494         return 0;
495     }
496     UNHANDLED_EXCEPTION_HANDLER_END
497 }
498
499 int WebRuntimeImpl::getAttributesValues(const Request &request,
500         std::list<ATTRIBUTE>* attributes)
501 {
502     UNHANDLED_EXCEPTION_HANDLER_BEGIN
503     {
504         // Get current execution state
505         WidgetExecutionPhase executionPhase =
506             request.getExecutionPhase();
507
508         return getAttributesValuesLoop(request, attributes, executionPhase);
509     }
510     UNHANDLED_EXCEPTION_HANDLER_END
511 }
512
513 std::string WebRuntimeImpl::getSessionId(const Request & /* request */)
514 {
515     std::string result;
516     LogError("Not implemented!");
517     return result;
518 }
519
520 WebRuntimeImpl::WebRuntimeImpl()
521 {
522 }
523
524 /*
525  * class ResourceInformationImpl
526  */
527
528 int ResourceInformationImpl::getAttributesValuesLoop(const Request &request,
529         std::list<ATTRIBUTE>* attributes,
530         WidgetExecutionPhase executionPhase)
531 {
532     // Currently, we assume widgets have internal representation of integer IDs
533     WidgetHandle widgetHandle = request.getWidgetHandle();
534     //TODO add resource id string analyzys
535     FOREACH(itr, *attributes)
536     {
537         // Get attribute name
538         std::string attribute = *itr->first;
539         LogDebug("getting attribute value for: " << attribute);
540         FOREACH(aaa, *itr->second)
541         {
542             LogDebug("its value is: " << *aaa);
543         }
544
545         // Search for attribute handler
546         bool attributeFound = false;
547
548         for (size_t i = 0; i < HANDLED_RESOURCE_ATTRIBUTES_LIST_COUNT; ++i) {
549             if (HANDLED_RESOURCE_ATTRIBUTES_LIST[i].name == attribute) {
550                 // Check if execution phase is valid
551                 if ((executionPhase &
552                      HANDLED_RESOURCE_ATTRIBUTES_LIST[i].allowedPhaseMask) ==
553                     0) {
554                     // Attribute found, but execution state
555                     // forbids to execute handler
556                     LogDebug(
557                         "Request for attribute: '" <<
558                         attribute <<
559                         "' which is supported but forbidden " <<
560                         "at widget execution phase: " << executionPhase);
561                     itr->second = NULL;
562                 } else {
563                     // Execution phase allows handler
564                     AttributeHandlerResponse attributeResponse =
565                         (*HANDLED_RESOURCE_ATTRIBUTES_LIST[i].handler)(
566                             executionPhase,
567                             widgetHandle,
568                             request);
569                     std::copy(attributeResponse.begin(),
570                               attributeResponse.end(),
571                               std::back_inserter(*itr->second));
572
573                     std::ostringstream attributeResponseFull;
574
575                     for (AttributeHandlerResponse::const_iterator
576                          it = attributeResponse.begin();
577                          it != attributeResponse.end(); ++it) {
578                         attributeResponseFull <<
579                         (it == attributeResponse.begin() ? "" : ", ") <<
580                         *it;
581                     }
582
583                     LogDebug("Attribute(" << attribute << ") = " <<
584                              attributeResponseFull.str());
585                 }
586
587                 attributeFound = true;
588                 break;
589             }
590         }
591
592         if (!attributeFound) {
593             LogWarning("Request for attribute: '" << attribute <<
594                        "' which is not supported");
595         }
596     }
597     return 0;
598 }
599
600 int ResourceInformationImpl::getAttributesValues(const Request &request,
601         std::list<ATTRIBUTE>* attributes)
602 {
603     UNHANDLED_EXCEPTION_HANDLER_BEGIN
604     {
605         // Get current execution state
606         WidgetExecutionPhase executionPhase =
607             request.getExecutionPhase();
608         return getAttributesValuesLoop(request, attributes, executionPhase);
609     }
610     UNHANDLED_EXCEPTION_HANDLER_END
611 }
612
613 ResourceInformationImpl::ResourceInformationImpl()
614 {
615 }
616
617 /*
618  * class OperationSystemImpl
619  */
620
621 int OperationSystemImpl::getAttributesValues(const Request &request,
622         std::list<ATTRIBUTE>* attributes)
623 {
624     UNHANDLED_EXCEPTION_HANDLER_BEGIN
625     {
626         //FIXME:
627         //GetExecution name without widget name
628         WidgetExecutionPhase executionPhase =
629             request.getExecutionPhase();
630
631         FOREACH(itr, *attributes)
632         {
633             // Get attribute name
634             std::string attribute = *itr->first;
635
636             // Search for attribute handler
637             bool attributeFound = false;
638
639             for (size_t i = 0; i < HANDLED_ATTRIBUTES_LIST_COUNT; ++i) {
640                 if (HANDLED_ATTRIBUTES_LIST[i].name == attribute) {
641                     // Check if execution phase is valid
642                     if ((executionPhase &
643                          HANDLED_ATTRIBUTES_LIST[i].allowedPhaseMask) == 0) {
644                         // Attribute found, but execution state forbids
645                         // to execute handler
646                         LogDebug("Request for attribute: '" << attribute <<
647                                  "' which is supported but forbidden at " <<
648                                  "widget execution phase: " << executionPhase);
649                         itr->second = NULL;
650                     } else {
651                         // Execution phase allows handler
652                         AttributeHandlerResponse attributeResponse =
653                             (*HANDLED_ATTRIBUTES_LIST[i].handler)(
654                                 executionPhase,
655                                 0);
656                         std::copy(attributeResponse.begin(),
657                                   attributeResponse.end(),
658                                   std::back_inserter(*itr->second));
659
660                         std::ostringstream attributeResponseFull;
661
662                         typedef AttributeHandlerResponse::const_iterator Iter;
663                         FOREACH(it, attributeResponse)
664                         {
665                             attributeResponseFull <<
666                             (it == attributeResponse.begin()
667                              ? "" : ", ") << *it;
668                         }
669
670                         LogDebug("Attribute(" << attribute <<
671                                  ") = " << attributeResponseFull.str());
672                     }
673
674                     attributeFound = true;
675                     break;
676                 }
677             }
678
679             if (!attributeFound) {
680                 LogWarning("Request for attribute: '" << attribute <<
681                            "' which is not supported");
682             }
683         }
684
685         return 0;
686     }
687     UNHANDLED_EXCEPTION_HANDLER_END
688 }
689
690 OperationSystemImpl::OperationSystemImpl()
691 {
692 }
693
694 /*
695  * end of class OperationSystemImpl
696  */
697
698 int FunctionParamImpl::getAttributesValues(const Request & /*request*/,
699         std::list<ATTRIBUTE> *attributes)
700 {
701     FOREACH(iter, *attributes)
702     {
703         std::string attributeName = *(iter->first);
704
705         ParamMap::const_iterator i;
706         std::pair<ParamMap::const_iterator, ParamMap::const_iterator> jj =
707             paramMap.equal_range(attributeName);
708
709         for (i = jj.first; i != jj.second; ++i) {
710             iter->second->push_back(i->second);
711             LogDebug("Attribute: " << attributeName << " Value: " <<
712                      i->second);
713         }
714     }
715     return 0;
716 }