activemq-cpp-3.6.0
CmsAccessor.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 #ifndef _ACTIVEMQ_CMSUTIL_CMSACCESSOR_H_
18 #define _ACTIVEMQ_CMSUTIL_CMSACCESSOR_H_
19 
20 #include <cms/ConnectionFactory.h>
22 #include <activemq/util/Config.h>
23 
24 namespace activemq {
25 namespace cmsutil {
26 
40  private:
41 
42  ResourceLifecycleManager resourceLifecycleManager;
43 
44  cms::ConnectionFactory* connectionFactory;
45 
46  cms::Session::AcknowledgeMode sessionAcknowledgeMode;
47 
48  protected:
49 
50  CmsAccessor(const CmsAccessor&);
51  CmsAccessor& operator=(const CmsAccessor&);
52 
53  public:
54 
55  CmsAccessor();
56 
57  virtual ~CmsAccessor();
58 
60  return &resourceLifecycleManager;
61  }
62 
64  return &resourceLifecycleManager;
65  }
66 
70  virtual void setConnectionFactory(cms::ConnectionFactory* connectionFactory) {
71  this->connectionFactory = connectionFactory;
72  }
73 
79  return this->connectionFactory;
80  }
81 
87  return this->connectionFactory;
88  }
89 
98  virtual void setSessionAcknowledgeMode(cms::Session::AcknowledgeMode sessionAcknowledgeMode) {
99  this->sessionAcknowledgeMode = sessionAcknowledgeMode;
100  }
101 
108  return this->sessionAcknowledgeMode;
109  }
110 
111  protected:
112 
120  virtual void init();
121 
128  virtual void destroy() {
129  resourceLifecycleManager.destroy();
130  }
131 
140  virtual cms::Connection* createConnection();
141 
153  virtual cms::Session* createSession(cms::Connection* con);
154 
160  virtual void checkConnectionFactory();
161 
162  };
163 
164 }}
165 
166 #endif /* _ACTIVEMQ_CMSUTIL_CMSACCESSOR_H_ */