RmsDestination.h
Go to the documentation of this file.
1 #ifndef _RMS_DESTINATION_H
2 #define _RMS_DESTINATION_H
3 
4 #include <string>
5 #include <map>
6 #include <iostream>
7 
8 #include <rms/RmsMessageSchema.h>
9 #include <rms/util/ReentrantGetEnv.h>
10 
11 #include <boost/algorithm/string/trim.hpp>
12 
13 namespace gov {
14 
15 namespace fnal {
16 
17 namespace cd {
18 
19 namespace rms {
20 
21 namespace base {
22 
23 /**
24  * Instances of this class represent message destinations in the
25  * Responsive Messaging System, where a "destination" is an abstract
26  * location to which producers send messages and from which consumers
27  * receive messages.
28  *
29  * In RMS, a destination is composed of an arbitrary number of properties
30  * that describe various characteristics of the abstract location such as
31  * target (hostname or process name) and channel (type of functionality
32  * that the destination is used for). Standard property names and typical
33  * property values are defined in this class and experiment-specific child
34  * classes can provide additional ones based on specific needs.
35  *
36  * @author Kurt Biery
37  * @author Steve Foulkes
38  * @version $Revision: 1.17.12.1 $ $Date: 2019/09/27 00:07:31 $
39  */
40 
41 class RmsDestination : public gov::fnal::cd::rms::xsd::destination {
42  public:
43 
44  /**
45  * The following string constants define common broadcast targets.
46  */
50 
51  /**
52  * The following string constants define expected application names.
53  */
62  static const std::string DCM_APPNAME;
65  static const std::string BNEVB_APPNAME;
69 
70  /**
71  * The following string constants are used to set and retrieve
72  * common destination properties.
73  */
80 
81  /**
82  * The following string constants are common targets
83  * that are used with the target property.
84  */
86 
87  /**
88  * The following string constants are common channels
89  * that are used with the channel property.
90  */
96  static const std::string ALERT_CHANNEL;
99  static const std::string EH_CHANNEL;
100 
101  /**
102  * The following string constants are common message types
103  * that are used with the message type property.
104  */
109 
110  /**
111  * Used as an identifier for the null partition.
112  */
113  static const int NULL_PARTITION;
114 
115  /**
116  * Default constructor for the destination object. Will create an
117  * empty destination.
118  */
120  setDefaults();
121  };
122 
123  /**
124  * Copy constructor for the destination object. Will create a destination
125  * from an existing destination object.
126  *
127  * @param originalDestination The object we want to copy
128  */
129  RmsDestination(const RmsDestination &originalDestination) :
130  xsd::destination(originalDestination) {}
131 
132  /**
133  * Creates an instance from an instance of the XSD base class.
134  *
135  * @param baseDest The object we want to copy
136  */
137  RmsDestination(const xsd::destination &baseDest) :
138  xsd::destination(baseDest) {}
139 
141  RmsDestination(std::string target, std::string channel,
142  std::string messageType);
143  RmsDestination(std::string target, std::string channel,
144  std::string messageType, int partitionNumber);
145 
147  std::string getProperty(std::string name, std::string defaultValue) const;
149  void setPartitionProperty(int partitionNumber);
150 
151  bool equals(const RmsDestination& testObject) const;
152  bool matches(const RmsDestination& testObject) const;
153 
154  std::string toString() const;
155 
156  void validate() const;
157 
158  private:
159 
160  /**
161  * If a custom environment has been specified, this field is used
162  * to store its value so that we can automatically set the
163  * environment property in destinations.
164  */
165  static std::unique_ptr<std::string> _defaultEnvironment;
166 
167  /**
168  * Indicates whether static initialization has been done.
169  */
171 
172  void setDefaults();
173 };
174 
175 } // end of namespace base
176 
177 } // end of namespace rms
178 
179 } // end of namespace cd
180 
181 } // end of namespace fnal
182 
183 } // end of namespace gov
184 
185 #endif
static const std::string DCM_APPNAME
const XML_Char * name
Definition: expat.h:151
const XML_Char * target
Definition: expat.h:268
static const std::string DAQAPP_MANAGER_APPNAME
static const std::string CONFIGURATION_CHANNEL
static const std::string RESOURCE_MANAGER_APPNAME
static const std::string SIMULATION_MANAGER_APPNAME
static const std::string PARTITION_PROPERTY_NAME
static const std::string SOURCE_PROPERTY_NAME
static const std::string MONITOR_CHANNEL
static const std::string ALL_BNEVB_TARGET
const XML_Char int const XML_Char int const XML_Char * base
Definition: expat.h:331
static const std::string BNEVB_APPNAME
static const std::string HEARTBEAT_CHANNEL
static const std::string DAQ_MONITOR_APPNAME
static const std::string REPLY_MESSAGE_TYPE
static const std::string DAQDCS_CHANNEL
RmsDestination(const RmsDestination &originalDestination)
static const std::string SPILL_SERVER_APPNAME
bool matches(const RmsDestination &testObject) const
const XML_Char int const XML_Char * value
Definition: expat.h:331
RmsDestination(const xsd::destination &baseDest)
static const std::string CONTROL_CHANNEL
static const std::string GLOBAL_TRIGGER_APPNAME
static const std::string CHANNEL_PROPERTY_NAME
static const std::string ALL_DCM_TARGET
static const std::string NOTIFICATION_MESSAGE_TYPE
static const std::string TDU_MANAGER_APPNAME
static const std::string DDT_MANAGER_APPNAME
Definition: fnal.py:1
static const std::string SERVICE_MANAGER_TARGET
static const std::string STATUS_REPORT_CHANNEL
void setPartitionProperty(int partitionNumber)
static const std::string RUN_CONTROL_APPNAME
static const std::string ENVIRONMENT_PROPERTY_NAME
static const std::string REQUEST_MESSAGE_TYPE
static const std::string MESSAGE_ANALYZER_APPNAME
void setProperty(std::string name, std::string value)
static const std::string CONFIG_MANAGER_APPNAME
static const std::string TARGET_PROPERTY_NAME
bool equals(const RmsDestination &testObject) const
static const std::string LOOPBACK_MESSAGE_TYPE
std::string getProperty(std::string name) const
static const std::string DATA_LOGGER_APPNAME
static const std::string ALERT_CHANNEL
static std::unique_ptr< std::string > _defaultEnvironment
static const std::string TRIGGER_CHANNEL
c cd(1)
static const std::string DAQDCS_APPNAME
static const std::string MESSAGE_TYPE_PROPERTY_NAME
static const std::string ALL_ELEMENT_TARGET
enum BeamMode string