activemq-cpp-3.4.0

src/main/activemq/util/ActiveMQProperties.h

Go to the documentation of this file.
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_UTIL_ACTIVEMQPROPERTIES_H_
00019 #define _ACTIVEMQ_UTIL_ACTIVEMQPROPERTIES_H_
00020 
00021 #include <map>
00022 #include <string>
00023 #include <sstream>
00024 #include <activemq/util/Config.h>
00025 #include <cms/CMSProperties.h>
00026 #include <decaf/util/Properties.h>
00027 
00028 namespace activemq{
00029 namespace util{
00030 
00037     class AMQCPP_API ActiveMQProperties : public cms::CMSProperties {
00038     private:
00039 
00040         decaf::util::Properties properties;
00041 
00042     public:
00043 
00044         ActiveMQProperties();
00045 
00046         virtual ~ActiveMQProperties() throw();
00047 
00048         virtual decaf::util::Properties& getProperties() {
00049             return this->properties;
00050         }
00051 
00052         virtual const decaf::util::Properties& getProperties() const {
00053             return this->properties;
00054         }
00055 
00056         virtual void setProperties( decaf::util::Properties& props ) {
00057             this->properties = props;
00058         }
00059 
00060         virtual int size() const {
00061             return properties.size();
00062         }
00063 
00064         virtual bool isEmpty() const {
00065             return properties.isEmpty();
00066         }
00067 
00068         virtual const char* getProperty( const std::string& name ) const{
00069             return properties.getProperty(name);
00070         }
00071 
00072         virtual std::string getProperty( const std::string& name,
00073                                          const std::string& defaultValue ) const {
00074             return properties.getProperty( name,defaultValue );
00075         }
00076 
00077         virtual void setProperty( const std::string& name,
00078                                   const std::string& value ){
00079             properties.setProperty( name,value );
00080         }
00081 
00082         virtual bool hasProperty( const std::string& name ) const {
00083             return properties.hasProperty(name);
00084         }
00085 
00086         virtual std::string remove( const std::string& name ){
00087             return properties.remove( name );
00088         }
00089 
00090         virtual std::vector<std::string> propertyNames() const {
00091             return properties.propertyNames();
00092         }
00093 
00094         virtual std::vector< std::pair< std::string, std::string > > toArray() const{
00095             return properties.toArray();
00096         }
00097 
00098         virtual void copy( const CMSProperties* source );
00099 
00100         virtual CMSProperties* clone() const;
00101 
00102         virtual void clear(){
00103             properties.clear();
00104         }
00105 
00106         virtual std::string toString() const {
00107             return properties.toString();
00108         }
00109 
00110     };
00111 
00112 }}
00113 
00114 #endif /*_ACTIVEMQ_UTIL_ACTIVEMQPROPERTIES_H_*/