00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one or more 00003 * contributor license agreements. See the NOTICE file distributed with 00004 * this work for additional information regarding copyright ownership. 00005 * The ASF licenses this file to You under the Apache License, Version 2.0 00006 * (the "License"); you may not use this file except in compliance with 00007 * the License. You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #ifndef _ACTIVEMQ_TRANSPORT_FAILOVER_URIPOOL_H_ 00019 #define _ACTIVEMQ_TRANSPORT_FAILOVER_URIPOOL_H_ 00020 00021 #include <activemq/util/Config.h> 00022 00023 #include <decaf/net/URI.h> 00024 #include <decaf/util/LinkedList.h> 00025 #include <decaf/util/NoSuchElementException.h> 00026 00027 namespace activemq { 00028 namespace transport { 00029 namespace failover { 00030 00031 class AMQCPP_API URIPool { 00032 private: 00033 00034 mutable decaf::util::LinkedList<decaf::net::URI> uriPool; 00035 decaf::net::URI priorityURI; 00036 bool randomize; 00037 00038 public: 00039 00043 URIPool(); 00044 00050 URIPool(const decaf::util::List<decaf::net::URI>& uris); 00051 00058 URIPool(const URIPool& uris); 00059 00066 URIPool& operator= (const URIPool& uris); 00067 00068 ~URIPool(); 00069 00075 const decaf::util::List<decaf::net::URI>& getURIList() const { 00076 return this->uriPool; 00077 } 00078 00082 bool isEmpty() const; 00083 00088 const decaf::net::URI& getPriorityURI() const { 00089 return this->priorityURI; 00090 } 00091 00098 void setPriorityURI(const decaf::net::URI& uri) { 00099 this->priorityURI = uri; 00100 } 00101 00112 decaf::net::URI getURI(); 00113 00123 bool addURI(const decaf::net::URI& uri); 00124 00133 bool addURIs(const decaf::util::List<decaf::net::URI>& uris); 00134 00143 bool removeURI(const decaf::net::URI& uri); 00144 00151 bool isRandomize() const { 00152 return this->randomize; 00153 } 00154 00161 void setRandomize(bool value) { 00162 this->randomize = value; 00163 } 00164 00170 bool contains(const decaf::net::URI& uri) const; 00171 00178 bool isPriority(const decaf::net::URI& uri) const; 00179 00183 void clear(); 00184 00190 bool equals(const URIPool& other) const; 00191 00192 }; 00193 00194 }}} 00195 00196 #endif /*_ACTIVEMQ_TRANSPORT_FAILOVER_URIPOOL_H_*/
1.6.1