Go to the documentation of this file.00001 #ifndef _BULKDATA_NT_CONFIGURATION_PARSER_H_
00002 #define _BULKDATA_NT_CONFIGURATION_PARSER_H_
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 #ifndef __cplusplus
00030 #error This is a C++ include file and cannot be used from plain C
00031 #endif
00032 
00033 #include <map>
00034 #include <string>
00035 #include <set>
00036 
00037 #include <xercesc/dom/DOMNode.hpp>
00038 #include <xercesc/dom/DOMWriter.hpp>
00039 #include <xercesc/parsers/AbstractDOMParser.hpp>
00040 
00041 #include "bulkDataNTSenderStream.h"
00042 #include "bulkDataNTReceiverStream.h"
00043 
00044 namespace AcsBulkdata
00045 {
00046 
00047         class BulkDataConfigurationParser {
00048 
00049         public:
00050 
00051                 typedef struct {
00052                         SenderStreamConfiguration streamCfg;
00053                         std::map<std::string, SenderFlowConfiguration> flowsCfgMap;
00054                 } SenderCfg;
00055 
00056                 typedef struct {
00057                         ReceiverStreamConfiguration streamCfg;
00058                         std::map<std::string, ReceiverFlowConfiguration> flowsCfgMap;
00059                 } ReceiverCfg;
00060 
00064                 BulkDataConfigurationParser();
00065 
00069                 ~BulkDataConfigurationParser();
00070 
00076                 void parseSenderConfig(char const *configXML, std::map<std::string, SenderCfg> &configMap);
00077 
00083                 void parseReceiverConfig(char const *configXML, std::map<std::string, ReceiverCfg> &configMap);
00084 
00085         private:
00086 
00087                 char* getAttrValue(xercesc::DOMNode *node, const char * name);
00088 
00089                 void getSerializedElement(xercesc::DOMNode *node, std::string &s);
00090 
00091                 void addQoSToProfile(const char *stream, const char *profileName, const char* baseProfile, xercesc::DOMNode *node);
00092 
00093                 void parseConfig(const char *config,
00094                         const char* const reqStreamNodeName,
00095                         const char* const reqFlowNodeName,
00096                         const char* const reqStreamQoSNodeName,
00097                         const char* const reqFlowQoSNodeName,
00098                         const char* const defaultStreamProfile,
00099                         const char* const defaultFlowProfile);
00100 
00101                 template<class CfgS, class StreamConfigT, class FlowConfigT>
00102                 void populateConfiguration(std::map<std::string, CfgS> &configMap);
00103 
00104                 void clearCollections();
00105 
00106                 void printEntities();
00107 
00108                 std::string getStrURIforStream(char *streamName);
00109 
00110                 
00111                 std::map<std::string, std::map<std::string, std::string> > m_profiles;
00112                 std::map<char *, std::set<char*> > m_entities;
00113                 xercesc::DOMWriter *m_writer;
00114                 xercesc::AbstractDOMParser *m_parser;
00115 
00116                 static const char* const SENDER_STREAM_NODENAME;
00117                 static const char* const SENDER_STREAM_QOS_NODENAME;
00118                 static const char* const SENDER_FLOW_NODENAME;
00119                 static const char* const SENDER_FLOW_QOS_NODENAME;
00120                 static const char* const RECEIVER_STREAM_NODENAME;
00121                 static const char* const RECEIVER_STREAM_QOS_NODENAME;
00122                 static const char* const RECEIVER_FLOW_NODENAME;
00123                 static const char* const RECEIVER_FLOW_QOS_NODENAME;
00124 
00125                 static const char* const DYNAMIC_LIBRARY_NAME;
00126         };
00127 
00128 };
00129 
00130 #include "bulkDataNTConfigurationParser.i"
00131 
00132 #endif