aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb')
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java43
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java104
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java124
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java92
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java234
5 files changed, 597 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java
new file mode 100644
index 0000000000..2922925171
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbFactoryImpl.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.nosqldb.impl.cassandra;
+
+import com.datastax.driver.core.Session;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
+
+public class CassandraNoSqlDbFactoryImpl extends NoSqlDbFactory {
+
+ @Override
+ public NoSqlDb createInterface() {
+
+
+ return new CassandraNoSqlDbImpl(ReferenceHolder.CASSANDRA);
+ }
+
+ protected void stop() {
+ ReferenceHolder.CASSANDRA.close();
+ }
+
+ private static class ReferenceHolder {
+ private static final Session CASSANDRA = CassandraSessionFactory.getSession();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java
new file mode 100644
index 0000000000..bcac5f8d79
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraNoSqlDbImpl.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.nosqldb.impl.cassandra;
+
+import com.datastax.driver.core.BoundStatement;
+import com.datastax.driver.core.PreparedStatement;
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.Session;
+import com.datastax.driver.mapping.MappingManager;
+import org.openecomp.core.nosqldb.api.NoSqlDb;
+import org.openecomp.core.nosqldb.util.CassandraUtils;
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+class CassandraNoSqlDbImpl implements NoSqlDb {
+
+ private final Session session;
+ private final String keySpace;
+ private final MappingManager mappingManager;
+
+
+ public CassandraNoSqlDbImpl(Session session) {
+ this.session = session;
+ this.keySpace = this.session.getLoggedKeyspace();
+ this.mappingManager = new MappingManager(this.session);
+
+ }
+
+ @Override
+ public void insert(String tableName, String[] colNames, Object[] values) {
+ if (colNames.length != values.length) {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
+ "number of colmuns[" + colNames.length + "] is not equal to the number of values["
+ + values.length + "].").withId("E0005").withCategory(ErrorCategory.APPLICATION)
+ .build());
+ }
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("insert into ")
+ .append(tableName)
+ .append(" (")
+ .append(CommonMethods.arrayToCommaSeparatedString(colNames))
+ .append(") values (")
+ .append(CommonMethods.duplicateStringWithDelimiter("?", ',', values.length))
+ .append(")");
+ System.out.println(sb.toString());
+ PreparedStatement prepared = session.prepare(sb.toString());
+
+ BoundStatement bound;
+ bound = prepared.bind(values);
+ session.execute(bound);
+
+ }
+
+ @Override
+ public ResultSet execute(String statement) {
+ return session.execute(statement);
+ }
+
+ @Override
+ public ResultSet execute(String statementName, Object... values) {
+
+ String statement = CassandraUtils.getStatement(statementName);
+ if (statement == null) {
+ statement = statementName;
+ }
+ if (values != null) {
+ PreparedStatement prepared = session.prepare(statement);
+
+ BoundStatement bound;
+ bound = prepared.bind(values);
+ return session.execute(bound);
+ } else {
+ return session.execute(statement);
+ }
+
+ }
+
+ @Override
+ public MappingManager getMappingManager() {
+ return mappingManager;
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
new file mode 100644
index 0000000000..1b98f095b5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/impl/cassandra/CassandraSessionFactory.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.nosqldb.impl.cassandra;
+
+import com.google.common.base.Optional;
+
+import com.datastax.driver.core.Cluster;
+import com.datastax.driver.core.SSLOptions;
+import com.datastax.driver.core.Session;
+
+import org.openecomp.core.nosqldb.util.CassandraUtils;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+
+public class CassandraSessionFactory {
+ public static Session getSession() {
+ return ReferenceHolder.CASSANDRA;
+ }
+
+ /**
+ * New cassandra session session.
+ *
+ * @return the session
+ */
+ public static Session newCassandraSession() {
+ Cluster.Builder builder = Cluster.builder();
+ String[] addresses = CassandraUtils.getAddresses();
+ for (String address : addresses) {
+ builder.addContactPoint(address);
+ }
+ Boolean isSsl = CassandraUtils.isSsl();
+ if (isSsl) {
+ builder.withSSL(getSslOptions().get());
+ }
+ int port = CassandraUtils.getCassandraPort();
+ if (port > 0) {
+ builder.withPort(port);
+ }
+ //Check if user/pass
+ Boolean isAuthenticate = CassandraUtils.isAuthenticate();
+ if (isAuthenticate) {
+ builder.withCredentials(CassandraUtils.getUser(), CassandraUtils.getPassword());
+ }
+
+ Cluster cluster = builder.build();
+ String keyStore = CassandraUtils.getKeySpace();
+ return cluster.connect(keyStore);
+ }
+
+ private static Optional<SSLOptions> getSslOptions() {
+ Optional<String> truststorePath = Optional.of(CassandraUtils.getTruststore());
+ Optional<String> truststorePassword = Optional.of(CassandraUtils.getTruststorePassword());
+
+ if (truststorePath.isPresent() && truststorePassword.isPresent()) {
+ SSLContext context;
+ try {
+ context = getSslContext(truststorePath.get(), truststorePassword.get());
+ } catch (UnrecoverableKeyException | KeyManagementException
+ | NoSuchAlgorithmException | KeyStoreException | CertificateException | IOException e0) {
+ throw new RuntimeException(e0);
+ }
+ String[] css = new String[]{"TLS_RSA_WITH_AES_128_CBC_SHA"};
+ return Optional.of(new SSLOptions(context, css));
+ }
+ return Optional.absent();
+ }
+
+ private static SSLContext getSslContext(String truststorePath, String truststorePassword)
+ throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException,
+ UnrecoverableKeyException, KeyManagementException {
+ FileInputStream tsf = null;
+ SSLContext ctx = null;
+ try {
+ tsf = new FileInputStream(truststorePath);
+ ctx = SSLContext.getInstance("SSL");
+
+ KeyStore ts = KeyStore.getInstance("JKS");
+ ts.load(tsf, truststorePassword.toCharArray());
+ TrustManagerFactory tmf =
+ TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+ tmf.init(ts);
+
+ ctx.init(null, tmf.getTrustManagers(), new SecureRandom());
+ } catch (Exception e0) {
+ e0.printStackTrace();
+ } finally {
+ tsf.close();
+
+ }
+ return ctx;
+ }
+
+ private static class ReferenceHolder {
+ private static final Session CASSANDRA = newCassandraSession();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java
new file mode 100644
index 0000000000..2a88d0e521
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/CassandraUtils.java
@@ -0,0 +1,92 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.nosqldb.util;
+
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+public class CassandraUtils {
+
+
+ private static final String CASSANDRA_STATEMENT_DEFINITION_FILE = "cassandraStatements.json";
+ private static Map<String, String> statementMap = new HashMap<>();
+
+ public static String[] getAddresses() {
+ return ConfigurationManager.getInstance().getAddresses();
+
+ }
+
+ public static String getKeySpace() {
+ return ConfigurationManager.getInstance().getKeySpace();
+ }
+
+ /**
+ * Gets statement.
+ *
+ * @param statementName the statement name
+ * @return the statement
+ */
+ public static String getStatement(String statementName) {
+ if (statementMap.size() == 0) {
+ InputStream statementJson = FileUtils.getFileInputStream(CASSANDRA_STATEMENT_DEFINITION_FILE);
+ statementMap = JsonUtil.json2Object(statementJson, Map.class);
+ }
+ return statementMap.get(statementName);
+ }
+
+ public static String getUser() {
+
+ return ConfigurationManager.getInstance().getUsername();
+ }
+
+ public static String getPassword() {
+ return ConfigurationManager.getInstance().getPassword();
+
+ }
+
+ public static String getTruststore() {
+ return ConfigurationManager.getInstance().getTruststorePath();
+
+ }
+
+ public static String getTruststorePassword() {
+ return ConfigurationManager.getInstance().getTruststorePassword();
+
+ }
+
+ public static int getCassandraPort() {
+ return ConfigurationManager.getInstance().getSslPort();
+
+ }
+
+ public static boolean isSsl() {
+ return ConfigurationManager.getInstance().isSsl();
+
+ }
+
+ public static boolean isAuthenticate() {
+ return ConfigurationManager.getInstance().isAuthenticate();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java
new file mode 100644
index 0000000000..a1c0b528fb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-nosqldb-lib/openecomp-nosqldb-core/src/main/java/org/openecomp/core/nosqldb/util/ConfigurationManager.java
@@ -0,0 +1,234 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.core.nosqldb.util;
+
+import org.openecomp.core.utilities.yaml.YamlUtil;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The type Configuration manager.
+ */
+public class ConfigurationManager {
+
+ private static final String CONFIGURATION_YAML_FILE = "configuration.yaml";
+ private static final String cassandraKey = "cassandraConfig";
+ private static final String DEFAULT_KEYSPACE_NAME = "dox";
+ private static final String CASSANDRA_ADDRESSES = "cassandra.addresses";
+ private static final String CASSANDRA_DOX_KEY_STORE = "cassandra.dox.keystore";
+ private static final String CASSANDRA_AUTHENTICATE = "cassandra.authenticate";
+ private static final String CASSANDRA_USER = "cassandra.user";
+ private static final String CASSANDRA_PASSWORD = "cassandra.password";
+ private static final String CASSANDRA_PORT = "cassandra.port";
+ private static final String CASSANDRA_SSL = "cassandra.ssl";
+ private static final String CASSANDRA_TRUSTSTORE = "cassandra.Truststore";
+ private static final String CASSANDRA_TRUSTSTORE_PASSWORD = "cassandra.TruststorePassword";
+ private static final String cassandraHostsKey = "cassandraHosts";
+ private static final String cassandraPortKey = "port";
+ private static final String cassandraUsernameKey = "username";
+ private static final String cassandraPasswordKey = "password";
+ private static final String cassandraAuthenticateKey = "authenticate";
+ private static final String cassandraSSLKey = "ssl";
+ private static final String cassandraTruststorePathKey = "truststorePath";
+ private static final String cassandraTruststorePasswordKey = "truststorePassword";
+ private static ConfigurationManager instance = null;
+ private final LinkedHashMap<String, Object> cassandraConfiguration;
+
+
+ private ConfigurationManager() {
+ YamlUtil yamlUtil = new YamlUtil();
+ String configurationYamlFile = System.getProperty(CONFIGURATION_YAML_FILE);
+ InputStream yamlAsString;
+ if (configurationYamlFile != null) {
+ yamlAsString = getConfigFileIs(configurationYamlFile);
+ } else {
+ //Load from resources
+ yamlAsString = yamlUtil.loadYamlFileIs("/" + CONFIGURATION_YAML_FILE);
+ }
+ Map<String, LinkedHashMap<String, Object>> configurationMap = yamlUtil.yamlToMap(yamlAsString);
+ cassandraConfiguration = configurationMap.get(cassandraKey);
+
+ }
+
+ /**
+ * Gets instance.
+ *
+ * @return the instance
+ */
+ public static ConfigurationManager getInstance() {
+ if (instance == null) {
+ instance = new ConfigurationManager();
+ }
+ return instance;
+ }
+
+ /**
+ * Get addresses string [ ].
+ *
+ * @return the string [ ]
+ */
+ public String[] getAddresses() {
+
+ String addresses = System.getProperty(CASSANDRA_ADDRESSES);
+ if (addresses != null) {
+ return addresses.split(",");
+ }
+ List locAddresses = (ArrayList) cassandraConfiguration.get(cassandraHostsKey);
+ String[] addressesArray;
+ addressesArray = (String[]) locAddresses.toArray(new String[locAddresses.size()]);
+ return addressesArray;
+
+ }
+
+ /**
+ * Gets key space.
+ *
+ * @return the key space
+ */
+ public String getKeySpace() {
+ String keySpace = System.getProperty(CASSANDRA_DOX_KEY_STORE);
+ if (keySpace == null) {
+ //keySpace = cassandraConfiguration.get(cassandraKeySpaceKey);
+ //if (keySpace == null)
+ keySpace = DEFAULT_KEYSPACE_NAME;
+ }
+ return keySpace;
+ }
+
+ /**
+ * Gets username.
+ *
+ * @return the username
+ */
+ public String getUsername() {
+ String username = System.getProperty(CASSANDRA_USER);
+ if (username == null) {
+ username = (String) cassandraConfiguration.get(cassandraUsernameKey);
+ }
+ return username;
+ }
+
+ /**
+ * Gets password.
+ *
+ * @return the password
+ */
+ public String getPassword() {
+ String password = System.getProperty(CASSANDRA_PASSWORD);
+ if (password == null) {
+ password = (String) cassandraConfiguration.get(cassandraPasswordKey);
+ }
+ return password;
+ }
+
+ /**
+ * Gets truststore path.
+ *
+ * @return the truststore path
+ */
+ public String getTruststorePath() {
+ String truststorePath = System.getProperty(CASSANDRA_TRUSTSTORE);
+ if (truststorePath == null) {
+ truststorePath = (String) cassandraConfiguration.get(cassandraTruststorePathKey);
+ }
+ return truststorePath;
+ }
+
+ /**
+ * Gets truststore password.
+ *
+ * @return the truststore password
+ */
+ public String getTruststorePassword() {
+ String truststorePassword = System.getProperty(CASSANDRA_TRUSTSTORE_PASSWORD);
+ if (truststorePassword == null) {
+ truststorePassword = (String) cassandraConfiguration.get(cassandraTruststorePasswordKey);
+ }
+ return truststorePassword;
+ }
+
+ /**
+ * Gets ssl port.
+ *
+ * @return the ssl port
+ */
+ public int getSslPort() {
+ int port;
+ String sslPort = System.getProperty(CASSANDRA_PORT);
+ if (sslPort == null) {
+ sslPort = (String) cassandraConfiguration.get(cassandraPortKey);
+ if (sslPort == null) {
+ sslPort = "0";
+ }
+ }
+ port = Integer.valueOf(sslPort);
+ return port;
+ }
+
+
+ /**
+ * Is ssl boolean.
+ *
+ * @return the boolean
+ */
+ public boolean isSsl() {
+ return getBooleanResult(CASSANDRA_SSL, cassandraSSLKey);
+ }
+
+ /**
+ * Is authenticate boolean.
+ *
+ * @return the boolean
+ */
+ public boolean isAuthenticate() {
+ return getBooleanResult(CASSANDRA_AUTHENTICATE, cassandraAuthenticateKey);
+ }
+
+ private Boolean getBooleanResult(String property, String key) {
+ Boolean res;
+ String value;
+ if (System.getProperty(property) == null) {
+ value = String.valueOf(cassandraConfiguration.get(key));
+ } else {
+ value = System.getProperty(property);
+ }
+
+ res = Boolean.valueOf(value);
+
+ return res;
+ }
+
+ private InputStream getConfigFileIs(String file) {
+ InputStream is = null;
+ try {
+ is = new FileInputStream(file);
+ } catch (FileNotFoundException e0) {
+ e0.printStackTrace();
+ }
+ return is;
+ }
+}