1 /*------------------------------------------------------------------------------
2 Name: QueuePropertyBase.cpp
3 Project: xmlBlaster.org
4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
5 Comment: Holding callback queue properties
6 Version: $Id: QueuePropertyBase.cpp 13445 2005-07-15 01:54:35Z ruff $
7 ------------------------------------------------------------------------------*/
8
9
10 /**
11 * Helper class holding callback queue properties.
12 * <p />
13 * See ConnectQos for XML syntax.
14 * @see org.xmlBlaster.client.qos.ConnectQos
15 */
16
17 #include <util/qos/storage/QueuePropertyBase.h>
18 #include <util/lexical_cast.h>
19 #include <util/Global.h>
20
21 namespace org { namespace xmlBlaster { namespace util { namespace qos { namespace storage {
22
23 using namespace std;
24 using namespace org::xmlBlaster::util;
25 using namespace org::xmlBlaster::util::qos::address;
26
27 const long DEFAULT_maxEntriesDefault = 1000L;
28 const long DEFAULT_maxEntriesCacheDefault = 1000L;
29 const long DEFAULT_bytesDefault = 10485760L; // 10 MB
30 const long DEFAULT_bytesCacheDefault = 2097152L; // 2 MB
31 /** The default settings (as a ratio relative to the maxBytesCache) for the storeSwapLevel */
32 const double DEFAULT_storeSwapLevelRatio = 0.70;
33 /** The default settings (as a ratio relative to the maxBytesCache) for the storeSwapBytes */
34 const double DEFAULT_storeSwapBytesRatio = 0.25;
35 /** The default settings (as a ratio relative to the maxBytesCache) for the storeSwapLevel */
36 const double DEFAULT_reloadSwapLevelRatio = 0.30;
37 /** The default settings (as a ratio relative to the maxBytesCache) for the storeSwapBytes */
38 const double DEFAULT_reloadSwapBytesRatio = 0.25;
39 const Timestamp DEFAULT_minExpires = 1000;
40 const Timestamp DEFAULT_maxExpires = 0;
41 const string DEFAULT_onOverflow = Constants::ONOVERFLOW_DEADMESSAGE;
42 const string DEFAULT_onFailure = Constants::ONOVERFLOW_DEADMESSAGE;
43
44 // static variables
45 string DEFAULT_type = "CACHE";
46 string DEFAULT_version = "1.0";
47 /** If not otherwise noted a queue dies after the max value, changeable with property e.g. "queue.expires=3600000" milliseconds */
48 long DEFAULT_expires;
49
50
51 /**
52 * Configure property settings, add your own defaults in the derived class
53 * @param propertyPrefix e.g. "history" or "callback" or "connection" or ""
54 */
55 void QueuePropertyBase::initialize(const string& propertyPrefix)
56 {
57 //if (log_.call()) log_.call(ME, string("::initialize with property prefix '") + propertyPrefix + "'");
58 propertyPrefix_ = propertyPrefix;
59 string prefix = getPrefix();
60 //if (log_.trace()) log_.trace(ME, string("::initialize: got the prefix '") + prefix + "'");
61
62 // Do we need this range settings?
63 setMinExpires(global_.getProperty().getTimestampProperty("queue/expires.min", DEFAULT_minExpires));
64 setMaxExpires(global_.getProperty().getTimestampProperty("queue/expires.max", DEFAULT_maxExpires)); // Long.MAX_VALUE);
65 //if (log_.trace()) log_.trace(ME, "::initialize: expires set");
66 if (nodeId_ != "") {
67 setMinExpires(global_.getProperty().getTimestampProperty("queue/expires.min["+nodeId_+"]", getMinExpires()));
68 setMaxExpires(global_.getProperty().getTimestampProperty("queue/expires.max["+nodeId_+"]", getMaxExpires())); // Long.MAX_VALUE);
69 }
70 //if (log_.trace()) log_.trace(ME, "::initialize: expires for the specific node set");
71
72 // prefix is e.g. "queue/history/" or "persistence/topicStore/"
73 setMaxEntries(global_.getProperty().getLongProperty(prefix+"maxEntries", DEFAULT_maxEntriesDefault));
74 //if (log_.trace()) log_.trace(ME, "::initialize: setMaxEntries -> " + lexical_cast<string>(getMaxEntries()));
75 setMaxEntriesCache(global_.getProperty().getLongProperty(prefix+"maxEntriesCache", DEFAULT_maxEntriesCacheDefault));
76 //if (log_.trace()) log_.trace(ME, "::initialize: setMaxEntriesCache -> " + lexical_cast<string>(getMaxEntriesCache()));
77 setMaxBytes(global_.getProperty().getLongProperty(prefix+"maxBytes", DEFAULT_bytesDefault));
78 //if (log_.trace()) log_.trace(ME, "::initialize: setMaxBytes -> " + lexical_cast<string>(getMaxBytes()));
79 setMaxBytesCache(global_.getProperty().getLongProperty(prefix+"maxBytesCache", DEFAULT_bytesCacheDefault));
80 //if (log_.trace()) log_.trace(ME, "::initialize: setMaxBytesCache -> " + lexical_cast<string>(getMaxBytesCache()));
81
82 setStoreSwapLevel(global_.getProperty().getLongProperty(prefix+"storeSwapLevel", (long)(DEFAULT_storeSwapLevelRatio*maxBytesCache_)));
83 setStoreSwapBytes(global_.getProperty().getLongProperty(prefix+"storeSwapBytes", (long)(DEFAULT_storeSwapBytesRatio*maxBytesCache_)));
84 setReloadSwapLevel(global_.getProperty().getLongProperty(prefix+"reloadSwapLevel", (long)(DEFAULT_reloadSwapLevelRatio*maxBytesCache_)));
85 setReloadSwapBytes(global_.getProperty().getLongProperty(prefix+"reloadSwapBytes", (long)(DEFAULT_reloadSwapBytesRatio*maxBytesCache_)));
86
87 //if (log_.trace()) log_.trace(ME, "::initialize: values for the swap control set");
88
89 setExpires(global_.getProperty().getTimestampProperty(prefix+"expires", DEFAULT_maxExpires));
90 setOnOverflow(global_.getProperty().getStringProperty(prefix+"onOverflow", DEFAULT_onOverflow));
91 setOnFailure(global_.getProperty().getStringProperty(prefix+"onFailure", DEFAULT_onFailure));
92 setType(global_.getProperty().getStringProperty(prefix+"type", DEFAULT_type));
93 setVersion(global_.getProperty().getStringProperty(prefix+"version", DEFAULT_version));
94
95 //if (log_.trace()) log_.trace(ME, "::initialize: going to set specific node properties");
96
97 if (nodeId_ != "") {
98 setMaxEntries(global_.getProperty().getLongProperty(prefix+"maxEntries["+nodeId_+"]", getMaxEntries()));
99 setMaxEntriesCache(global_.getProperty().getLongProperty(prefix+"maxEntriesCache["+nodeId_+"]", getMaxEntriesCache()));
100 setMaxBytes(global_.getProperty().getLongProperty(prefix+"maxBytes["+nodeId_+"]", getMaxBytes()));
101 setMaxBytesCache(global_.getProperty().getLongProperty(prefix+"maxBytesCache["+nodeId_+"]", getMaxBytesCache()));
102 setStoreSwapLevel(global_.getProperty().getLongProperty(prefix+"storeSwapLevel["+nodeId_+"]", getStoreSwapLevel()));
103 setStoreSwapBytes(global_.getProperty().getLongProperty(prefix+"storeSwapBytes["+nodeId_+"]", getStoreSwapBytes()));
104 setReloadSwapLevel(global_.getProperty().getLongProperty(prefix+"reloadSwapLevel["+nodeId_+"]", getReloadSwapLevel()));
105 setReloadSwapBytes(global_.getProperty().getLongProperty(prefix+"reloadSwapBytes["+nodeId_+"]", getReloadSwapBytes()));
106 setExpires(global_.getProperty().getTimestampProperty(prefix+"expires["+nodeId_+"]", getExpires()));
107 setOnOverflow(global_.getProperty().getStringProperty(prefix+"onOverflow["+nodeId_+"]", getOnOverflow()));
108 setOnFailure(global_.getProperty().getStringProperty(prefix+"onFailure["+nodeId_+"]", getOnFailure()));
109 setType(global_.getProperty().getStringProperty(prefix+"type["+nodeId_+"]", getType()));
110 setVersion(global_.getProperty().getStringProperty(prefix+"version["+nodeId_+"]", getVersion()));
111 }
112 if (log_.trace()) log_.trace(ME, string("::initialized to: ") + toXml());
113 }
114
115 /*
116 void QueuePropertyBase::initialize()
117 {
118 // Do we need this range settings?
119 setMinExpires(global_.getProperty().getTimestampProperty("queue/expires.min", DEFAULT_minExpires));
120 setMaxExpires(global_.getProperty().getTimestampProperty("queue/expires.max", DEFAULT_maxExpires)); // Long.MAX_VALUE);
121 if (nodeId_ != "") {
122 setMinExpires(global_.getProperty().getTimestampProperty(string("queue/expires.min[")+nodeId_+string("]"), getMinExpires()));
123 setMaxExpires(global_.getProperty().getTimestampProperty(string("queue/expires.max[")+nodeId_+string("]"), getMaxExpires())); // Long.MAX_VALUE);
124 }
125
126 // PluginInfo pluginInfo = new PluginInfo(glob, null, global_.getProperty().get("queue/defaultPlugin", DEFAULT_type));
127 // DEFAULT_type = pluginInfo.getType();
128 // DEFAULT_version = pluginInfo.getVersion();
129 }
130 */
131
132
133 QueuePropertyBase::QueuePropertyBase(Global& global, const string& nodeId)
134 : ME("QueuePropertyBase"),
135 global_(global),
136 log_(global.getLog("org.xmlBlaster.util.qos")),
137 type_(DEFAULT_type),
138 version_(DEFAULT_version),
139 minExpires_(DEFAULT_minExpires),
140 maxExpires_(DEFAULT_minExpires),
141 relating_(Constants::RELATING_CALLBACK),
142 expires_(DEFAULT_expires),
143 maxEntries_(DEFAULT_maxEntriesDefault),
144 maxBytes_(DEFAULT_bytesDefault),
145 maxEntriesCache_(DEFAULT_maxEntriesCacheDefault),
146 storeSwapLevel_(0),
147 storeSwapBytes_(0),
148 reloadSwapLevel_(0),
149 reloadSwapBytes_(0),
150 maxBytesCache_(DEFAULT_bytesCacheDefault),
151 onOverflow_(Constants::ONOVERFLOW_DEADMESSAGE),
152 onFailure_(Constants::ONOVERFLOW_DEADMESSAGE),
153 addressArr_(),
154 nodeId_(nodeId),
155 propertyPrefix_(""),
156 rootTagName_("queue")
157 {
158 }
159
160 QueuePropertyBase::QueuePropertyBase(const QueuePropertyBase& prop)
161 : ME("QueuePropertyBase"), global_(prop.global_), log_(prop.log_)
162 {
163 copy(prop);
164 }
165
166 QueuePropertyBase&
167 QueuePropertyBase::operator =(const QueuePropertyBase& prop)
168 {
169 copy(prop);
170 return *this;
171 }
172
173
174 QueuePropertyBase::~QueuePropertyBase()
175 {
176 addressArr_.clear();
177 // delete all entries of the address vector since they are pointers
178 // owned by this object.
179 // cleanupAddresses();
180 }
181
182 /**
183 * @param relating To what is this queue related: Constants.RELATING_CALLBACK | Constants.RELATING_SUBJECT | Constants.RELATING_CLIENT
184 */
185 void QueuePropertyBase::setRelating(const string& relating)
186 {
187 if (Constants::RELATING_CALLBACK == relating)
188 relating_ = Constants::RELATING_CALLBACK;
189 else if (Constants::RELATING_SUBJECT == relating)
190 relating_ = Constants::RELATING_SUBJECT;
191 else if (Constants::RELATING_CLIENT == relating)
192 relating_ = Constants::RELATING_CLIENT;
193 else if (Constants::RELATING_HISTORY == relating)
194 relating_ = Constants::RELATING_HISTORY;
195 else if (Constants::RELATING_MSGUNITSTORE == relating)
196 relating_ = Constants::RELATING_MSGUNITSTORE;
197 else if (Constants::RELATING_TOPICSTORE == relating)
198 relating_ = Constants::RELATING_TOPICSTORE;
199 else {
200 log_.warn(ME, string("Ignoring relating=") + relating);
201 }
202 }
203
204 /**
205 * Returns the queue type.
206 * @return relating To what is this queue related: Constants.RELATING_CALLBACK | Constants.RELATING_SUBJECT
207 */
208 string QueuePropertyBase::getRelating() const
209 {
210 return relating_;
211 }
212
213 /**
214 * Span of life of this queue.
215 * @return Expiry time in milliseconds or 0L if forever
216 */
217 Timestamp QueuePropertyBase::getExpires() const
218 {
219 return expires_;
220 }
221
222 /**
223 * Span of life of this queue.
224 * @param Expiry time in milliseconds
225 */
226 void QueuePropertyBase::setExpires(Timestamp expires)
227 {
228 if (maxExpires_ <= 0) expires_ = expires;
229 else if ( (expires>0) && (maxExpires_>0) && (expires>maxExpires_) )
230 expires_ = maxExpires_;
231 else if ( (expires<=0) && (maxExpires_>0) )
232 expires_ = maxExpires_;
233
234 if ( (expires>0) && (expires<minExpires_) )
235 expires_ = minExpires_;
236 }
237
238
239 /**
240 * Max number of messages for this queue.
241 * <br />
242 * @return number of messages
243 */
244 long QueuePropertyBase::getMaxEntries() const
245 {
246 return maxEntries_;
247 }
248
249 /**
250 * Max number of messages for this queue.
251 * <br />
252 * @param maxEntries
253 */
254 void QueuePropertyBase::setMaxEntries(long maxEntries)
255 {
256 maxEntries_ = maxEntries;
257 }
258
259
260 /**
261 * The plugin type.
262 * <br />
263 * @return e.g. "CACHE"
264 */
265 string QueuePropertyBase::getType() const
266 {
267 return type_;
268 }
269
270 /**
271 * The plugin type
272 * <br />
273 * @param type
274 */
275 void QueuePropertyBase::setType(const string& type)
276 {
277 type_ = type;
278 }
279
280 /**
281 * The plugin version.
282 * <br />
283 * @return e.g. "1.0"
284 */
285 string QueuePropertyBase::getVersion() const
286 {
287 return version_;
288 }
289
290 /**
291 * The plugin version
292 * <br />
293 * @param version
294 */
295 void QueuePropertyBase::setVersion(const string& version)
296 {
297 version_ = version;
298 }
299
300 /**
301 * Max number of messages for the cache of this queue.
302 * <br />
303 * @return number of messages
304 */
305 long QueuePropertyBase::getMaxEntriesCache() const
306 {
307 return maxEntriesCache_;
308 }
309
310 /**
311 * Max number of messages for the cache of this queue.
312 * <br />
313 * @param maxEntries
314 */
315 void QueuePropertyBase::setMaxEntriesCache(long maxEntriesCache)
316 {
317 maxEntriesCache_ = maxEntriesCache;
318 }
319
320
321 /**
322 * Max message queue size.
323 * <br />
324 * @return Get max. message queue size in Bytes
325 */
326 long QueuePropertyBase::getMaxBytes() const
327 {
328 return maxBytes_;
329 }
330
331 /**
332 * Max message queue size.
333 * <br />
334 * @return Set max. message queue size in Bytes
335 */
336 void QueuePropertyBase::setMaxBytes(long maxBytes)
337 {
338 maxBytes_ = maxBytes;
339 }
340
341
342 /**
343 * Max message queue size for the cache of this queue.
344 * <br />
345 * @return Get max. message queue size in Bytes
346 */
347 long QueuePropertyBase::getMaxBytesCache() const
348 {
349 return maxBytesCache_;
350 }
351
352
353 /**
354 * Gets the storeSwapLevel for the queue (only used on cache queues).
355 * <br />
356 * @return Get storeSwapLevel in bytes.
357 */
358 long QueuePropertyBase::getStoreSwapLevel() const
359 {
360 return storeSwapLevel_;
361 }
362
363 /**
364 * Sets the storeSwapLevel for the queue (only used on cache queues).
365 * <br />
366 * @param Set storeSwapLevel in bytes.
367 */
368 void QueuePropertyBase::setStoreSwapLevel(long storeSwapLevel)
369 {
370 storeSwapLevel_ = storeSwapLevel;
371 }
372
373 /**
374 * Gets the storeSwapBytes for the queue (only used on cache queues).
375 * <br />
376 * @return Get storeSwapBytes in bytes.
377 */
378 long QueuePropertyBase::getStoreSwapBytes() const
379 {
380 return storeSwapBytes_;
381 }
382
383 /**
384 * Sets the storeSwapBytes for the queue (only used on cache queues).
385 * <br />
386 * @param Set storeSwapBytes in bytes.
387 */
388 void QueuePropertyBase::setStoreSwapBytes(long storeSwapBytes)
389 {
390 storeSwapBytes_ = storeSwapBytes;
391 }
392
393 /**
394 * Gets the reloadSwapLevel for the queue (only used on cache queues).
395 * <br />
396 * @return Get reloadSwapLevel in bytes.
397 */
398 long QueuePropertyBase::getReloadSwapLevel() const
399 {
400 return reloadSwapLevel_;
401 }
402
403 /**
404 * Sets the reloadSwapLevel for the queue (only used on cache queues).
405 * <br />
406 * @param Set reloadSwapLevel in bytes.
407 */
408 void QueuePropertyBase::setReloadSwapLevel(long reloadSwapLevel)
409 {
410 reloadSwapLevel_ = reloadSwapLevel;
411 }
412
413 /**
414 * Gets the reloadSwapBytes for the queue (only used on cache queues).
415 * <br />
416 * @return Get reloadSwapBytes in bytes.
417 */
418 long QueuePropertyBase::getReloadSwapBytes() const
419 {
420 return reloadSwapBytes_;
421 }
422
423 /**
424 * Sets the reloadSwapBytes for the queue (only used on cache queues).
425 * <br />
426 * @param Set reloadSwapBytes in bytes.
427 */
428 void QueuePropertyBase::setReloadSwapBytes(long reloadSwapBytes)
429 {
430 reloadSwapBytes_ = reloadSwapBytes;
431 }
432
433 /**
434 * Max message queue size for the cache of this queue.
435 * <br />
436 * @return Set max. message queue size in Bytes
437 */
438 void QueuePropertyBase::setMaxBytesCache(long maxBytesCache)
439 {
440 maxBytesCache_ = maxBytesCache;
441 }
442
443
444 /**
445 * Set the callback onOverflow, it should fit to the protocol-relating.
446 *
447 * @param onOverflow The callback onOverflow, e.g. "et@mars.univers"
448 */
449 void QueuePropertyBase::setOnOverflow(const string& onOverflow)
450 {
451 /*
452 if (Constants.ONOVERFLOW_BLOCK.equalsIgnoreCase(onOverflow)) {
453 this.onOverflow = Constants.ONOVERFLOW_BLOCK;
454 }
455 */
456 if (Constants::ONOVERFLOW_DEADMESSAGE == onOverflow) {
457 onOverflow_ = Constants::ONOVERFLOW_DEADMESSAGE;
458 }
459 else if (Constants::ONOVERFLOW_DISCARDOLDEST == onOverflow) {
460 onOverflow_ = Constants::ONOVERFLOW_DISCARDOLDEST;
461
462 onOverflow_ = Constants::ONOVERFLOW_DEADMESSAGE; // TODO !!!
463 log_.error(ME, string("queue onOverflow='") + string(Constants::ONOVERFLOW_DISCARDOLDEST) + string("' is not implemented, switching to ") + onOverflow_ + string(" mode"));
464 }
465 else {
466 onOverflow_ = Constants::ONOVERFLOW_DEADMESSAGE;
467 log_.warn(ME, string("The queue onOverflow attribute is invalid '") + onOverflow + string("', setting to '") + onOverflow_ + string("'"));
468 }
469 }
470
471 /**
472 * Returns the onOverflow.
473 * @return e.g. "IOR:00001100022...." or "et@universe.com"
474 */
475 string QueuePropertyBase::getOnOverflow() const
476 {
477 return onOverflow_;
478 }
479
480 /*
481 * The default mode, when queue is full the publisher blocks until
482 * there is space again.
483 public final boolean onOverflowBlock() {
484 if (Constants.ONOVERFLOW_BLOCK.equalsIgnoreCase(getOnOverflow()))
485 return true;
486 return false;
487 }
488 */
489
490 /**
491 * Set the callback onFailure, it should fit to the protocol-relating.
492 *
493 * @param onFailure The callback onFailure, e.g. "et@mars.univers"
494 */
495 void QueuePropertyBase::setOnFailure(const string& onFailure)
496 {
497 if (Constants::ONOVERFLOW_DEADMESSAGE == onFailure)
498 onFailure_ = Constants::ONOVERFLOW_DEADMESSAGE;
499 else {
500 log_.warn(ME, string("The queue onFailure attribute is invalid '") + onFailure + string("', setting to 'deadMessage'"));
501 onFailure_ = Constants::ONOVERFLOW_DEADMESSAGE;
502 }
503 }
504
505 /**
506 * Returns the onFailure.
507 * @return e.g. "IOR:00001100022...." or "et@universe.com"
508 */
509 string QueuePropertyBase::getOnFailure() const
510 {
511 return onFailure_;
512 }
513
514 /**
515 * The default mode is to send a dead letter if callback fails permanently
516 */
517 bool QueuePropertyBase::onFailureDeadMessage()
518 {
519 if (Constants::ONOVERFLOW_DEADMESSAGE == getOnFailure())
520 return true;
521 return false;
522 }
523
524 /**
525 * Access the reference counted addresses.
526 * @return null if none available
527 */
528 AddressVector QueuePropertyBase::getAddresses() const
529 {
530 return addressArr_;
531 }
532
533 /**
534 * Dump state of this object into a XML ASCII string.
535 * <br>
536 * @param extraOffset indenting of tags for nice output
537 * @return The xml representation
538 */
539 string QueuePropertyBase::toXml(const string& extraOffset) const
540 {
541 string offset = Constants::OFFSET + extraOffset;
542 string ret;
543 ret += offset + string("<!-- QueuePropertyBase -->");
544
545 ret += offset + string("<queue relating='") + getRelating();
546 if (DEFAULT_type != getType())
547 ret += string("' type='") + getType();
548 if (DEFAULT_version != getVersion())
549 ret += string("' version='") + getVersion();
550 if (DEFAULT_maxEntriesDefault != getMaxEntries())
551 ret += string("' maxEntries='") + lexical_cast<std::string>(getMaxEntries());
552 if (DEFAULT_maxEntriesCacheDefault != getMaxEntriesCache())
553 ret += string("' maxEntriesCache='") + lexical_cast<std::string>(getMaxEntriesCache());
554 if (DEFAULT_bytesDefault != getMaxBytes())
555 ret += string("' maxBytes='") + lexical_cast<std::string>(getMaxBytes());
556 if (DEFAULT_bytesCacheDefault != getMaxBytesCache())
557 ret += string("' maxBytesCache='") + lexical_cast<std::string>(getMaxBytesCache());
558 ret += string("' storeSwapLevel='") + lexical_cast<std::string>(getStoreSwapLevel());
559 ret += string("' storeSwapBytes='") + lexical_cast<std::string>(getStoreSwapBytes());
560 ret += string("' reloadSwapLevel='") + lexical_cast<std::string>(getReloadSwapLevel());
561 ret += string("' reloadSwapBytes='") + lexical_cast<std::string>(getReloadSwapBytes());
562 if (DEFAULT_expires != getExpires())
563 ret += string("' expires='") + lexical_cast<std::string>(getExpires());
564 if (DEFAULT_onOverflow != getOnOverflow())
565 ret += string("' onOverflow='") + getOnOverflow();
566 if (DEFAULT_onFailure != getOnFailure())
567 ret += string("' onFailure='") + getOnFailure();
568
569 if (!addressArr_.empty()) {
570 ret += string("'>");
571 AddressVector::const_iterator iter = addressArr_.begin();
572 while (iter != addressArr_.end()) {
573 ret += (*iter)->toXml(extraOffset + Constants::INDENT);
574 iter++;
575 }
576 ret += offset + string("</queue>");
577
578 }
579 else
580 ret += string("'/>");
581 return ret;
582 }
583
584 /**
585 * returns the global object
586 */
587 Global& QueuePropertyBase::getGlobal()
588 {
589 return global_;
590 }
591
592 /*
593 void QueuePropertyBase::cleanupAddresses()
594 {
595 AddressVector::iterator iter = addressArr_.begin();
596 while (iter != addressArr_.end()) {
597 AddressBase* el = *iter;
598 addressArr_.erase(iter);
599 delete el;
600 iter = addressArr_.begin();
601 }
602 }
603 */
604
605 string QueuePropertyBase::getPropertyPrefix() const
606 {
607 return propertyPrefix_;
608 }
609
610 void QueuePropertyBase::setpropertyPrefix(const string& prefix)
611 {
612 propertyPrefix_ = prefix;
613 }
614
615 /**
616 * The command line prefix to configure the queue or msgUnitStore
617 * @return e.g. "queue/history/" or "persistence/msgUnitStore/"
618 */
619 string QueuePropertyBase::getPrefix()
620 {
621 return (propertyPrefix_.length() > 0) ?
622 getRootTagName()+"/"+propertyPrefix_+"/" :
623 getRootTagName()+"/";
624 }
625
626 /**
627 * Helper for logging output, creates the property key for configuration (the command line property).
628 * @param prop e.g. "maxEntries"
629 * @return e.g. "-queue/history/maxEntries" or "-queue/history/maxEntriesCache" or "-persistence/msgUnitStore/maxEntries"
630 */
631 string QueuePropertyBase::getPropName(const string& token)
632 {
633 return "-" + getPrefix() + token;
634 }
635
636 string QueuePropertyBase::getRootTagName() const
637 {
638 return rootTagName_;
639 }
640
641
642 }}}}} // namespaces
syntax highlighted by Code2HTML, v. 0.9.1