diff options
author | vempo <vitaliy.emporopulo@amdocs.com> | 2018-07-09 14:27:57 +0300 |
---|---|---|
committer | Michael Lando <ml636r@att.com> | 2018-07-15 20:23:13 +0000 |
commit | d6d12919128adc0aaca30d1ca8139e72ae025776 (patch) | |
tree | e354bfe0b76a24072a5cb807d3371ba3469db168 /openecomp-be/lib/openecomp-core-lib | |
parent | 062d4c11dc9e6fc919b0de406700f939169480c5 (diff) |
Upgraded servlet-api version to 3.0.1
Change-Id: I50b258e8843d85384e89e4ceb16d687d247dbe11
Issue-ID: SDC-1472
Signed-off-by: vempo <vitaliy.emporopulo@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-core-lib')
2 files changed, 63 insertions, 88 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml index 50574a0900..01233644a0 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/pom.xml @@ -39,16 +39,6 @@ <artifactId>zusammen-collaboration-cassandra-plugin</artifactId> <version>${zusammen-collaboration-store.version}</version> <scope>runtime</scope> -<!-- <exclusions> - <exclusion> - <groupId>com.datastax.cassandra</groupId> - <artifactId>cassandra-driver-core</artifactId> - </exclusion> - <exclusion> - <groupId>com.datastax.cassandra</groupId> - <artifactId>cassandra-driver-mapping</artifactId> - </exclusion> - </exclusions>--> </dependency> <dependency> <groupId>com.amdocs.zusammen.plugin</groupId> @@ -73,11 +63,6 @@ <version>${project.version}</version> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> - </dependency> - <dependency> <groupId>org.openecomp.sdc.core</groupId> <artifactId>openecomp-nosqldb-core</artifactId> <version>${project.version}</version> diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java index 8eeeb1e27b..7944999a70 100644 --- a/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java +++ b/openecomp-be/lib/openecomp-core-lib/openecomp-zusammen-lib/openecomp-zusammen-core/src/main/java/org/openecomp/core/zusammen/impl/CassandraConnectionInitializer.java @@ -16,85 +16,75 @@ package org.openecomp.core.zusammen.impl; +import java.util.function.Supplier; import org.apache.commons.lang3.StringUtils; - import org.openecomp.core.nosqldb.util.CassandraUtils; -import java.util.function.Supplier; - -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; - -public class CassandraConnectionInitializer implements ServletContextListener { - - private static final String CASSANDRA_PREFIX = "cassandra."; - private static final String DATA_CENTER_PROPERTY_NAME = CASSANDRA_PREFIX + "datacenter"; - private static final String CONSISTENCY_LEVEL_PROPERTY_NAME = - CASSANDRA_PREFIX + "consistency.level"; - private static final String NODES_PROPERTY_NAME = CASSANDRA_PREFIX + "nodes"; - private static final String AUTHENTICATE_PROPERTY_NAME = CASSANDRA_PREFIX + "authenticate"; - private static final String SSL_PROPERTY_NAME = CASSANDRA_PREFIX + "ssl"; - private static final String TRUSTSTORE_PROPERTY_NAME = CASSANDRA_PREFIX + "truststore"; - private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME = - CASSANDRA_PREFIX + "truststore.password"; - private static final String USER_PROPERTY_NAME = CASSANDRA_PREFIX + "user"; - private static final String PASSWORD_PROPERTY_NAME = CASSANDRA_PREFIX + "password"; - private static final String KEYSPACE_PROPERTY_NAME = CASSANDRA_PREFIX + "keyspace"; - private static final String ZUSAMMEN = "zusammen"; - - @Override - public void contextInitialized(ServletContextEvent servletContextEvent) { - setCassandraConnectionPropertiesToSystem(); - } - - public static void setCassandraConnectionPropertiesToSystem() { - DeferredInitializer.init(); - } - - @Override - public void contextDestroyed(ServletContextEvent servletContextEvent) { - // no-op, required by the interface - } - - private static class DeferredInitializer { - - static { - setSystemProperty(NODES_PROPERTY_NAME, () -> - StringUtils.join(CassandraUtils.getAddresses(), ',')); - setBooleanSystemProperty(AUTHENTICATE_PROPERTY_NAME, CassandraUtils::isAuthenticate); - setBooleanSystemProperty(SSL_PROPERTY_NAME, CassandraUtils::isSsl); - setSystemProperty(TRUSTSTORE_PROPERTY_NAME, CassandraUtils::getTruststore); - setSystemProperty(TRUSTSTORE_PASSWORD_PROPERTY_NAME, CassandraUtils::getTruststorePassword); - setSystemProperty(USER_PROPERTY_NAME, CassandraUtils::getUser); - setSystemProperty(PASSWORD_PROPERTY_NAME, CassandraUtils::getPassword); - setSystemProperty(KEYSPACE_PROPERTY_NAME, () -> ZUSAMMEN); - setNullableSystemProperty(DATA_CENTER_PROPERTY_NAME, CassandraUtils::getLocalDataCenter); - setNullableSystemProperty(CONSISTENCY_LEVEL_PROPERTY_NAME, - CassandraUtils::getConsistencyLevel); - } - - private static void setSystemProperty(String name, Supplier<String> valueSupplier) { - - if (System.getProperty(name) == null) { - System.setProperty(name, valueSupplier.get()); - } +public class CassandraConnectionInitializer { + + private static final String CASSANDRA_PREFIX = "cassandra."; + private static final String DATA_CENTER_PROPERTY_NAME = CASSANDRA_PREFIX + "datacenter"; + private static final String CONSISTENCY_LEVEL_PROPERTY_NAME = + CASSANDRA_PREFIX + "consistency.level"; + private static final String NODES_PROPERTY_NAME = CASSANDRA_PREFIX + "nodes"; + private static final String AUTHENTICATE_PROPERTY_NAME = CASSANDRA_PREFIX + "authenticate"; + private static final String SSL_PROPERTY_NAME = CASSANDRA_PREFIX + "ssl"; + private static final String TRUSTSTORE_PROPERTY_NAME = CASSANDRA_PREFIX + "truststore"; + private static final String TRUSTSTORE_PASSWORD_PROPERTY_NAME = + CASSANDRA_PREFIX + "truststore.password"; + private static final String USER_PROPERTY_NAME = CASSANDRA_PREFIX + "user"; + private static final String PASSWORD_PROPERTY_NAME = CASSANDRA_PREFIX + "password"; + private static final String KEYSPACE_PROPERTY_NAME = CASSANDRA_PREFIX + "keyspace"; + private static final String ZUSAMMEN = "zusammen"; + + private CassandraConnectionInitializer() { + // static utility class, prevent instantiation } - private static void setBooleanSystemProperty(String name, Supplier<Boolean> valueSupplier) { - setSystemProperty(name, () -> Boolean.toString(valueSupplier.get())); + public static void setCassandraConnectionPropertiesToSystem() { + DeferredInitializer.init(); } - private static void setNullableSystemProperty(String name, Supplier<String> valueSupplier) { - - if ((System.getProperty(name) == null) && (valueSupplier.get() != null)) { - System.setProperty(name, valueSupplier.get()); - } - } - - private DeferredInitializer() { } - - public static void init() { - // just to ensure static initialization + private static class DeferredInitializer { + + static { + setSystemProperty(NODES_PROPERTY_NAME, () -> + StringUtils.join(CassandraUtils.getAddresses(), ',')); + setBooleanSystemProperty(AUTHENTICATE_PROPERTY_NAME, CassandraUtils::isAuthenticate); + setBooleanSystemProperty(SSL_PROPERTY_NAME, CassandraUtils::isSsl); + setSystemProperty(TRUSTSTORE_PROPERTY_NAME, CassandraUtils::getTruststore); + setSystemProperty(TRUSTSTORE_PASSWORD_PROPERTY_NAME, CassandraUtils::getTruststorePassword); + setSystemProperty(USER_PROPERTY_NAME, CassandraUtils::getUser); + setSystemProperty(PASSWORD_PROPERTY_NAME, CassandraUtils::getPassword); + setSystemProperty(KEYSPACE_PROPERTY_NAME, () -> ZUSAMMEN); + setNullableSystemProperty(DATA_CENTER_PROPERTY_NAME, CassandraUtils::getLocalDataCenter); + setNullableSystemProperty(CONSISTENCY_LEVEL_PROPERTY_NAME, + CassandraUtils::getConsistencyLevel); + } + + private DeferredInitializer() { } + + @SuppressWarnings("EmptyMethod") + static void init() { + // no-op, just to ensure static initialization + } + + private static void setSystemProperty(String name, Supplier<String> valueSupplier) { + + if (System.getProperty(name) == null) { + System.setProperty(name, valueSupplier.get()); + } + } + + private static void setBooleanSystemProperty(String name, Supplier<Boolean> valueSupplier) { + setSystemProperty(name, () -> Boolean.toString(valueSupplier.get())); + } + + private static void setNullableSystemProperty(String name, Supplier<String> valueSupplier) { + + if ((System.getProperty(name) == null) && (valueSupplier.get() != null)) { + System.setProperty(name, valueSupplier.get()); + } + } } - } } |