001/* 002 * Copyright 2012-2016 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.boot.autoconfigure.cassandra; 018 019import com.datastax.driver.core.ConsistencyLevel; 020import com.datastax.driver.core.ProtocolOptions; 021import com.datastax.driver.core.ProtocolOptions.Compression; 022import com.datastax.driver.core.QueryOptions; 023import com.datastax.driver.core.SocketOptions; 024import com.datastax.driver.core.policies.LoadBalancingPolicy; 025import com.datastax.driver.core.policies.ReconnectionPolicy; 026import com.datastax.driver.core.policies.RetryPolicy; 027 028import org.springframework.boot.context.properties.ConfigurationProperties; 029 030/** 031 * Configuration properties for Cassandra. 032 * 033 * @author Julien Dubois 034 * @author Phillip Webb 035 * @author Mark Paluch 036 * @since 1.3.0 037 */ 038@ConfigurationProperties(prefix = "spring.data.cassandra") 039public class CassandraProperties { 040 041 /** 042 * Keyspace name to use. 043 */ 044 private String keyspaceName; 045 046 /** 047 * Name of the Cassandra cluster. 048 */ 049 private String clusterName; 050 051 /** 052 * Comma-separated list of cluster node addresses. 053 */ 054 private String contactPoints = "localhost"; 055 056 /** 057 * Port of the Cassandra server. 058 */ 059 private int port = ProtocolOptions.DEFAULT_PORT; 060 061 /** 062 * Login user of the server. 063 */ 064 private String username; 065 066 /** 067 * Login password of the server. 068 */ 069 private String password; 070 071 /** 072 * Compression supported by the Cassandra binary protocol. 073 */ 074 private Compression compression = Compression.NONE; 075 076 /** 077 * Class name of the load balancing policy. 078 */ 079 private Class<? extends LoadBalancingPolicy> loadBalancingPolicy; 080 081 /** 082 * Queries consistency level. 083 */ 084 private ConsistencyLevel consistencyLevel; 085 086 /** 087 * Queries serial consistency level. 088 */ 089 private ConsistencyLevel serialConsistencyLevel; 090 091 /** 092 * Queries default fetch size. 093 */ 094 private int fetchSize = QueryOptions.DEFAULT_FETCH_SIZE; 095 096 /** 097 * Reconnection policy class. 098 */ 099 private Class<? extends ReconnectionPolicy> reconnectionPolicy; 100 101 /** 102 * Class name of the retry policy. 103 */ 104 private Class<? extends RetryPolicy> retryPolicy; 105 106 /** 107 * Socket option: connection time out. 108 */ 109 private int connectTimeoutMillis = SocketOptions.DEFAULT_CONNECT_TIMEOUT_MILLIS; 110 111 /** 112 * Socket option: read time out. 113 */ 114 private int readTimeoutMillis = SocketOptions.DEFAULT_READ_TIMEOUT_MILLIS; 115 116 /** 117 * Schema action to take at startup. 118 */ 119 private String schemaAction = "none"; 120 121 /** 122 * Enable SSL support. 123 */ 124 private boolean ssl = false; 125 126 public String getKeyspaceName() { 127 return this.keyspaceName; 128 } 129 130 public void setKeyspaceName(String keyspaceName) { 131 this.keyspaceName = keyspaceName; 132 } 133 134 public String getClusterName() { 135 return this.clusterName; 136 } 137 138 public void setClusterName(String clusterName) { 139 this.clusterName = clusterName; 140 } 141 142 public String getContactPoints() { 143 return this.contactPoints; 144 } 145 146 public void setContactPoints(String contactPoints) { 147 this.contactPoints = contactPoints; 148 } 149 150 public int getPort() { 151 return this.port; 152 } 153 154 public void setPort(int port) { 155 this.port = port; 156 } 157 158 public String getUsername() { 159 return this.username; 160 } 161 162 public void setUsername(String username) { 163 this.username = username; 164 } 165 166 public String getPassword() { 167 return this.password; 168 } 169 170 public void setPassword(String password) { 171 this.password = password; 172 } 173 174 public Compression getCompression() { 175 return this.compression; 176 } 177 178 public void setCompression(Compression compression) { 179 this.compression = compression; 180 } 181 182 public Class<? extends LoadBalancingPolicy> getLoadBalancingPolicy() { 183 return this.loadBalancingPolicy; 184 } 185 186 public void setLoadBalancingPolicy( 187 Class<? extends LoadBalancingPolicy> loadBalancingPolicy) { 188 this.loadBalancingPolicy = loadBalancingPolicy; 189 } 190 191 public ConsistencyLevel getConsistencyLevel() { 192 return this.consistencyLevel; 193 } 194 195 public void setConsistencyLevel(ConsistencyLevel consistency) { 196 this.consistencyLevel = consistency; 197 } 198 199 public ConsistencyLevel getSerialConsistencyLevel() { 200 return this.serialConsistencyLevel; 201 } 202 203 public void setSerialConsistencyLevel(ConsistencyLevel serialConsistency) { 204 this.serialConsistencyLevel = serialConsistency; 205 } 206 207 public int getFetchSize() { 208 return this.fetchSize; 209 } 210 211 public void setFetchSize(int fetchSize) { 212 this.fetchSize = fetchSize; 213 } 214 215 public Class<? extends ReconnectionPolicy> getReconnectionPolicy() { 216 return this.reconnectionPolicy; 217 } 218 219 public void setReconnectionPolicy( 220 Class<? extends ReconnectionPolicy> reconnectionPolicy) { 221 this.reconnectionPolicy = reconnectionPolicy; 222 } 223 224 public Class<? extends RetryPolicy> getRetryPolicy() { 225 return this.retryPolicy; 226 } 227 228 public void setRetryPolicy(Class<? extends RetryPolicy> retryPolicy) { 229 this.retryPolicy = retryPolicy; 230 } 231 232 public int getConnectTimeoutMillis() { 233 return this.connectTimeoutMillis; 234 } 235 236 public void setConnectTimeoutMillis(int connectTimeoutMillis) { 237 this.connectTimeoutMillis = connectTimeoutMillis; 238 } 239 240 public int getReadTimeoutMillis() { 241 return this.readTimeoutMillis; 242 } 243 244 public void setReadTimeoutMillis(int readTimeoutMillis) { 245 this.readTimeoutMillis = readTimeoutMillis; 246 } 247 248 public boolean isSsl() { 249 return this.ssl; 250 } 251 252 public void setSsl(boolean ssl) { 253 this.ssl = ssl; 254 } 255 256 public String getSchemaAction() { 257 return this.schemaAction; 258 } 259 260 public void setSchemaAction(String schemaAction) { 261 this.schemaAction = schemaAction; 262 } 263 264}