Hazelcast C++ Client
 All Classes Functions Variables Enumerations Pages
ClientConfig.h
1 /*
2  * Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef HAZELCAST_CLIENT_CONFIG
17 #define HAZELCAST_CLIENT_CONFIG
18 
19 #include "hazelcast/client/Address.h"
20 #include "hazelcast/client/GroupConfig.h"
21 #include "hazelcast/client/SerializationConfig.h"
22 #include "hazelcast/client/Credentials.h"
23 #include "hazelcast/client/SocketInterceptor.h"
24 #include "hazelcast/client/LoadBalancer.h"
25 #include "hazelcast/client/impl/RoundRobinLB.h"
26 #include "hazelcast/util/ILogger.h"
27 #include <vector>
28 #include <set>
29 #include <memory>
30 
31 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
32 #pragma warning(push)
33 #pragma warning(disable: 4251) //for dll export
34 #endif
35 
36 namespace hazelcast {
37  namespace client {
38  class MembershipListener;
39 
40  class InitialMembershipListener;
41 
42  class LifecycleListener;
43 
47  class HAZELCAST_API ClientConfig {
48  public:
49 
59  ClientConfig();
60 
68  ClientConfig& addAddress(const Address& address);
69 
77  ClientConfig& addAddresses(const std::vector<Address>& addresses);
78 
85  std::set<Address, addressComparator>& getAddresses();
86 
94  ClientConfig& setGroupConfig(GroupConfig& groupConfig);
95 
100  GroupConfig& getGroupConfig();
101 
107  ClientConfig& setCredentials(Credentials *credentials);
108 
112  const Credentials *getCredentials();
113 
122  ClientConfig& setConnectionAttemptLimit(int connectionAttemptLimit);
123 
131  int getConnectionAttemptLimit() const;
132 
139  ClientConfig& setConnectionTimeout(int connectionTimeoutInMillis);
140 
146  int getConnectionTimeout() const;
147 
154  ClientConfig& setAttemptPeriod(int attemptPeriodInMillis);
155 
161  int getAttemptPeriod() const;
162 
174  ClientConfig& setRedoOperation(bool redoOperation);
175 
181  bool isRedoOperation() const;
182 
187  bool isSmart() const;
188 
199  ClientConfig& setSmart(bool smart);
200 
206  ClientConfig& setSocketInterceptor(SocketInterceptor *socketInterceptor);
207 
211  SocketInterceptor* getSocketInterceptor();
212 
223  ClientConfig& addListener(LifecycleListener *listener);
224 
229  const std::set<LifecycleListener *>& getLifecycleListeners() const;
230 
241  ClientConfig& addListener(MembershipListener *listener);
242 
248  const std::set<MembershipListener *>& getMembershipListeners() const;
249 
256  ClientConfig& addListener(InitialMembershipListener *listener);
257 
263  const std::set<InitialMembershipListener *>& getInitialMembershipListeners() const;
264 
270  LoadBalancer *const getLoadBalancer();
271 
280  ClientConfig& setLoadBalancer(LoadBalancer *loadBalancer);
281 
291  ClientConfig& setLogLevel(LogLevel loggerLevel);
292 
293 
298  SerializationConfig const& getSerializationConfig() const;
299 
309  ClientConfig& setSerializationConfig(SerializationConfig const& serializationConfig);
310 
316  std::map<std::string, std::string>& getProperties();
317 
327  ClientConfig& setProperty(const std::string& name, const std::string& value);
328 
329  private:
330 
331  GroupConfig groupConfig;
332 
333  SerializationConfig serializationConfig;
334 
335  std::set<Address, addressComparator> addressList;
336 
337  LoadBalancer *loadBalancer;
338 
339  std::auto_ptr<impl::RoundRobinLB> defaultLoadBalancer;
340 
341  std::set<MembershipListener *> membershipListeners;
342 
343  std::set<InitialMembershipListener *> initialMembershipListeners;
344 
345  std::set<LifecycleListener *> lifecycleListeners;
346 
347  std::map<std::string, std::string> properties;
348 
349  bool smart;
350 
351  bool redoOperation;
352 
353  int connectionTimeout;
354 
355  int connectionAttemptLimit;
356 
357  int attemptPeriod;
358 
359  SocketInterceptor *socketInterceptor;
360 
361  Credentials *credentials;
362 
363  std::auto_ptr<Credentials> defaultCredentials;
364 
365  };
366 
367  }
368 }
369 
370 #if defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
371 #pragma warning(pop)
372 #endif
373 
374 #endif /* HAZELCAST_CLIENT_CONFIG */
Credentials is a container object for endpoint (Members and Clients) security attributes.
Definition: Credentials.h:35
Base class for socketInterceptor classes to inherit from.
Definition: SocketInterceptor.h:37
Contains the configuration for Hazelcast groups.
Definition: GroupConfig.h:36
Cluster membership listener.
Definition: MembershipListener.h:51
IP Address.
Definition: Address.h:34
SerializationConfig is used to.
Definition: SerializationConfig.h:44
Listener object for listening lifecycle events of hazelcast instance.
Definition: LifecycleListener.h:44
The InitializingMembershipListener is a MembershipListener that will first receives a InitialMembersh...
Definition: InitialMembershipListener.h:50
LoadBalancer allows you to send operations to one of a number of endpoints(Members).
Definition: LoadBalancer.h:40
HazelcastClient configuration class.
Definition: ClientConfig.h:47