activemq-cpp-3.9.5
ActiveMQDestination.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQDESTINATION_H_
19#define _ACTIVEMQ_COMMANDS_ACTIVEMQDESTINATION_H_
20
24#include <cms/Destination.h>
25#include <decaf/lang/Pointer.h>
28
29#include <vector>
30#include <string>
31#include <map>
32
33namespace activemq {
34namespace commands {
35
37
39 public decaf::lang::Comparable<ActiveMQDestination> {
40 protected:
41
43 static const std::string ANY_CHILD;
44 static const std::string ANY_DESCENDENT;
45 };
46
50 static const std::string DEFAULT_ORDERED_TARGET;
51
52 static const std::string TEMP_PREFIX;
53 static const std::string TEMP_POSTFIX;
54 static const std::string COMPOSITE_SEPARATOR;
55
56 static const std::string QUEUE_QUALIFIED_PREFIX;
57 static const std::string TOPIC_QUALIFIED_PREFIX;
58 static const std::string TEMP_QUEUE_QUALIFED_PREFIX;
59 static const std::string TEMP_TOPIC_QUALIFED_PREFIX;
60
61 // Cached transient data
63 bool ordered;
66 std::string orderedTarget;
67
68 std::string physicalName;
71
72 public:
73
74 const static unsigned char ID_ACTIVEMQDESTINATION = 0;
75
76 static const std::string TEMP_DESTINATION_NAME_PREFIX;
77
79
80 private:
81
84
85 public:
86
88
89 ActiveMQDestination(const std::string& physicalName);
90
91 virtual ~ActiveMQDestination() throw();
92
93 virtual ActiveMQDestination* cloneDataStructure() const {
94 return NULL;
95 }
96
97 virtual void copyDataStructure(const DataStructure* src);
98
99 virtual bool equals(const DataStructure* value) const;
100
101 virtual unsigned char getDataStructureType() const;
102
103 virtual std::string toString() const;
104
105 int getHashCode() const {
106 return this->hashCode;
107 }
108
109 public:
110
115 virtual std::string getPhysicalName() const {
116 return this->physicalName;
117 }
118
123 virtual void setPhysicalName(const std::string& physicalName);
124
128 virtual bool isAdvisory() const {
129 return advisory;
130 }
131
135 virtual void setAdvisory(bool advisory) {
136 this->advisory = advisory;
137 }
138
142 virtual bool isExclusive() const {
143 return exclusive;
144 }
145
149 virtual void setExclusive( bool exclusive ) {
150 this->exclusive = exclusive;
151 }
152
156 virtual bool isOrdered() const {
157 return ordered;
158 }
159
163 virtual void setOrdered(bool ordered) {
164 this->ordered = ordered;
165 }
166
170 virtual std::string getOrderedTarget() const {
171 return orderedTarget;
172 }
173
177 virtual void setOrderedTarget(const std::string& orderedTarget) {
178 this->orderedTarget = orderedTarget;
179 }
180
186
193 std::string getDestinationTypeAsString() const;
194
199 virtual bool isTemporary() const {
200 return getDestinationType() == cms::Destination::TEMPORARY_TOPIC ||
201 getDestinationType() == cms::Destination::TEMPORARY_QUEUE;
202 }
203
208 virtual bool isTopic() const {
209 return getDestinationType() == cms::Destination::TOPIC ||
210 getDestinationType() == cms::Destination::TEMPORARY_TOPIC;
211 }
212
217 virtual bool isQueue() const {
218 return !isTopic();
219 }
220
229 virtual bool isComposite() const {
230 return physicalName.find_first_of(COMPOSITE_SEPARATOR) != std::string::npos;
231 }
232
239
243 virtual bool isWildcard() const {
244 return physicalName.find_first_of(DestinationFilter::ANY_CHILD) != std::string::npos||
245 physicalName.find_first_of(DestinationFilter::ANY_DESCENDENT) != std::string::npos;
246 }
247
252 return options;
253 }
254
259 virtual const cms::Destination* getCMSDestination() const {
260 return NULL;
261 }
262
272 Pointer<ActiveMQDestination> createDestination(const std::string& name) const {
273 return ActiveMQDestination::createDestination(getDestinationType(), name);
274 }
275
276 virtual int compareTo(const ActiveMQDestination& value) const;
277
278 virtual bool equals(const ActiveMQDestination& value) const;
279
280 virtual bool operator==(const ActiveMQDestination& value) const;
281
282 virtual bool operator<(const ActiveMQDestination& value) const;
283
284 public: // Statics
285
292 static std::string createTemporaryName(const std::string& clientId) {
293 return TEMP_PREFIX + clientId + TEMP_POSTFIX;
294 }
295
302 static std::string getClientId(const ActiveMQDestination* destination);
303
312 static Pointer<ActiveMQDestination> createDestination(int type, const std::string& name);
313
314 };
315
316}}
317
318#endif /*_ACTIVEMQ_COMMANDS_ACTIVEMQDESTINATION_H_*/
#define AMQCPP_API
Definition: Config.h:30
Definition: ActiveMQDestination.h:39
virtual bool operator==(const ActiveMQDestination &value) const
bool ordered
Definition: ActiveMQDestination.h:63
virtual bool isComposite() const
Returns true if this destination represents a collection of destinations; allowing a set of destinati...
Definition: ActiveMQDestination.h:229
virtual void setPhysicalName(const std::string &physicalName)
Set this destination's physical name.
static const std::string DEFAULT_ORDERED_TARGET
The default target for ordered destinations.
Definition: ActiveMQDestination.h:50
virtual std::string toString() const
Returns a string containing the information for this DataStructure such as its type and value of its ...
virtual unsigned char getDataStructureType() const
Get the DataStructure Type as defined in CommandTypes.h.
bool advisory
Definition: ActiveMQDestination.h:64
virtual bool equals(const DataStructure *value) const
Compares the DataStructure passed in to this one, and returns if they are equivalent.
static std::string createTemporaryName(const std::string &clientId)
Create a temporary name from the clientId.
Definition: ActiveMQDestination.h:292
util::ActiveMQProperties options
Definition: ActiveMQDestination.h:69
virtual std::string getOrderedTarget() const
Definition: ActiveMQDestination.h:170
ActiveMQDestination(const std::string &physicalName)
static const std::string COMPOSITE_SEPARATOR
Definition: ActiveMQDestination.h:54
const activemq::util::ActiveMQProperties & getOptions() const
Definition: ActiveMQDestination.h:251
virtual bool operator<(const ActiveMQDestination &value) const
virtual const cms::Destination * getCMSDestination() const
Definition: ActiveMQDestination.h:259
std::string orderedTarget
Definition: ActiveMQDestination.h:66
virtual bool isQueue() const
Returns true if a Queue Destination.
Definition: ActiveMQDestination.h:217
virtual int compareTo(const ActiveMQDestination &value) const
bool exclusive
Definition: ActiveMQDestination.h:62
decaf::util::ArrayList< Pointer< ActiveMQDestination > > getCompositeDestinations() const
Returns an ArrayList containing all the ActiveMQDestinations that comprise this Composite destination...
virtual void setAdvisory(bool advisory)
Definition: ActiveMQDestination.h:135
static const std::string TEMP_QUEUE_QUALIFED_PREFIX
Definition: ActiveMQDestination.h:58
virtual std::string getPhysicalName() const
Fetch this destination's physical name.
Definition: ActiveMQDestination.h:115
decaf::util::ArrayList< Pointer< ActiveMQDestination > > compositeDestinations
Definition: ActiveMQDestination.h:65
static const std::string TEMP_DESTINATION_NAME_PREFIX
Definition: ActiveMQDestination.h:76
virtual bool isAdvisory() const
Definition: ActiveMQDestination.h:128
std::string getDestinationTypeAsString() const
Returns the type of Destination that this object represents as a string, the available string values ...
virtual bool isTopic() const
Returns true if a Topic Destination.
Definition: ActiveMQDestination.h:208
virtual bool isTemporary() const
Returns true if a temporary Destination.
Definition: ActiveMQDestination.h:199
static const std::string TOPIC_QUALIFIED_PREFIX
Definition: ActiveMQDestination.h:57
std::string physicalName
Definition: ActiveMQDestination.h:68
static const std::string QUEUE_QUALIFIED_PREFIX
Definition: ActiveMQDestination.h:56
static Pointer< ActiveMQDestination > createDestination(int type, const std::string &name)
Creates a Destination given the String Name to use and a Type.
static std::string getClientId(const ActiveMQDestination *destination)
From a temporary destination find the clientId of the Connection that created it.
virtual bool isWildcard() const
Definition: ActiveMQDestination.h:243
virtual bool isOrdered() const
Definition: ActiveMQDestination.h:156
virtual void setExclusive(bool exclusive)
Definition: ActiveMQDestination.h:149
int hashCode
Definition: ActiveMQDestination.h:70
virtual bool equals(const ActiveMQDestination &value) const
decaf::lang::PointerComparator< ActiveMQDestination > COMPARATOR
Definition: ActiveMQDestination.h:78
static const std::string TEMP_POSTFIX
Definition: ActiveMQDestination.h:53
virtual cms::Destination::DestinationType getDestinationType() const =0
Returns the Type of Destination that this object represents.
static const std::string TEMP_PREFIX
Definition: ActiveMQDestination.h:52
virtual bool isExclusive() const
Definition: ActiveMQDestination.h:142
virtual void copyDataStructure(const DataStructure *src)
Copy the contents of the passed object into this objects members, overwriting any existing data.
static const std::string TEMP_TOPIC_QUALIFED_PREFIX
Definition: ActiveMQDestination.h:59
virtual void setOrderedTarget(const std::string &orderedTarget)
Definition: ActiveMQDestination.h:177
virtual void setOrdered(bool ordered)
Definition: ActiveMQDestination.h:163
int getHashCode() const
Definition: ActiveMQDestination.h:105
Pointer< ActiveMQDestination > createDestination(const std::string &name) const
Create a new Destination that's of the same type as this one but with the given destination name.
Definition: ActiveMQDestination.h:272
Definition: BaseDataStructure.h:33
Definition: DataStructure.h:27
Implementation of the CMSProperties interface that delegates to a decaf::util::Properties object.
Definition: ActiveMQProperties.h:37
A Destination object encapsulates a provider-specific address.
Definition: Destination.h:39
DestinationType
Definition: Destination.h:42
@ TEMPORARY_TOPIC
Definition: Destination.h:45
@ TOPIC
Definition: Destination.h:43
@ TEMPORARY_QUEUE
Definition: Destination.h:46
This interface imposes a total ordering on the objects of each class that implements it.
Definition: Comparable.h:33
This implementation of Comparator is designed to allows objects in a Collection to be sorted or teste...
Definition: Pointer.h:366
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition: Pointer.h:53
Definition: ArrayList.h:39
#define NULL
Definition: Config.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition: CachedConsumer.h:24
static const std::string ANY_CHILD
Definition: ActiveMQDestination.h:43
static const std::string ANY_DESCENDENT
Definition: ActiveMQDestination.h:44