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 #ifndef _ACTIVEMQ_CMSUTIL_CMSACCESSOR_H_ 00018 #define _ACTIVEMQ_CMSUTIL_CMSACCESSOR_H_ 00019 00020 #include <cms/ConnectionFactory.h> 00021 #include <activemq/cmsutil/ResourceLifecycleManager.h> 00022 #include <activemq/util/Config.h> 00023 00024 namespace activemq { 00025 namespace cmsutil { 00026 00039 class AMQCPP_API CmsAccessor { 00040 private: 00041 00042 ResourceLifecycleManager resourceLifecycleManager; 00043 00044 cms::ConnectionFactory* connectionFactory; 00045 00046 cms::Session::AcknowledgeMode sessionAcknowledgeMode; 00047 00048 protected: 00049 00050 CmsAccessor(const CmsAccessor&); 00051 CmsAccessor& operator=(const CmsAccessor&); 00052 00053 public: 00054 00055 CmsAccessor(); 00056 00057 virtual ~CmsAccessor(); 00058 00059 virtual ResourceLifecycleManager* getResourceLifecycleManager() { 00060 return &resourceLifecycleManager; 00061 } 00062 00063 virtual const ResourceLifecycleManager* getResourceLifecycleManager() const { 00064 return &resourceLifecycleManager; 00065 } 00066 00070 virtual void setConnectionFactory(cms::ConnectionFactory* connectionFactory) { 00071 this->connectionFactory = connectionFactory; 00072 } 00073 00078 virtual const cms::ConnectionFactory* getConnectionFactory() const { 00079 return this->connectionFactory; 00080 } 00081 00086 virtual cms::ConnectionFactory* getConnectionFactory() { 00087 return this->connectionFactory; 00088 } 00089 00098 virtual void setSessionAcknowledgeMode(cms::Session::AcknowledgeMode sessionAcknowledgeMode) { 00099 this->sessionAcknowledgeMode = sessionAcknowledgeMode; 00100 } 00101 00107 virtual cms::Session::AcknowledgeMode getSessionAcknowledgeMode() const { 00108 return this->sessionAcknowledgeMode; 00109 } 00110 00111 protected: 00112 00120 virtual void init(); 00121 00128 virtual void destroy() { 00129 resourceLifecycleManager.destroy(); 00130 } 00131 00140 virtual cms::Connection* createConnection(); 00141 00153 virtual cms::Session* createSession(cms::Connection* con); 00154 00160 virtual void checkConnectionFactory(); 00161 00162 }; 00163 00164 }} 00165 00166 #endif /* _ACTIVEMQ_CMSUTIL_CMSACCESSOR_H_ */
1.6.1