1 #ifndef ISPN_HOTROD_CONFIGURATION_CONFIGURATIONBUILDER_H 2 #define ISPN_HOTROD_CONFIGURATION_CONFIGURATIONBUILDER_H 46 std::vector<ServerConfigurationBuilder>& servers;
73 this->m_maxEntries = maxEntries;
103 unsigned int m_maxEntries=0;
115 m_connectionTimeout(60000),
116 m_forceReturnValue(false),
117 m_keySizeEstimate(64),
119 m_socketTimeout(60000),
121 m_valueSizeEstimate(512),
123 m_balancingStrategyProducer(nullptr),
125 connectionPoolConfigurationBuilder(*this),
127 securityConfigurationBuilder(*this),
128 nearCacheConfigurationBuilder(*this)
157 return servers[servers.size() - 1];
168 std::istringstream originalStream(servers);
169 std::string stringHelper;
170 std::string hostHelper;
171 std::string portHelper;
175 while(std::getline(originalStream,stringHelper,
';')) {
176 std::istringstream singleServerStream(stringHelper);
177 std::getline(singleServerStream,hostHelper,
':');
178 std::getline(singleServerStream,portHelper,
':');
179 std::istringstream portStream(portHelper);
180 portStream >> portInt;
181 addServer().host(hostHelper).port(portInt);
193 return connectionPoolConfigurationBuilder;
202 m_connectionTimeout = connectionTimeout_;
213 m_forceReturnValue = forceReturnValues_;
223 m_keySizeEstimate = keySizeEstimate_;
235 m_protocolVersion = protocolVersion_;
246 m_socketTimeout = socketTimeout_;
256 return securityConfigurationBuilder.getSslConfigurationBuilder();
265 return nearCacheConfigurationBuilder;
274 m_tcpNoDelay = tcpNoDelay_;
284 m_valueSizeEstimate = valueSizeEstimate_;
295 m_maxRetries = maxRetries_;
300 m_balancingStrategyProducer = bsp;
321 std::map<std::string,std::vector<ServerConfiguration>> serversMap;
322 for (
auto p: m_serversMap)
324 std::vector<ServerConfiguration> scVec;
325 for (
auto e : p.second)
327 scVec.push_back(e.create());
329 serversMap.insert(std::make_pair(p.first, scVec));
331 if (serversMap.size()==0)
333 std::vector<ServerConfiguration> scVec;
339 connectionPoolConfigurationBuilder.create(),
345 securityConfigurationBuilder.create(),
349 nearCacheConfigurationBuilder.create(),
350 m_balancingStrategyProducer,
381 return securityConfigurationBuilder;
384 int m_connectionTimeout;
385 bool m_forceReturnValue;
386 int m_keySizeEstimate;
387 std::string m_protocolVersion;
388 std::map<std::string,std::vector<ServerConfigurationBuilder> >m_serversMap;
391 int m_valueSizeEstimate;
392 unsigned int m_maxRetries;
396 JBasicEventMarshaller m_defaultEventMarshaller;
399 EventMarshaller &m_eventMarshaller=m_defaultEventMarshaller;
404 #endif // ISPN_HOTROD_CONFIGURATION_CONFIGURATIONBUILDER_H ConfigurationBuilder & addServers(std::string servers)
Definition: ConfigurationBuilder.h:167
ConnectionPoolConfigurationBuilder & connectionPool()
Definition: ConfigurationBuilder.h:192
HR_EXTERN const event::EventMarshaller & getEventMarshaller() const
ConfigurationBuilder & keySizeEstimate(int keySizeEstimate_)
Definition: ConfigurationBuilder.h:222
HR_EXTERN const int & getSocketTimeout() const
void validate()
Definition: ConfigurationBuilder.h:131
NearCacheConfiguration create()
Definition: ConfigurationBuilder.h:96
HR_EXTERN const int & getValueSizeEstimate() const
NearCacheConfigurationBuilder & maxEntries(unsigned int maxEntries=0)
Definition: ConfigurationBuilder.h:72
ConfigurationBuilder()
Definition: ConfigurationBuilder.h:114
ConfigurationBuilder & valueSizeEstimate(int valueSizeEstimate_)
Definition: ConfigurationBuilder.h:283
ConfigurationBuilder & maxRetries(int maxRetries_)
Definition: ConfigurationBuilder.h:294
NearCacheConfigurationBuilder(ConfigurationBuilder &_builder)
Definition: ConfigurationBuilder.h:56
Definition: NearCacheConfiguration.h:32
ServerConfigurationBuilder & addServer()
Definition: ConfigurationBuilder.h:150
Definition: CacheClientListener.h:30
HR_EXTERN const int & getKeySizeEstimate() const
Definition: SecurityConfigurationBuilder.h:19
Definition: ConnectionPoolConfigurationBuilder.h:15
Definition: ConfigurationBuilder.h:53
Definition: NearCacheConfiguration.h:21
ConfigurationBuilder & socketTimeout(int socketTimeout_)
Definition: ConfigurationBuilder.h:245
Definition: SslConfigurationBuilder.h:12
Definition: AuthenticationConfiguration.h:10
HR_EXTERN const int & getMaxRetries() const
NearCacheMode
Definition: NearCacheConfiguration.h:20
ConfigurationBuilder & balancingStrategyProducer(FailOverRequestBalancingStrategy::ProducerFn bsp)
Definition: ConfigurationBuilder.h:299
Definition: ServerConfigurationBuilder.h:25
HR_EXTERN const bool & isForceReturnValue() const
Definition: ConfigurationBuilder.h:28
virtual ServerConfiguration create()
Definition: ServerConfigurationBuilder.h:62
ConfigurationBuilder & forceReturnValues(bool forceReturnValues_)
Definition: ConfigurationBuilder.h:212
HR_EXTERN const int & getConnectionTimeout() const
Definition: Configuration.h:28
FailOverRequestBalancingStrategy *(* ProducerFn)()
Definition: FailOverRequestBalancingStrategy.h:19
Configuration create()
Definition: ConfigurationBuilder.h:320
HR_EXTERN const char * getProtocolVersionCString() const
#define __pragma(...)
Definition: defs.h:106
int getMaxEntries() const
Definition: ConfigurationBuilder.h:61
NearCacheConfigurationBuilder & mode(NearCacheMode mode=DISABLED)
Definition: ConfigurationBuilder.h:91
NearCacheConfigurationBuilder & nearCache()
Definition: ConfigurationBuilder.h:264
Definition: ConfigurationBuilder.h:111
HR_EXTERN const bool & isTcpNoDelay() const
Definition: ConfigurationChildBuilder.h:18
NearCacheMode getMode() const
Definition: ConfigurationBuilder.h:80
static HR_EXTERN const char * DEFAULT_CLUSTER_NAME
Definition: Configuration.h:42
Configuration build()
Definition: ConfigurationBuilder.h:310
ConfigurationBuilder & protocolVersion(const std::string &protocolVersion_)
Definition: ConfigurationBuilder.h:234
SslConfigurationBuilder & ssl()
Definition: ConfigurationBuilder.h:255
SecurityConfigurationBuilder & security()
Definition: ConfigurationBuilder.h:379
ConfigurationBuilder & read(Configuration &configuration)
Definition: ConfigurationBuilder.h:361
ClusterConfigurationBuilder(std::vector< ServerConfigurationBuilder > &servers, ConfigurationBuilder &parent)
Definition: ConfigurationBuilder.h:31
ConfigurationBuilder & tcpNoDelay(bool tcpNoDelay_)
Definition: ConfigurationBuilder.h:273
ConfigurationBuilder & connectionTimeout(int connectionTimeout_)
Definition: ConfigurationBuilder.h:201
ClusterConfigurationBuilder addCluster(const std::string &clusterName)
Definition: ConfigurationBuilder.h:140
ClusterConfigurationBuilder & addClusterNode(const std::string host, const int port)
Definition: ConfigurationBuilder.h:40