summaryrefslogtreecommitdiff
path: root/modules/CIAO/DAnCE/Config_Handlers/Property_Handler.cpp
blob: ab4289637e144f1e5e34a33b65ca80ff32529923 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//$Id$

#include "Property_Handler.h"
#include "Any_Handler.h"
#include "Basic_Deployment_Data.hpp"
#include "DAnCE/Deployment/Deployment_DataC.h"
#include "DAnCE/Logger/Log_Macros.h"
namespace CIAO
{
  namespace Config_Handlers
  {

    Property_Handler::Property_Handler (void)
    {
    }

    Property_Handler::~Property_Handler (void)
    {
    }

    void
    Property_Handler::handle_property (const Property& desc,
                                       Deployment::Property& toconfig)
    {
      DANCE_TRACE("Property_Handler::get_property");

      try
        {
          toconfig.name =
            CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR (desc.name ().c_str ()));

          Any_Handler::extract_into_any (desc.value (),
                                         toconfig.value);
        }
      catch (Config_Error &ex)
        {
          ex.name_ = desc.name ();
          throw ex;
        }
    }

    Property
    Property_Handler::get_property (const Deployment::Property& src)
    {
      DANCE_TRACE("Property_Handler::get_property - reverse");

      ::XMLSchema::string< ACE_TCHAR > name (ACE_TEXT_CHAR_TO_TCHAR(src.name));
      Any value (Any_Handler::get_any (src.value));

      Property prop (name,value);

      return prop;
    }

  }
}