Apama Capital Markets Foundation  10.1.0.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Connectivity_SessionDefs.h
Go to the documentation of this file.
1 
10 #ifndef _SESSION_DEFINITONS_H_
11 #define _SESSION_DEFINITONS_H_
12 
13 #include <string>
14 #include <list>
15 #include <map>
16 #include <algorithm>
17 #include <iterator>
18 #include <sag_connectivity_plugins.hpp>
19 
20 using namespace com::softwareag::connectivity;
21 
22 #define SESSION_CONFIG_SCHEMA ("configSchema")
23 #define SESSION_CONFIG_PARAMS ("SCP")
24 #define SESSION_CONFIG_KEY ("SessionConfigParams")
25 #define SESSION_CAPABILITIES ("sessionCapabilities")
26 #define CTRL_PARAMS ("CtrlParams")
27 #define CTRL_PARAMS_CP ("CP")
28 #define CTRL_PARAMS_SCHEMA ("CtrlParamsSchema")
31 typedef enum
32 {
41 }
43 
48 struct Param {
52  Param()
53  {
54  };
55 
60  const std::string& paramName,
61  const std::string& type,
62  const std::string& defaultVal,
63  std::list<std::string>& allowedVals,
64  const std::string& description,
65  bool required,
66  bool referenceOnly
67  ) : m_name(paramName)
68  , m_type(type)
69  , m_defaultVal(defaultVal)
70  , m_description(description)
71  , m_required(required)
72  , m_allowedVals(allowedVals)
73  , m_referenceOnly(referenceOnly)
74  {
75 
76  }
77 
78  ~Param() {};
79 
83  const std::string toString()
84  {
85  std::stringstream listToString;
86  std::copy(m_allowedVals.begin(), m_allowedVals.end(), std::ostream_iterator<std::string>(listToString, ","));
87 
88  std::stringstream ss;
89  ss << "type=" << m_type << " ,defaultVal=" << m_defaultVal
90  << " ,description=" << m_description << " ,required="
91  << m_required << " ,allowedVals=[" << listToString.str()
92  << "] ,referenceOnly=" << m_referenceOnly << std::endl;
93 
94  return std::move(ss.str());
95  }
96 
104  map_t getCP(const std::string& eventType) const;
105 
106  std::string m_name;
107  std::string m_type;
108  std::string m_defaultVal;
109  std::list<std::string> m_allowedVals;
110  std::string m_description;
111  bool m_required;
113 };
114 
120 struct SessionParam : public Param {
121 
127  {
128  };
129 
135  const std::string& paramName,
136  const std::string& type,
137  const std::string& defaultVal,
138  std::list<std::string>& allowedVals,
139  const std::string& description,
140  bool required,
141  bool referenceOnly
142  )
143  : Param(paramName, type, defaultVal, allowedVals, description, required, referenceOnly)
144  {
145  }
146 
147  ~SessionParam() {};
148 
149 
157  map_t getCP() const;
158 
159 };
160 
165 
171  {};
172 
173  ~SessionParams()
174  {};
175 
182  map_t getConfigSchemaString() const;
183 
185  typedef std::map<std::string, SessionParam> Map;
186 
190  Map m_map;
191 
195  const std::string toString()
196  {
197  std::stringstream mapToString;
198  for (auto it=m_map.begin(); it!=m_map.end();++it)
199  {
200  mapToString << it->first << ":" << it->second.toString();
201  }
202  return std::move(mapToString.str());
203  }
204 };
205 
208 struct CapabilityParam : public Param {
209 
215  {
216  };
217 
222  (
223  std::string paramName,
224  std::string type,
225  std::string defaultVal,
226  std::list<std::string>& allowedVals,
227  std::string description,
228  bool required
229  )
230  : Param(paramName, type, defaultVal, allowedVals, description, required, false)
231  {
232  }
233 
234  ~CapabilityParam() {};
235 
242  map_t getCP() const;
243 };
244 
249 
254  {};
255 
257  {};
258 
265  map_t getCPSchema() const;
266 
268  typedef std::map<std::string, CapabilityParam> Map;
269 
273  Map m_map;
274 
278  const std::string toString()
279  {
280  std::stringstream mapToString;
281  for (auto it = m_map.begin(); it != m_map.end(); ++it)
282  {
283  mapToString << it->first << ":" << it->second.toString();
284  }
285  return std::move(mapToString.str());
286  }
287 };
288 
290 typedef std::map<std::string, CapabilityParams> Capabilities;
291 
292 
298 struct Capability {
303  {
304  };
305 
309  Capability
310  (
311  const std::string streamName,
312  CapabilityParam capability
313  )
314  : streamName_(streamName), capability_(capability)
315  {
316  }
317 
318  ~Capability() {};
319 
323  std::string streamName_;
328 };
329 
336 {
341  {
342  m_state = SESSION_UNKNOWN;
343  };
344 
345 
350  std::string transportName,
351  std::string sessionName,
352  std::string channelName,
353  std::string description
354  )
355  : m_transportName(transportName)
356  , m_sessionName(sessionName)
357  , m_channelName(channelName)
358  , m_description(description)
359  , m_generationId("")
360  {
361  m_state = SESSION_UNKNOWN;
362  std::stringstream ss;
363  ss << "CONNECTION_" << sessionName;
364  m_connectionID = ss.str();
365  };
366 
367 
368  ~SessionConfigs()
369  {};
370 
374  const std::string toString()
375  {
376  std::stringstream ss;
377  ss << "sourceId=" << m_sourceId << ", transportName=" << m_transportName << ", sessionName="
378  << m_sessionName << ", channelName=" << m_channelName << ", state=" << (int)m_state
379  << ", connectionID=" << m_connectionID << ", generationId=" << m_generationId << " ,SessionParams=" << m_sessionParams.toString();
380  return std::move(ss.str());
381  }
386  map_t getCapabilitiesString() const;
387 
388  int64_t m_sourceId;
389  std::string m_transportName;
390  std::string m_sessionName;
391  std::string m_channelName;
392  std::string m_description;
394  std::string m_connectionID;
395  std::string m_generationId;
397  Capabilities m_capabilitiesMap;
398 };
399 #endif
std::map< std::string, SessionParam > Map
Definition: Connectivity_SessionDefs.h:185
std::string m_description
Definition: Connectivity_SessionDefs.h:392
SessionConfigs(std::string transportName, std::string sessionName, std::string channelName, std::string description)
Definition: Connectivity_SessionDefs.h:349
Definition: Connectivity_SessionDefs.h:120
bool m_required
Definition: Connectivity_SessionDefs.h:111
bool m_referenceOnly
Definition: Connectivity_SessionDefs.h:112
const std::string toString()
Definition: Connectivity_SessionDefs.h:374
std::string m_sessionName
Definition: Connectivity_SessionDefs.h:390
AP_SESSION_State
Definition: Connectivity_SessionDefs.h:31
Capabilities m_capabilitiesMap
Definition: Connectivity_SessionDefs.h:397
Definition: Connectivity_SessionDefs.h:208
std::string m_generationId
Definition: Connectivity_SessionDefs.h:395
Definition: Connectivity_SessionDefs.h:34
const std::string toString()
Definition: Connectivity_SessionDefs.h:83
std::string m_description
Definition: Connectivity_SessionDefs.h:110
std::string m_transportName
Definition: Connectivity_SessionDefs.h:389
Definition: Connectivity_SessionDefs.h:40
const std::string toString()
Definition: Connectivity_SessionDefs.h:195
SessionParam(const std::string &paramName, const std::string &type, const std::string &defaultVal, std::list< std::string > &allowedVals, const std::string &description, bool required, bool referenceOnly)
Definition: Connectivity_SessionDefs.h:134
Definition: Connectivity_SessionDefs.h:39
CapabilityParam()
Definition: Connectivity_SessionDefs.h:214
Map m_map
Definition: Connectivity_SessionDefs.h:273
std::string m_channelName
Definition: Connectivity_SessionDefs.h:391
Capability()
Definition: Connectivity_SessionDefs.h:302
CapabilityParams()
Definition: Connectivity_SessionDefs.h:253
AP_SESSION_State m_state
Definition: Connectivity_SessionDefs.h:393
Definition: Connectivity_SessionDefs.h:248
std::string m_defaultVal
Definition: Connectivity_SessionDefs.h:108
SessionParams m_sessionParams
Definition: Connectivity_SessionDefs.h:396
Definition: Connectivity_SessionDefs.h:164
std::string m_name
Definition: Connectivity_SessionDefs.h:106
Definition: Connectivity_SessionDefs.h:298
Definition: Connectivity_SessionDefs.h:38
std::string m_type
Definition: Connectivity_SessionDefs.h:107
Param()
Definition: Connectivity_SessionDefs.h:52
Definition: Connectivity_SessionDefs.h:37
SessionParams()
Definition: Connectivity_SessionDefs.h:170
Definition: Connectivity_SessionDefs.h:48
const std::string toString()
Definition: Connectivity_SessionDefs.h:278
int64_t m_sourceId
Definition: Connectivity_SessionDefs.h:388
Definition: Connectivity_SessionDefs.h:335
Definition: Connectivity_SessionDefs.h:36
std::list< std::string > m_allowedVals
Definition: Connectivity_SessionDefs.h:109
std::map< std::string, CapabilityParams > Capabilities
Definition: Connectivity_SessionDefs.h:290
Definition: Connectivity_SessionDefs.h:35
SessionConfigs()
Definition: Connectivity_SessionDefs.h:340
SessionParam()
Definition: Connectivity_SessionDefs.h:126
CapabilityParam capability_
Definition: Connectivity_SessionDefs.h:327
std::string m_connectionID
Definition: Connectivity_SessionDefs.h:394
Param(const std::string &paramName, const std::string &type, const std::string &defaultVal, std::list< std::string > &allowedVals, const std::string &description, bool required, bool referenceOnly)
Definition: Connectivity_SessionDefs.h:59
std::map< std::string, CapabilityParam > Map
Definition: Connectivity_SessionDefs.h:268
Map m_map
Definition: Connectivity_SessionDefs.h:190