Blame view

src/dcxmletlservices.h 3.96 KB
30448f62   Peter M. Groen   Replace Qt with s...
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
  #ifndef OSDEV_COMPONENTS_DCXMLETLSERVICES_H
  #define OSDEV_COMPONENTS_DCXMLETLSERVICES_H
  
  #include "dcxmlbase.h"
  
  #include <QObject>
  #include <QString>
  #include <QStringList>
  #include <QHash>
  
  namespace osdev {
  namespace components {
  /*
   *   _________________________________________
   *  / River: "Little soul big world. Eat and  \
   *  | sleep and eat... Many souls. Very       |
   *  | straight, very simple"                  |
   *  |                                         |
   *  | Mal: "Cattle on the ship three weeks,   |
   *  | she don't go near 'em. Suddenly, we're  |
   *  | on Jiangyin and she's got a driving     |
   *  | need to commune with the beasts?"       |
   *  |                                         |
   *  | River: "They weren't cows inside. They  |
   *  | were waiting to be, but they forgot.    |
   *  | Now they see sky and they remember what |
   *  | they are."                              |
   *  |                                         |
   *  | Mal: "Is it bad that what she just said |
   *  | makes perfect sense to me?"             |
   *  |                                         |
   *  \ --Episode #5, "Safe"                    /
   *   -----------------------------------------
   *     \
   *      \
   *          .--.
   *         |o_o |
   *         |:_/ |
   *        //   \ \
   *       (|     | )
   *      /'\_   _/`\
   *      \___)=(___/
   *
   **************************************************************************************/
  /*! \brief  This component locates all the services from the ModelMapper configuration.
   *          Although it can be used seperately, it is intended to be a helper class to
   *          XMLEtlConfig.
   *          While XMLEtlConfig is implemented as Singleton, this class isn't.
   */
  
  class DcXmlEtlServices : public DcXmlBase
  {
  public:
      DcXmlEtlServices( const QString &fileName = QString() );
  
      /// Deleted copy constructor
      DcXmlEtlServices( const DcXmlEtlServices& ) = delete;
  
      /// Deleted assignment constructor
      DcXmlEtlServices& operator=( const DcXmlEtlServices& ) = delete;
  
      /// Deleted move constructor
      DcXmlEtlServices( DcXmlEtlServices&& ) = delete;
  
      /// Deleeted move operator
      DcXmlEtlServices& operator=( DcXmlEtlServices&& ) = delete;
  
      /// @brief  Loads the configuration from the given fileName.
      /// @param  fileName - The configuration file in XML format.
      virtual bool loadConfiguration( const QString &fileName );
  
      // =========================================================================
      /*!
       *  \brief  Get the list of services mentioned in the modelmapper configuration
       *          If no services were mentioned, this list will be empty.
       */
      QStringList getServiceNames() const;
  
      /*!
       *  \brief  Get the list of serviceIds mentioned in the modelmapper configuration
       *          If no ServiceIds were found, this list will be empty.
       */
      QStringList getServiceIds() const;
  
      /*!
       *  \brief  Get the filename of the service-configuration file.
       *          This file isn't parsed here but passed on to the DcXmlNetwork class.
       */
      QString     getServiceConfig( const QString &serviceId ) const;
  
      /*!
       *  \brief  Get the list of configurations by serviceId in a Hash
       *          If no services are found, this Hash will be empty.
       */
      QHash<QString, QString> getServiceConfigs() const;
  
      // Convenient methods.
      /*!
       * @brief   Added for convenience. The name is quite descriptive.
       */
      QString     getServiceConfigByName( const QString &serviceName ) const;
      QString     getServiceIdByName( const QString &serviceName ) const;
      QString     getServiceConfigById( const QString &serviceId ) const;
  
  private:
      void    constructXPathHash();
      QString getValueByAttribute( const QString &XPath,
                                   const QString &attrValue,
                                   const QString &returnAttribute ) const;
  
  };
  
  }   /* End namespace components */
  }   /* End namespace osdev */
  
  #endif  /* OSDEV_COMPONENTS_DCXMLETLSERVICES_H */