00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _ACTIVEMQ_CORE_ACTIVEMQCONSTANTS_H_
00018 #define _ACTIVEMQ_CORE_ACTIVEMQCONSTANTS_H_
00019
00020 #include <string>
00021 #include <map>
00022 #include <activemq/util/Config.h>
00023
00024 namespace activemq{
00025 namespace core{
00026
00032 class AMQCPP_API ActiveMQConstants {
00033 public:
00034
00035
00036 enum TransactionState {
00037 TRANSACTION_STATE_BEGIN = 0,
00038 TRANSACTION_STATE_PREPARE = 1,
00039 TRANSACTION_STATE_COMMITONEPHASE = 2,
00040 TRANSACTION_STATE_COMMITTWOPHASE = 3,
00041 TRANSACTION_STATE_ROLLBACK = 4,
00042 TRANSACTION_STATE_RECOVER = 5,
00043 TRANSACTION_STATE_FORGET = 6,
00044 TRANSACTION_STATE_END = 7
00045 };
00046
00047
00048 enum DestinationActions {
00049 DESTINATION_ADD_OPERATION = 0,
00050 DESTINATION_REMOVE_OPERATION = 1
00051 };
00052
00053
00054
00055 enum AckType {
00056 ACK_TYPE_DELIVERED = 0,
00057 ACK_TYPE_POISON = 1,
00058
00059 ACK_TYPE_CONSUMED = 2,
00060 ACK_TYPE_REDELIVERED = 3,
00061 ACK_TYPE_INDIVIDUAL = 4
00062 };
00063
00068 enum DestinationOption {
00069 CONSUMER_PREFECTCHSIZE,
00070 CUNSUMER_MAXPENDINGMSGLIMIT,
00071 CONSUMER_NOLOCAL,
00072 CONSUMER_DISPATCHASYNC,
00073 CONSUMER_RETROACTIVE,
00074 CONSUMER_SELECTOR,
00075 CONSUMER_EXCLUSIVE,
00076 CONSUMER_PRIORITY,
00077 NUM_OPTIONS
00078 };
00079
00084 enum URIParam {
00085 CONNECTION_SENDTIMEOUT,
00086 CONNECTION_PRODUCERWINDOWSIZE,
00087 CONNECTION_CLOSETIMEOUT,
00088 CONNECTION_ALWAYSSYNCSEND,
00089 CONNECTION_USEASYNCSEND,
00090 CONNECTION_USECOMPRESSION,
00091 CONNECTION_DISPATCHASYNC,
00092 PARAM_USERNAME,
00093 PARAM_PASSWORD,
00094 PARAM_CLIENTID,
00095 NUM_PARAMS
00096 };
00097
00098 static const std::string& toString(const DestinationOption option) {
00099 return StaticInitializer::destOptions[option];
00100 }
00101
00102 static DestinationOption toDestinationOption(const std::string& option) {
00103 std::map<std::string, DestinationOption>::iterator iter = StaticInitializer::destOptionMap.find(option);
00104
00105 if (iter == StaticInitializer::destOptionMap.end()) {
00106 return NUM_OPTIONS;
00107 }
00108
00109 return iter->second;
00110 }
00111
00112 static const std::string& toString(const URIParam option) {
00113 return StaticInitializer::uriParams[option];
00114 }
00115
00116 static URIParam toURIOption(const std::string& option) {
00117 std::map<std::string, URIParam>::iterator iter = StaticInitializer::uriParamsMap.find(option);
00118
00119 if (iter == StaticInitializer::uriParamsMap.end()) {
00120 return NUM_PARAMS;
00121 }
00122
00123 return iter->second;
00124 }
00125
00126 class StaticInitializer {
00127 public:
00128 StaticInitializer();
00129 virtual ~StaticInitializer() {}
00130
00131 static std::string destOptions[NUM_OPTIONS];
00132 static std::string uriParams[NUM_PARAMS];
00133 static std::map<std::string, DestinationOption> destOptionMap;
00134 static std::map<std::string, URIParam> uriParamsMap;
00135 };
00136
00137 private:
00138
00139 static StaticInitializer staticInits;
00140
00141 };
00142
00143 }}
00144
00145 #endif