summaryrefslogtreecommitdiffstats
path: root/core/utils
diff options
context:
space:
mode:
Diffstat (limited to 'core/utils')
-rw-r--r--core/utils/provider/pom.xml10
-rw-r--r--core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/Configuration.java239
-rw-r--r--core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/ConfigurationFactory.java446
-rw-r--r--core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/DefaultConfiguration.java565
-rw-r--r--core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/UnmodifiableProperties.java354
-rw-r--r--core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/package.html173
-rw-r--r--core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/LoggingConstants.java132
-rw-r--r--core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/LoggingUtils.java314
-rw-r--r--core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/Msg.java869
9 files changed, 3102 insertions, 0 deletions
diff --git a/core/utils/provider/pom.xml b/core/utils/provider/pom.xml
index ac9941aec..476448775 100644
--- a/core/utils/provider/pom.xml
+++ b/core/utils/provider/pom.xml
@@ -32,6 +32,16 @@
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
diff --git a/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/Configuration.java b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/Configuration.java
new file mode 100644
index 000000000..1e41a5268
--- /dev/null
+++ b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/Configuration.java
@@ -0,0 +1,239 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.utils.configuration;
+
+import java.util.Properties;
+
+/**
+ * This interface defines the common configuration support that is available to the application.
+ * <p>
+ * Where properties are common to all CDP components (server, coordinator, and EPM), the property symbolic values are
+ * defined as part of this interface. Where they are unique to each component, they must be defined within that
+ * component.
+ * </p>
+ */
+public interface Configuration {
+
+ String PROPERTY_BOOTSTRAP_FILE_NAME = "org_onap_appc_bootstrap_file"; //
+ String DEFAULT_BOOTSTRAP_FILE_NAME = "appc.properties";
+ String PROPERTY_BOOTSTRAP_FILE_PATH = "org_onap_appc_bootstrap_path"; //
+ String DEFAULT_BOOTSTRAP_FILE_PATH = "/opt/onap/appc/data/properties,${user.home},etc,../etc";
+ String PROPERTY_RESOURCE_BUNDLES = "org.onap.appc.resources";
+ String DEFAULT_RESOURCE_BUNDLES = "org/onap/appc/i18n/MessageResources";
+
+ /**
+ * This method is called to obtain a property expressed as a boolean value (true or false). The standard rules for
+ * {@link Boolean#valueOf(String)} are used.
+ *
+ * @param key
+ * The property key
+ * @return The value of the property expressed as a boolean, or false if it does not exist.
+ */
+ boolean getBooleanProperty(String key);
+
+ /**
+ * This method is called to obtain a property expressed as a boolean value (true or false). The standard rules for
+ * {@link Boolean#valueOf(String)} are used.
+ *
+ * @param key
+ * The property key
+ * @param defaultValue
+ * The default value to be returned if the property does not exist
+ * @return The value of the property expressed as a boolean, or false if it does not exist.
+ */
+ boolean getBooleanProperty(String key, boolean defaultValue);
+
+ /**
+ * Returns the indicated property value expressed as a floating point double-precision value (double). The standard
+ * rules for {@link Double#valueOf(String)} are used.
+ *
+ * @param key
+ * The property to retrieve
+ * @return The value of the property, or 0.0 if not found or invalid
+ */
+ double getDoubleProperty(String key);
+
+ /**
+ * Returns the indicated property value expressed as a floating point double-precision value (double). The standard
+ * rules for {@link Double#valueOf(String)} are used.
+ *
+ * @param key
+ * The property to retrieve
+ * @param defaultValue
+ * The default value to be returned if the property does not exist
+ * @return The value of the property, or 0.0 if not found or invalid
+ */
+ double getDoubleProperty(String key, double defaultValue);
+
+ /**
+ * Returns the property indicated expressed as an integer. The standard rules for
+ * {@link Integer#parseInt(String, int)} using a radix of 10 are used.
+ *
+ * @param key
+ * The property name to retrieve.
+ * @return The value of the property, or 0 if it does not exist or is invalid.
+ */
+ int getIntegerProperty(String key);
+
+ /**
+ * Returns the property indicated expressed as an integer. The standard rules for
+ * {@link Integer#parseInt(String, int)} using a radix of 10 are used.
+ *
+ * @param key
+ * The property name to retrieve.
+ * @param defaultValue
+ * The default value to be returned if the property does not exist
+ * @return The value of the property, or 0 if it does not exist or is invalid.
+ */
+ int getIntegerProperty(String key, int defaultValue);
+
+ /**
+ * Returns the specified property as a long integer value, if it exists, or zero if it does not.
+ *
+ * @param key
+ * The key of the property desired.
+ * @return The value of the property expressed as an integer long value, or zero if the property does not exist or
+ * is not a valid integer long.
+ */
+ long getLongProperty(String key);
+
+ /**
+ * Returns the specified property as a long integer value, if it exists, or the default value if it does not exist
+ * or is invalid.
+ *
+ * @param key
+ * The key of the property desired.
+ * @param defaultValue
+ * the value to be returned if the property is not valid or does not exist.
+ * @return The value of the property expressed as an integer long value, or the default value if the property does
+ * not exist or is not a valid integer long.
+ */
+ long getLongProperty(String key, long defaultValue);
+
+ /**
+ * This method can be called to retrieve a properties object that is immutable. Any attempt to modify the properties
+ * object returned will result in an exception. This allows a caller to view the current configuration as a set of
+ * properties.
+ *
+ * @return An unmodifiable properties object.
+ */
+ Properties getProperties();
+
+ /**
+ * This method is called to obtain a property as a string value
+ *
+ * @param key
+ * The key of the property
+ * @return The string value, or null if it does not exist.
+ */
+ String getProperty(String key);
+
+ /**
+ * This method is called to obtain a property as a string value
+ *
+ * @param key
+ * The key of the property
+ * @param defaultValue
+ * The default value to be returned if the property does not exist
+ * @return The string value, or null if it does not exist.
+ */
+ String getProperty(String key, String defaultValue);
+
+ /**
+ * Returns true if the named property is defined, false otherwise.
+ *
+ * @param key
+ * The key of the property we are interested in
+ * @return True if the property exists.
+ */
+ boolean isPropertyDefined(String key);
+
+ /**
+ * Returns an indication of the validity of the boolean property. A boolean property is considered to be valid only
+ * if it has the value "true" or "false" (ignoring case).
+ *
+ * @param key
+ * The property to be checked
+ * @return True if the value is a boolean constant, or false if it does not exist or is not a correct string
+ */
+ boolean isValidBoolean(String key);
+
+ /**
+ * Returns an indication if the indicated property represents a valid double-precision floating point number.
+ *
+ * @param key
+ * The property to be examined
+ * @return True if the property is a valid representation of a double, or false if it does not exist or contains
+ * illegal characters.
+ */
+ boolean isValidDouble(String key);
+
+ /**
+ * Returns an indication if the property is a valid integer value or not.
+ *
+ * @param key
+ * The key of the property to check
+ * @return True if the value is a valid integer string, or false if it does not exist or contains illegal
+ * characters.
+ */
+ boolean isValidInteger(String key);
+
+ /**
+ * Determines is the specified property exists and is a valid representation of an integer long value.
+ *
+ * @param key
+ * The property to be checked
+ * @return True if the property is a valid representation of an integer long value, and false if it either does not
+ * exist or is not valid.
+ */
+ boolean isValidLong(String key);
+
+ /**
+ * This method allows the caller to set all properties from a provided properties object into the configuration
+ * property set.
+ * <p>
+ * The primary difference between this method and the factory method
+ * {@link org.onap.ccsdk.sli.core.utils.configuration.ConfigurationFactory#getConfiguration(Properties)} is that this method does not clear and reload the
+ * configuration. Rather, this method merges the provided properties object contents into the existing properties,
+ * replacing any same-named keys with the values from this object.
+ * </p>
+ *
+ * @param properties
+ * The properties object to copy all properties from
+ */
+ void setProperties(Properties properties);
+
+ /**
+ * This method allows a caller to insert a new property definition into the configuration object. This allows the
+ * application to adjust or add to the current configuration. If the property already exists, it is replaced with
+ * the new value.
+ *
+ * @param key
+ * The key of the property to be defined
+ * @param value
+ * The value of the property to be defined
+ */
+ void setProperty(String key, String value);
+}
diff --git a/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/ConfigurationFactory.java b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/ConfigurationFactory.java
new file mode 100644
index 000000000..05c132d0f
--- /dev/null
+++ b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/ConfigurationFactory.java
@@ -0,0 +1,446 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.utils.configuration;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResourceManager;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Optional;
+import java.util.Properties;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
+import org.apache.commons.lang3.StringUtils;
+import org.onap.ccsdk.sli.core.utils.logging.LoggingUtils;
+import org.onap.ccsdk.sli.core.utils.logging.Msg;
+
+/**
+ * The configuration factory is used to obtain access to an already created and initialized
+ * singleton configuration object as well as to create and initialize the singleton if not already
+ * set up.
+ * <p>
+ * This class is responsible for the creation of the configuration object used to manage the
+ * configuration of the application. The configuration object implementation must implement the
+ * <code>Configuration</code> interface. This allows for the factory to create different
+ * specializations in the future if needed and not break any application code.
+ * </p>
+ * <p>
+ * The configuration object is basically a wrapper around a properties object. The configuration is
+ * therefore specified as a set of properties that are loaded and processed from different sources
+ * with different precedences. It is important that the configuration object always be able to
+ * supply default values for any configuration properties that must be supplied, and not rely on the
+ * user always supplying these values. This also relieves the application itself from having to
+ * interpret missing or invalid properties and applying defaults. By having all of the defaults in
+ * one place, the application code can be simpler (not having to worry about defaults or invalid
+ * properties), and the defaults can be changed much easier (they are all in one place and not
+ * distributed throughout the codebase).
+ * </p>
+ * <p>
+ * Since the configuration is managed as a property object, we can use a characteristic of the
+ * <code>Properties</code> class to our advantage. Namely, if we put a property into a
+ * <code>Properties</code> object that already exists, the <code>Properties</code> object replaces
+ * it with the new value. This does not affect any other properties that may already be defined in
+ * the properties object. This gives us the ability to initialize the properties with default values
+ * for all of the application settings, then override just those that we need to override, possibly
+ * from multiple sources and in increasing order of precedence.
+ * </p>
+ * <p>
+ * This means that properties are in effect "merged" together from multiple sources in a prescribed
+ * precedence order. In fact, the precedence order that this factory implements is defined as:
+ * </p>
+ * <ol>
+ * <li>Default values from a system resource file.</li>
+ * <li>User-supplied properties file, if any.</li>
+ * <li>Application-supplied properties, if any.</li>
+ * <li>Command-line properties (if any)</li>
+ * </ol>
+ * <p>
+ * The name and location of the properties file that is loaded can also be set, either in the
+ * defaults, overridden by the system command line via -D, or as a system environment variable.
+ * There are two properties that can be specified to define the name and path. These are:
+ * </p>
+ * <dl>
+ * <dt>org.onap.appc.bootstrap.file</dt>
+ * <dd>This property defines the name of the file that will be loaded. If not specified, the default
+ * value is "appc.properties". This can be specified in either (or both) the default properties or
+ * the command line. The command line specification will always override.</dd>
+ * <dt>org.onap.appc.bootstrap.path</dt>
+ * <dd>This is a comma-delimited (,) path of directories to be searched to locate the specified
+ * file. The first occurrence of the file is the one loaded, and no additional searching is
+ * performed. The path can be specified in either, or both, the default values and the command line
+ * specification. If specified on the command line, the value overrides the default values. If
+ * omitted, the default path is <code>$/opt/onap/appc/data/properties,${user.home},.</code></dd>
+ * </dl>
+ *
+ * @since Mar 18, 2014
+ * @version $Id$
+ */
+public final class ConfigurationFactory {
+
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(ConfigurationFactory.class);
+
+ /**
+ * This is a string constant for the comma character. It's intended to be used a common string
+ * delimiter.
+ */
+ private static final String COMMA = ",";
+
+ /**
+ * The default Configuration object that implements the <code>Configuration</code> interface and
+ * represents our system configuration settings.
+ */
+ private static DefaultConfiguration config = null;
+
+ /**
+ * The default properties resource to be loaded
+ */
+ private static final String DEFAULT_PROPERTIES = "org/onap/appc/default.properties";
+
+ /**
+ * This collection allows for special configurations to be created and maintained, organized by
+ * some identification (such as an object reference to the StackBuilder to which they apply),
+ * and then obtained from the configuration factory when needed.
+ */
+ private static HashMap<Object, Configuration> localConfigs = new HashMap<>();
+
+ /**
+ * The reentrant shared lock used to serialize access to the properties.
+ */
+ private static ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
+
+ /**
+ * This is a constant array of special property names that will be copied from the configuration
+ * back to the System properties object if they are defined in the configuration AND they do not
+ * already exist in the System properties object. These are intended as a convenience for
+ * setting the AFT properties for the Discovery client where it may be difficult or impossible
+ * to set VM arguments for the container.
+ */
+ private static final String[] specialProperties =
+ {"AFT_LATITUDE", "AFT_LONGITUDE", "AFT_ENVIRONMENT", "SCLD_PLATFORM"};
+
+ private ConfigurationFactory() {}
+
+ /**
+ * This method is used to obtain the common configuration object (as well as set it up if not
+ * already).
+ *
+ * @return The configuration object implementation
+ */
+ public static Configuration getConfiguration() {
+
+ /*
+ * First, attempt to access the properties as a read lock holder
+ */
+ ReadLock readLock = lock.readLock();
+ readLock.lock();
+ try {
+
+ /*
+ * If the properties don't exist, release the read lock and acquire the write lock. Once
+ * we get the write lock, we need to re-check to see that the configuration needs to be
+ * set up (because another thread may have beat us to it). After we get a configuration
+ * set up, release the write lock and re-obtain the read lock to access the properties.
+ */
+ if (config == null) {
+ readLock.unlock();
+ WriteLock writeLock = lock.writeLock();
+ writeLock.lock();
+ try {
+ if (config == null) {
+ config = new DefaultConfiguration();
+ initialize(null);
+ }
+ } catch (Exception e){
+ logger.error("getConfiguration: " + LoggingUtils.formatException(e));
+ } finally {
+ writeLock.unlock();
+ }
+ readLock.lock();
+ }
+ } finally {
+ readLock.unlock();
+ }
+ return config;
+ }
+
+ /**
+ * This method will obtain the local configuration for the specified object if it exists, or
+ * will create it from the current global configuration. This allows the configuration to be
+ * tailored for a specific process or operation, and uniquely identified by some value (such as
+ * the object that represents the special use of the configuration).
+ *
+ * @param owner The owner or identification of the owner of the special configuration
+ * @return The special configuration object, or a clone of the global configuration so that it
+ * can be altered if needed.
+ */
+ public static Configuration getConfiguration(final Object owner) {
+ DefaultConfiguration local;
+ ReadLock readLock = lock.readLock();
+ readLock.lock();
+ try {
+ local = (DefaultConfiguration) localConfigs.get(owner);
+ if (local == null) {
+ readLock.unlock();
+ WriteLock writeLock = lock.writeLock();
+ writeLock.lock();
+ local = (DefaultConfiguration) localConfigs.get(owner);
+ if (local == null) {
+ local = getClonedDefaultConfiguration(owner, local);
+ }
+ writeLock.unlock();
+ }
+ readLock.lock();
+ } finally {
+ readLock.unlock();
+ }
+ return local;
+ }
+
+ /**
+ * This method allows the caller to alter the configuration, supplying the specified
+ * configuration properties which override the application default values.
+ * <p>
+ * The configuration is re-constructed (if already constructed) or created new (if not already
+ * created) and the default properties are loaded into the configuration.
+ * </p>
+ * <p>
+ * The primary purpose of this method is to allow the application configuration properties to be
+ * reset or refreshed after the application has already been initialized. This method will lock
+ * the configuration for the duration while it is being re-built, and should not be called on a
+ * regular basis.
+ * </p>
+ *
+ * @param props The properties used to configure the application.
+ * @return Access to the configuration implementation
+ */
+ public static Configuration getConfiguration(final Properties props) {
+ WriteLock writeLock = lock.writeLock();
+ writeLock.lock();
+ try {
+ config = new DefaultConfiguration();
+ initialize(props);
+ return config;
+ } finally {
+ writeLock.unlock();
+ }
+ }
+
+ private static DefaultConfiguration getClonedDefaultConfiguration(Object owner, DefaultConfiguration local) {
+ Optional<DefaultConfiguration> global =
+ Optional.ofNullable((DefaultConfiguration) getConfiguration());
+ try {
+ if (global.isPresent()) {
+ local = (DefaultConfiguration) global.get().clone();
+ }
+ } catch (CloneNotSupportedException e) {
+ logger.error("getClonedDefaultConfiguration: " + LoggingUtils.formatException(e));
+ }
+ localConfigs.put(owner, local);
+ return local;
+ }
+
+ /**
+ * This method will clear the current configuration and then re-initialize it with the default
+ * values, application-specific configuration file, user-supplied properties (if any), and then
+ * command-line settings.
+ * <p>
+ * This method <strong><em>MUST</em></strong> be called holding the configuration lock!
+ * </p>
+ * <p>
+ * This method is a little special in that logging messages generated during the method must be
+ * cached and delayed until after the logging framework has been initialized. After that, the
+ * delayed logging buffer can be dumped to the log file and cleared.
+ * </p>
+ *
+ * @param props Application-supplied configuration values, if any
+ */
+ private static void initialize(final Properties props) {
+ DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
+ Date now = new Date();
+ logger.info(
+ "------------------------------------------------------------------------------");
+
+ logger.info(Msg.CONFIGURATION_STARTED, format.format(now));
+
+ /*
+ * Clear any existing properties
+ */
+ config.clear();
+ logger.info(Msg.CONFIGURATION_CLEARED);
+
+ /*
+ * Load the defaults (if any are present)
+ */
+ InputStream in = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(DEFAULT_PROPERTIES);
+ if (in != null) {
+ logger.info(Msg.LOADING_DEFAULTS, DEFAULT_PROPERTIES);
+ try {
+ config.setProperties(in);
+ } finally {
+ try {
+ in.close();
+ } catch (IOException e) {
+ logger.error("Cannot close inputStream: " + LoggingUtils.formatException(e));
+ }
+ }
+ for (String key : config.getProperties().stringPropertyNames()) {
+
+ if ((!StringUtils.containsIgnoreCase(key, "pass"))&&(!StringUtils.containsIgnoreCase(key, "secret")))
+ logger.info(Msg.PROPERTY_VALUE, key, config.getProperty(key));
+ else
+ logger.info(Msg.PROPERTY_VALUE, key, "XXXX");
+ }
+ } else {
+ logger.info(Msg.NO_DEFAULTS_FOUND, DEFAULT_PROPERTIES);
+ }
+
+ /*
+ * Look for application configuration property file. By default, we will look for the file
+ * "cdp.properties" on the user home path, then on "./etc" (relative to current path), then
+ * on "../etc" (relative to current path). If we do not find any property file, then we
+ * continue. Otherwise, we load the first property file we find and then continue. In order
+ * to allow default values for the filename and paths to be searched, we first attempt to
+ * obtain these from our configuration object (which should be primed with default values
+ * and/or overridden with application-specified values). We then use the values obtained
+ * from that to get any user supplied values on the command line.
+ */
+ String filename = config.getProperty(Configuration.PROPERTY_BOOTSTRAP_FILE_NAME,
+ Configuration.DEFAULT_BOOTSTRAP_FILE_NAME);
+ filename = System.getProperty(Configuration.PROPERTY_BOOTSTRAP_FILE_NAME, filename);
+ String env = System.getenv(Configuration.PROPERTY_BOOTSTRAP_FILE_NAME);
+ if (env != null && env.trim().length() > 0) {
+ filename = env;
+ }
+
+ String path = config.getProperty(Configuration.PROPERTY_BOOTSTRAP_FILE_PATH,
+ Configuration.DEFAULT_BOOTSTRAP_FILE_PATH);
+ path = System.getProperty(Configuration.PROPERTY_BOOTSTRAP_FILE_PATH, path);
+ env = System.getenv(Configuration.PROPERTY_BOOTSTRAP_FILE_PATH);
+ if (env != null && env.trim().length() > 0) {
+ path = env;
+ }
+
+ logger.info(Msg.SEARCHING_CONFIGURATION_OVERRIDES, path, filename);
+
+ String[] pathElements = path.split(COMMA);
+ boolean found = false;
+ for (String pathElement : pathElements) {
+ File file = new File(pathElement, filename);
+ if (file.exists() && file.canRead() && !file.isDirectory()) {
+
+ logger.info(Msg.LOADING_CONFIGURATION_OVERRIDES, file.getAbsolutePath());
+ Properties fileProperties = new Properties();
+ BufferedInputStream stream = null;
+ try {
+ stream = new BufferedInputStream(new FileInputStream(file));
+ fileProperties.load(stream);
+ for (String key : fileProperties.stringPropertyNames()) {
+ if ((!StringUtils.containsIgnoreCase(key, "pass"))&&(!StringUtils.containsIgnoreCase(key, "secret")))
+ logger.debug(Msg.PROPERTY_VALUE, key, fileProperties.getProperty(key));
+ else
+ logger.info(Msg.PROPERTY_VALUE, key, "XXXX");
+ config.setProperty(key, fileProperties.getProperty(key));
+ }
+ found = true;
+ break;
+ } catch (IOException e) {
+ logger.error(LoggingUtils.formatException(e));
+ } finally {
+ try {
+ if (stream != null) {
+ stream.close();
+ }
+ } catch (IOException e) {
+ logger.error("Unable to close stream: " + LoggingUtils.formatException(e));
+ }
+ }
+ }
+ }
+
+ if (!found) {
+ logger.warn(Msg.NO_OVERRIDE_PROPERTY_FILE_LOADED, filename, path);
+ }
+
+ /*
+ * Apply any application-specified properties
+ */
+ if (props != null) {
+ logger.info(Msg.LOADING_APPLICATION_OVERRIDES);
+ for (String key : props.stringPropertyNames()) {
+ if ((!StringUtils.containsIgnoreCase(key, "pass"))&&(!StringUtils.containsIgnoreCase(key, "secret")))
+ logger.debug(Msg.PROPERTY_VALUE, key, props.getProperty(key));
+ else
+ logger.info(Msg.PROPERTY_VALUE, key, "XXXX");
+ config.setProperty(key, props.getProperty(key));
+ }
+ } else {
+ logger.info(Msg.NO_APPLICATION_OVERRIDES);
+ }
+
+ /*
+ * Merge in the System.properties to pick-up any command line arguments (-Dkeyword=value)
+ */
+ logger.info(Msg.MERGING_SYSTEM_PROPERTIES);
+ config.setProperties(System.getProperties());
+
+ /*
+ * As a convenience, copy the "specialProperties" that are not defined in System.properties
+ * from the configuration back to the system properties object.
+ */
+ for (String key : config.getProperties().stringPropertyNames()) {
+ for (String specialProperty : specialProperties) {
+ if (key.equals(specialProperty) && !System.getProperties().containsKey(key)) {
+ System.setProperty(key, config.getProperty(key));
+ logger.info(Msg.SETTING_SPECIAL_PROPERTY, key, config.getProperty(key));
+ }
+ }
+ }
+
+ /*
+ * Initialize the resource manager by loading the requested bundles, if any are defined.
+ * Resource bundles may be specified as a comma-delimited list of names. These resource
+ * names are base names of resource bundles, do not include the language or country code, or
+ * the ".properties" extension. The actual loading of the resource bundles is done lazily
+ * when requested the first time. If the bundle does not exist, or cannot be loaded, it is
+ * ignored.
+ */
+ String resourcesList = config.getProperty(Configuration.PROPERTY_RESOURCE_BUNDLES,
+ Configuration.DEFAULT_RESOURCE_BUNDLES);
+ String[] resources = resourcesList.split(",");
+ for (String resource : resources) {
+ logger.info(Msg.LOADING_RESOURCE_BUNDLE, resource.trim());
+ EELFResourceManager.loadMessageBundle(resource.trim());
+ }
+ }
+}
diff --git a/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/DefaultConfiguration.java b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/DefaultConfiguration.java
new file mode 100644
index 000000000..319b9f0b6
--- /dev/null
+++ b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/DefaultConfiguration.java
@@ -0,0 +1,565 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.utils.configuration;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.security.CodeSource;
+import java.security.ProtectionDomain;
+import java.security.Provider;
+import java.security.Provider.Service;
+import java.security.Security;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.jar.JarFile;
+import java.util.jar.Manifest;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import org.onap.ccsdk.sli.core.utils.encryption.EncryptionTool;
+import org.onap.ccsdk.sli.core.utils.logging.LoggingUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This class provides the implementation of the <code>Configuration</code> interface. It is created
+ * by the ConfigurationFactory and initialized with the configuration values for the process.
+ *
+ * @since Mar 18, 2014
+ */
+public final class DefaultConfiguration implements Configuration, Cloneable {
+
+ private static final Logger logger = LoggerFactory.getLogger(DefaultConfiguration.class);
+
+ /**
+ * The framework configuration properties.
+ */
+ private Properties properties = new Properties();
+
+ /**
+ * Construct the configuration object.
+ */
+ DefaultConfiguration() {}
+
+ /**
+ * Clears all properties
+ */
+ public void clear() {
+ properties.clear();
+ }
+
+ /**
+ * @see Object#clone()
+ */
+ @Override
+ protected Object clone() throws CloneNotSupportedException {
+ DefaultConfiguration clone = (DefaultConfiguration) super.clone();
+
+ clone.properties = new Properties(this.properties);
+ clone.properties.putAll(this.properties);
+
+ return clone;
+ }
+
+ /**
+ * Decrypts an encrypted value, if it is encrypted, and returns the clear text. Performs no
+ * operation on the string if it is not encrypted.
+ *
+ * @param value The value to (optionally) be decrypted
+ * @return The clear text
+ */
+ @SuppressWarnings("nls")
+ private static String decrypt(String value) {
+ if (value != null && value.startsWith(EncryptionTool.ENCRYPTED_VALUE_PREFIX)) {
+ try {
+ return EncryptionTool.getInstance().decrypt(value);
+ } catch (Exception e) {
+ StringBuilder out = new StringBuilder();
+ for (Provider p : Security.getProviders()) {
+ for (Service s : p.getServices()) {
+ String algo = s.getAlgorithm();
+ out.append(String.format(
+ "\n==Found Algorithm [ %s ] in provider [ %s ] and service [ %s ]",
+ algo, p.getName(), s.getClassName()));
+ }
+ }
+ logger.debug(out.toString());
+ logger.warn(String.format("Could not decrypt the configuration value [%s]", value),
+ e);
+ }
+ }
+ return value;
+ }
+
+ /**
+ * Decrypts all elements in the properties object
+ */
+ private void decryptAllProperties() {
+ if (properties != null) {
+ for (Entry<Object, Object> e : properties.entrySet()) {
+ if (e.getValue() != null) {
+ e.setValue(decrypt(e.getValue().toString()));
+ }
+ }
+ }
+ }
+
+ /**
+ * @see Object#equals(Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+
+ if (obj == null) {
+ return false;
+ }
+
+ if (this.getClass() != obj.getClass()) {
+ return false;
+ }
+
+ DefaultConfiguration other = (DefaultConfiguration) obj;
+
+ return (this.properties.size() == other.properties.size())
+ && (this.properties.entrySet().containsAll(other.properties.entrySet()))
+ && (other.properties.entrySet().containsAll(this.properties.entrySet()));
+
+ }
+
+ /**
+ * This method will use the properties object to expand any variables that may be present in the
+ * template provided. Variables are represented by the string "${name}", where "name" is the
+ * name of a property defined in either the current configuration object, or system properties
+ * if undefined. If the value cannot be found, the variable is removed and an empty string is
+ * used to replace the variable.
+ *
+ * @param template The template to be expanded
+ * @return The expanded template where each variable is replaced with its value
+ */
+ @SuppressWarnings("nls")
+ private String expandVariables(String template) {
+ if (template == null) {
+ return null;
+ }
+
+ // Decrypt the template if needed
+ // template = decrypt(template); DH: Do not assign values to parameters, bad form! Also,
+ // Sonar complains
+ // bitterly
+
+ StringBuilder builder = new StringBuilder(decrypt(template));
+ Pattern pattern = Pattern.compile("\\$\\{([^\\}]+)\\}");
+ Matcher matcher = pattern.matcher(builder);
+ while (matcher.find()) {
+ String variable = matcher.group(1);
+ String value = properties.getProperty(variable);
+ if (value == null) {
+ value = System.getProperty(variable);
+ }
+ if (value == null) {
+ value = "";
+ }
+ builder.replace(matcher.start(), matcher.end(), value);
+
+ matcher.reset();
+ }
+ return builder.toString().trim();
+ }
+
+ /**
+ * This method is called to obtain a property expressed as a boolean value (true or false). The
+ * standard rules for Boolean.parseBoolean() are used.
+ *
+ * @param key The property key
+ * @return The value of the property expressed as a boolean, or false if it does not exist.
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public boolean getBooleanProperty(String key) {
+ return Boolean.valueOf(getProperty(key, "false"));
+ }
+
+ /**
+ * This method is called to obtain a property expressed as a boolean value (true or false). The
+ * standard rules for Boolean.valueOf(String) are used.
+ *
+ * @param key The property key
+ * @param defaultValue The default value to be returned if the property does not exist
+ * @return The value of the property expressed as a boolean, or false if it does not exist.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getBooleanProperty(String, boolean)
+ */
+ @Override
+ public boolean getBooleanProperty(String key, boolean defaultValue) {
+ if (isPropertyDefined(key)) {
+ return getBooleanProperty(key);
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Returns the indicated property value expressed as a floating point double-precision value
+ * (double).
+ *
+ * @param key The property to retrieve
+ * @return The value of the property, or 0.0 if not found
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getDoubleProperty(String)
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public double getDoubleProperty(String key) {
+ try {
+ return Double.valueOf(getProperty(key, "0.0"));
+ } catch (NumberFormatException e) {
+ return 0.0;
+ }
+ }
+
+ /**
+ * This method is called to obtain a property as a string value
+ *
+ * @param key The key of the property
+ * @param defaultValue The default value to be returned if the property does not exist
+ * @return The string value, or null if it does not exist.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getDoubleProperty(String, double)
+ */
+ @Override
+ public double getDoubleProperty(String key, double defaultValue) {
+ if (isPropertyDefined(key)) {
+ return getDoubleProperty(key);
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Returns the property indicated expressed as an integer. The standard rules for
+ * {@link Integer#parseInt(String, int)} using a radix of 10 are used.
+ *
+ * @param key The property name to retrieve.
+ * @return The value of the property, or 0 if it does not exist or is invalid.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getIntegerProperty(String)
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public int getIntegerProperty(String key) {
+ try {
+ return Integer.parseInt(getProperty(key, "0"), 10);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+
+ /**
+ * Returns the property indicated expressed as an integer. The standard rules for
+ * Integer.parseInt(String, int) using a radix of 10 are used.
+ *
+ * @param key The property name to retrieve.
+ * @param defaultValue The default value to be returned if the property does not exist
+ * @return The value of the property, or 0 if it does not exist or is invalid.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getIntegerProperty(String, int)
+ */
+ @Override
+ public int getIntegerProperty(String key, int defaultValue) {
+ if (isPropertyDefined(key)) {
+ return getIntegerProperty(key);
+ }
+ return defaultValue;
+ }
+
+ /**
+ * Returns the specified property as a long integer value, if it exists, or zero if it does not.
+ *
+ * @param key The key of the property desired.
+ * @return The value of the property expressed as an integer long value, or zero if the property
+ * does not exist or is not a valid integer long.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getLongProperty(String)
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public long getLongProperty(String key) {
+ try {
+ return Long.parseLong(getProperty(key, "0"), 10);
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+
+ /**
+ * Returns the specified property as a long integer value, if it exists, or the default value if
+ * it does not exist or is invalid.
+ *
+ * @param key The key of the property desired.
+ * @param defaultValue the value to be returned if the property is not valid or does not exist.
+ * @return The value of the property expressed as an integer long value, or the default value if
+ * the property does not exist or is not a valid integer long.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getLongProperty(String, long)
+ */
+ @Override
+ public long getLongProperty(String key, long defaultValue) {
+ if (isPropertyDefined(key)) {
+ return getLongProperty(key);
+ }
+ return defaultValue;
+ }
+
+ /**
+ * This method can be called to retrieve a properties object that is immutable. Any attempt to
+ * modify the properties object returned will result in an exception. This allows a caller to
+ * view the current configuration as a set of properties.
+ *
+ * @return An unmodifiable properties object.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getProperties()
+ */
+ @Override
+ public Properties getProperties() {
+ return new UnmodifiableProperties(properties);
+ }
+
+ /**
+ * This method is called to obtain a property as a string value
+ *
+ * @param key The key of the property
+ * @return The string value, or null if it does not exist.
+ */
+ @Override
+ public String getProperty(String key) {
+ String value = properties.getProperty(key);
+ if (value == null) {
+ return null;
+ }
+ return expandVariables(value.trim());
+ }
+
+ /**
+ * This method is called to obtain a property as a string value
+ *
+ * @param key The key of the property
+ * @param defaultValue The default value to be returned if the property does not exist
+ * @return The string value, or null if it does not exist.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#getProperty(String,
+ * String)
+ */
+ @Override
+ public String getProperty(String key, String defaultValue) {
+ if (isPropertyDefined(key)) {
+ return getProperty(key);
+ }
+
+ if (defaultValue == null) {
+ return null;
+ }
+
+ return expandVariables(defaultValue.trim());
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return properties == null ? 0 : properties.hashCode();
+ }
+
+ /**
+ * Returns true if the named property is defined, false otherwise.
+ *
+ * @param key The key of the property we are interested in
+ * @return True if the property exists.
+ */
+ @Override
+ public boolean isPropertyDefined(String key) {
+ return properties.containsKey(key);
+ }
+
+ /**
+ * Returns an indication of the validity of the boolean property. A boolean property is
+ * considered to be valid only if it has the value "true" or "false" (ignoring case).
+ *
+ * @param key The property to be checked
+ * @return True if the value is a boolean constant, or false if it does not exist or is not a
+ * correct string
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#isValidBoolean(String)
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public boolean isValidBoolean(String key) {
+ String value = getProperty(key);
+ if (value != null) {
+ value = value.toLowerCase();
+ return value.matches("true|false");
+ }
+ return false;
+ }
+
+ /**
+ * Returns an indication if the indicated property represents a valid double-precision floating
+ * point number.
+ *
+ * @param key The property to be examined
+ * @return True if the property is a valid representation of a double, or false if it does not
+ * exist or contains illegal characters.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#isValidDouble(String)
+ */
+ @Override
+ public boolean isValidDouble(String key) {
+ String value = getProperty(key);
+ if (value != null) {
+ try {
+ Double.valueOf(value);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns an indication if the property is a valid integer value or not.
+ *
+ * @param key The key of the property to check
+ * @return True if the value is a valid integer string, or false if it does not exist or
+ * contains illegal characters.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#isValidInteger(String)
+ */
+ @Override
+ public boolean isValidInteger(String key) {
+ String value = getProperty(key);
+ if (value != null) {
+ try {
+ Integer.parseInt(value.trim(), 10);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Determines is the specified property exists and is a valid representation of an integer long
+ * value.
+ *
+ * @param key The property to be checked
+ * @return True if the property is a valid representation of an integer long value, and false if
+ * it either does not exist or is not valid.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#isValidLong(String)
+ */
+ @Override
+ public boolean isValidLong(String key) {
+ String value = getProperty(key);
+ if (value != null) {
+ try {
+ Long.parseLong(value.trim(), 10);
+ return true;
+ } catch (NumberFormatException e) {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This method allows an implementation to load configuration properties that may override
+ * default values.
+ *
+ * @param is An input stream that contains the properties to be loaded
+ */
+ public void setProperties(InputStream is) {
+ try {
+ properties.load(is);
+ } catch (IOException e) {
+ logger.warn("setProperties with inputStream got exception", e);
+ }
+ }
+
+ /**
+ * This method allows an implementation to load configuration properties that may override
+ * default values.
+ *
+ * @param props An optional Properties object to be merged into the configuration, replacing any
+ * same-named properties.
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#setProperties(Properties)
+ */
+ @Override
+ public void setProperties(Properties props) {
+ properties.putAll(props);
+ decryptAllProperties();
+ }
+
+ /**
+ * This method allows a caller to insert a new property definition into the configuration
+ * object. This allows the application to adjust or add to the current configuration. If the
+ * property already exists, it is replaced with the new value.
+ *
+ * @param key The key of the property to be defined
+ * @param value The value of the property to be defined
+ * @see org.onap.ccsdk.sli.core.utils.configuration.Configuration#setProperty(String,
+ * String)
+ */
+ @Override
+ public void setProperty(String key, String value) {
+ properties.setProperty(key, decrypt(value));
+ }
+
+ /**
+ * @see Object#toString()
+ */
+ @SuppressWarnings("nls")
+ @Override
+ public String toString() {
+ return String.format("Configuration: %d properties, keys:[%s]", properties.size(),
+ properties.keySet().toString());
+ }
+
+ /**
+ * This is a helper method to read the manifest of the jar file that this class was loaded from.
+ * Note that this will only work if the code is packaged in a jar file. If it is an open
+ * deployment, such as under eclipse, this will not work and there is code added to detect that
+ * case.
+ *
+ * @return The manifest object from the jar file, or null if the code is not packaged in a jar
+ * file.
+ */
+ @SuppressWarnings({"unused", "nls"})
+ private Manifest getManifest() {
+ ProtectionDomain domain = getClass().getProtectionDomain();
+ CodeSource source = domain.getCodeSource();
+ URL location = source.getLocation();
+ String path = location.getPath();
+ int index = path.indexOf('!');
+ if (index != -1) {
+ path = path.substring(0, index);
+ }
+ if (path.endsWith(".jar")) {
+ try (JarFile jar = new JarFile(location.getFile())) {
+ return jar.getManifest();
+ } catch (IOException e) {
+ logger.error("getManifest: " + LoggingUtils.formatException(e));
+ }
+ }
+
+ return null;
+ }
+}
diff --git a/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/UnmodifiableProperties.java b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/UnmodifiableProperties.java
new file mode 100644
index 000000000..539b4ed7e
--- /dev/null
+++ b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/UnmodifiableProperties.java
@@ -0,0 +1,354 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.utils.configuration;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.InvalidPropertiesFormatException;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+/**
+ * This utility class is used to wrap a properties object and to delegate all read operations to the property object,
+ * while disallowing any write or modification to the property object.
+ *
+ */
+public class UnmodifiableProperties extends Properties implements Cloneable {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 1L;
+
+ private static final String PROPERTY_CANNOT_BE_MODIFIED_MSG = "Property cannot be modified!";
+
+ /**
+ * The properties object which we are wrapping
+ */
+ private Properties properties;
+
+ /**
+ * Create the unmodifiable wrapper around the provided properties object
+ *
+ * @param properties
+ * The properties to be wrapped and protected from modification
+ */
+ public UnmodifiableProperties(Properties properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * @see java.util.Hashtable#clear()
+ */
+ @Override
+ public synchronized void clear() {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see java.util.Hashtable#clone()
+ */
+ // @sonar:off
+ @Override
+ public synchronized Object clone() {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ // @sonar:on
+
+ /**
+ * @see java.util.Hashtable#contains(Object)
+ */
+ @Override
+ public synchronized boolean contains(Object value) {
+ return properties.contains(value);
+ }
+
+ /**
+ * @see java.util.Hashtable#containsKey(Object)
+ */
+ @Override
+ public synchronized boolean containsKey(Object key) {
+ return properties.containsKey(key);
+ }
+
+ /**
+ * @see java.util.Hashtable#containsValue(Object)
+ */
+ @Override
+ public boolean containsValue(Object value) {
+ return properties.containsValue(value);
+ }
+
+ /**
+ * @see java.util.Hashtable#elements()
+ */
+ @Override
+ public synchronized Enumeration<Object> elements() {
+ return properties.elements();
+ }
+
+ /**
+ * @see java.util.Hashtable#entrySet()
+ */
+ @Override
+ public Set<Map.Entry<Object, Object>> entrySet() {
+ return Collections.unmodifiableSet(properties.entrySet());
+ }
+
+ /**
+ * @see java.util.Hashtable#equals(Object)
+ */
+ @Override
+ public synchronized boolean equals(Object o) {
+ return properties.equals(o);
+ }
+
+ /**
+ * @see java.util.Hashtable#get(Object)
+ */
+ @Override
+ public synchronized Object get(Object key) {
+ return properties.get(key);
+ }
+
+ /**
+ * @see Properties#getProperty(String)
+ */
+ @Override
+ public String getProperty(String key) {
+ return properties.getProperty(key);
+ }
+
+ /**
+ * @see Properties#getProperty(String, String)
+ */
+ @Override
+ public String getProperty(String key, String defaultValue) {
+ return properties.getProperty(key, defaultValue);
+ }
+
+ /**
+ * @see java.util.Hashtable#hashCode()
+ */
+ @Override
+ public synchronized int hashCode() {
+ return properties.hashCode();
+ }
+
+ /**
+ * @see java.util.Hashtable#isEmpty()
+ */
+ @Override
+ public synchronized boolean isEmpty() {
+ return properties.isEmpty();
+ }
+
+ /**
+ * @see java.util.Hashtable#keys()
+ */
+ @Override
+ public synchronized Enumeration<Object> keys() {
+ return properties.keys();
+ }
+
+ /**
+ * @see java.util.Hashtable#keySet()
+ */
+ @Override
+ public Set<Object> keySet() {
+ return Collections.unmodifiableSet(properties.keySet());
+ }
+
+ /**
+ * @see Properties#list(PrintStream)
+ */
+ @Override
+ public void list(PrintStream out) {
+ properties.list(out);
+ }
+
+ /**
+ * @see Properties#list(PrintWriter)
+ */
+ @Override
+ public void list(PrintWriter out) {
+ properties.list(out);
+ }
+
+ /**
+ * @see Properties#load(InputStream)
+ */
+ @Override
+ public synchronized void load(InputStream inStream) throws IOException {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see Properties#load(Reader)
+ */
+ @Override
+ public synchronized void load(Reader reader) throws IOException {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see Properties#loadFromXML(InputStream)
+ */
+ @Override
+ public synchronized void loadFromXML(InputStream in) throws IOException, InvalidPropertiesFormatException {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see Properties#propertyNames()
+ */
+ @Override
+ public Enumeration<?> propertyNames() {
+ return properties.propertyNames();
+ }
+
+ /**
+ * @see java.util.Hashtable#put(Object, Object)
+ */
+ @Override
+ public synchronized Object put(Object key, Object value) {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see java.util.Hashtable#putAll(Map)
+ */
+ @Override
+ public synchronized void putAll(Map<? extends Object, ? extends Object> t) {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see java.util.Hashtable#rehash()
+ */
+ @Override
+ protected void rehash() {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see java.util.Hashtable#remove(Object)
+ */
+ @Override
+ public synchronized Object remove(Object key) {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see Properties#save(OutputStream, String)
+ */
+ @Override
+ @Deprecated
+ public synchronized void save(OutputStream out, String comments) {
+ properties.save(out, comments);
+ }
+
+ /**
+ * @see Properties#setProperty(String, String)
+ */
+ @Override
+ public synchronized Object setProperty(String key, String value) {
+ throw new UnsupportedOperationException(PROPERTY_CANNOT_BE_MODIFIED_MSG);
+ }
+
+ /**
+ * @see java.util.Hashtable#size()
+ */
+ @Override
+ public synchronized int size() {
+ return properties.size();
+ }
+
+ /**
+ * @see Properties#store(OutputStream, String)
+ */
+ @Override
+ public void store(OutputStream out, String comments) throws IOException {
+ properties.store(out, comments);
+ }
+
+ /**
+ * @see Properties#store(Writer, String)
+ */
+ @Override
+ public void store(Writer writer, String comments) throws IOException {
+ properties.store(writer, comments);
+ }
+
+ /**
+ * @see Properties#storeToXML(OutputStream, String)
+ */
+ @Override
+ public synchronized void storeToXML(OutputStream os, String comment) throws IOException {
+ properties.storeToXML(os, comment);
+ }
+
+ /**
+ * @see Properties#storeToXML(OutputStream, String, String)
+ */
+ @Override
+ public synchronized void storeToXML(OutputStream os, String comment, String encoding) throws IOException {
+ properties.storeToXML(os, comment, encoding);
+ }
+
+ /**
+ * @see Properties#stringPropertyNames()
+ */
+ @Override
+ public Set<String> stringPropertyNames() {
+ return properties.stringPropertyNames();
+ }
+
+ /**
+ * @see java.util.Hashtable#toString()
+ */
+ @Override
+ public synchronized String toString() {
+ return properties.toString();
+ }
+
+ /**
+ * @see java.util.Hashtable#values()
+ */
+ @Override
+ public Collection<Object> values() {
+ return Collections.unmodifiableCollection(properties.values());
+ }
+}
diff --git a/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/package.html b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/package.html
new file mode 100644
index 000000000..059821d2f
--- /dev/null
+++ b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/configuration/package.html
@@ -0,0 +1,173 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Copyright (C) 2017 Amdocs
+ =============================================================================
+ 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.
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+
+<html>
+<head>
+<title>Configuration</title>
+</head>
+
+<body>
+ <p style="margin-left: 30.0px;">
+ CDP Configuration support is provided by a common framework to load
+ and manage configuration properties from multiple sources. The basic
+ concept is to load a set of default properties from a known resource
+ file located on the class path, and then override these defaults
+ with optional settings that can be provided by a user through either
+ additional property files or via the command line (as VM arguments).
+ The loading of defaults from a resource property file (named <strong>com/att/cdp/default.properties</strong>)
+ ensures that values are defined for properties the application needs
+ in order to operate.
+ </p>
+ <p style="margin-left: 30.0px;">
+ One of these default values that can be set is the name of the
+ property file that allows the user to supply settings, as well as
+ the path where the file can be found. In general, the default name
+ of the property file will be &quot;<strong>cdp.properties</strong>&quot;,
+ and the path that will be searched is &quot;<strong>${user.home};etc;../etc</strong>&quot;.
+ However, these values can be changed through the use of the
+ default.properties resource file. The property that specifies the
+ property file name is named <strong>com.att.cdp.bootstrap.file</strong>,
+ while the property named <strong>com.att.cdp.bootstrap.path</strong>
+ specifies the search path.
+ </p>
+ <p style="margin-left: 30.0px;">
+ After the default.properties are loaded, but prior to searching for
+ the application configuration file, the configuration factory checks
+ for properties <strong>com.att.cdp.bootstrap.path</strong> and <strong>com.att.cdp.bootstrap.file
+ </strong>in the System properties object (meaning they were set by the
+ command line). If these values are defined in the system properties
+ object, they are used. If not, these values are obtained from the
+ default properties just loaded. This allows the specification of
+ either the file name or path, or both, to be overridden during start
+ up by using command-line arguments.
+ </p>
+ <p style="margin-left: 30.0px;">The search path is scanned for the
+ first occurrence of the specified property file. The first
+ occurrence is loaded and scanning is stopped at that point. The
+ configuration factory does not load all occurrences it finds, only
+ the first occurrence it finds.</p>
+ <p style="margin-left: 30.0px;">The configuration properties are
+ loaded and processed according to a defined precedence order, such
+ that properties defined with a higher precedence override the same
+ property at a lower precedence. The precedence order is defined as
+ follows:</p>
+ <h2>Precedence Order</h2>
+ <ol>
+ <li>Default properties are initially loaded into the
+ configuration. These default properties are the lowest level
+ precedence, and will be overridden by any properties specified at
+ higher levels. These are loaded from resources that are packaged
+ as part of the various application components. Each component
+ (Server, Coordinator, EPM, or CLI) may have different default
+ properties. The default properties are loaded from a resource
+ named <strong>com/att/cdp/default.properties</strong>. The default
+ properties can specify the name of the application property file
+ to be used to configure the application, as well as the path to
+ search. Additionally, these properties can be supplied via the
+ command line to override the default settings if needed.<br /> <br />
+ </li>
+ <li>The configuration factory allows for the application to
+ supply an initial properties object to initialize the
+ configuration. This properties object could be loaded or created
+ in any way necessary for the application. This is totally up to
+ the application to define, if it is needed. If no
+ application-specific property object is supplied, this step is
+ skipped. If a property object is supplied, it is used to replace
+ or set any properties that may have been defined by the defaults.<br />
+ <br />
+ </li>
+ <li>The configuration factory will then search for a bootstrap
+ file on a bootstrap path. The actual bootstrap file name and path
+ can be specified as properties on the command line, or will
+ default to a file name of <strong>cdp.properties</strong> and a
+ path of <strong>${user.home};etc;../etc</strong>. If desired, the
+ user can specify the exact name of the property file to be loaded
+ as well as the path using <strong>-Dcom.att.cdp.bootstrap.file=&lt;filename&gt;</strong>
+ and <strong>-Dcom.att.cdp.bootstrap.path=&lt;path&gt;</strong>.
+ These properties are set to default values by the default
+ properties loaded in step #1 above. The first occurrence of a
+ property file is the file loaded and used. Any other occurrences
+ are not processed.<br /> <br />
+ </li>
+ <li>The System properties are then merged into the
+ configuration. This allows the highest level of precedence,
+ command-line VM arguments (-D<strong>name=value</strong>) to be
+ merged into the configuration property object. These settings
+ override all lower level settings of the same name, as well as
+ merge all system properties into the configuration object.
+ </li>
+ </ol>
+ <h2>Variables</h2>
+ <p style="margin-left: 30.0px;">
+ The configuration support allows for variables to be inserted into
+ any property that is defined. Variables are named using the format <strong>${name}</strong>,
+ where the &quot;name&quot; is the name of a property that is defined
+ in the configuration, or a system property (such as <strong>user.home</strong>).
+ Variables can nest, such that a variable can be replaced with
+ another variable, which is then reevaluated to obtain the value.
+ This allows for indirection as well as variable substitution, if
+ needed.
+ </p>
+ <h2>Using the Configuration Support</h2>
+ <p style="margin-left: 30.0px;">
+ The configuration support was designed to be easy to use. The
+ configuration implementation is abstracted away from the application
+ so that it could be changed easily in the future if needed, or if we
+ needed to load different implementations for different reasons. This
+ means that the application always accesses the configuration through
+ an interface, named <strong>Configuration</strong>. The
+ implementation of that configuration interface is obtained by a
+ static method on the <strong>ConfigurationFactory</strong> class.
+ The configuration factory will both create the configuration if not
+ already created on the first access, as well as return the current
+ configuration if already created. Additionally, the
+ ConfigurationFactory provides mechanisms to recreate the
+ configuration after the application is initialized should the need
+ arise to update its configuration.
+ </p>
+ <p style="margin-left: 30.0px;">An example of the code needed to
+ obtain access to the configuration is:</p>
+ <pre style="margin-left: 30.0px;">Configuration config = ConfigurationFactory.getConfiguration();</pre>
+ <p style="margin-left: 30.0px;">Please refer to the javadoc or the
+ source code in cdp-common for other ways that the configuration and
+ configuration factory can be used.</p>
+ <h2>Reloading Properties</h2>
+ <p style="margin-left: 30.0px;">The configuration support allows
+ for properties to be re-loaded and re-evaluated after the
+ application is running. This is designed to allow a configuration to
+ be refreshed should the need arise. This could allow on-demand
+ refresh (via a command, for example), or automatically based on
+ sensing a change in the configuration file.</p>
+ <p style="margin-left: 30.0px;">
+ When the <strong>ConfigurationFactory</strong> method <strong>getConfiguration(Propert</strong><strong>ies)</strong>
+ is called, the current configuration is cleared and rebuilt using
+ the process defined above. The supplied property object is used in
+ step #2 of the process. While the properties are being re-built, no
+ access to the properties are allowed. Any attempt to access
+ properties while the re-build operation is in effect will block the
+ caller until completed. This is accomplished using read and write
+ shared locks.
+ </p>
+</body>
+</html>
diff --git a/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/LoggingConstants.java b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/LoggingConstants.java
new file mode 100644
index 000000000..6ef270d21
--- /dev/null
+++ b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/LoggingConstants.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.utils.logging;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Constant definition of logging
+ */
+public class LoggingConstants {
+ private LoggingConstants() {
+ throw new IllegalAccessError("LoggingConstants");
+ }
+
+ /**
+ * Constants of MDC property keys
+ */
+ public static class MDCKeys {
+ private MDCKeys() {
+ throw new IllegalAccessError("MDCKeys");
+ }
+
+ public static final String REQUEST_ID = "RequestID";
+ public static final String INSTANCE_ID = "InstanceUUID";
+ public static final String SERVICE_INSTANCE_ID = "ServiceInstanceID";
+ public static final String ERROR_CODE = "ErrorCode";
+ public static final String ERROR_DESCRIPTION = "ErrorDescription";
+ public static final String STATUS_CODE = "StatusCode";
+ public static final String RESPONSE_CODE = "ResponseCode";
+ public static final String RESPONSE_DESCRIPTION = "ResponseDescription";
+ public static final String TARGET_ENTITY = "TargetEntity";
+ public static final String TARGET_SERVICE_NAME = "TargetServiceName";
+ public static final String PARTNER_NAME = "PartnerName";
+ public static final String SERVER_NAME = "ServerName";
+ public static final String SERVICE_NAME = "ServiceName";
+ public static final String BEGIN_TIMESTAMP = "BeginTimestamp";
+ public static final String END_TIMESTAMP = "EndTimestamp";
+ public static final String ELAPSED_TIME = "ElapsedTime";
+ public static final String MARKER = "Marker";
+ public static final String METRIC_MARKER = "MetricMarker";
+ public static final String MDC_STRING = "MDC";
+ public static final String CUSTOM_FIELD1 = "CustomField1";
+ public static final String CUSTOM_FIELD2 = "CustomField2";
+ public static final String CLIENT_IP_ADDRESS = "ClientIPAddress";
+ public static final String PROCESS_KEY = "ProcessKey";
+ public static final String CLASS_NAME = "ClassName";
+ public static final String TARGET_VIRTUAL_ENTITY = "TargetVirtualEntity";
+ public static final String INVOCATION_ID = "InvocationID";
+
+ public static final List<String> MDC_KEYS = Arrays.asList(
+ BEGIN_TIMESTAMP, END_TIMESTAMP, REQUEST_ID, SERVICE_INSTANCE_ID,
+ ERROR_CODE, SERVER_NAME, SERVICE_NAME, PARTNER_NAME, STATUS_CODE,
+ RESPONSE_CODE, RESPONSE_DESCRIPTION, INSTANCE_ID,
+ ERROR_DESCRIPTION, MARKER, PROCESS_KEY, INVOCATION_ID
+ );
+ }
+
+ /**
+ * Constants of status code values
+ */
+ public static class StatusCodes {
+ private StatusCodes() {
+ throw new IllegalAccessError("StatusCodes");
+ }
+ public static final String COMPLETE = "COMPLETE";
+ public static final String ERROR = "ERROR";
+ }
+
+ /**
+ * Constants of APPC target names
+ */
+ public static class TargetNames {
+ private TargetNames() {
+ throw new IllegalAccessError("TargetNames");
+ }
+ public static final String APPC = "APPC";
+ public static final String AAI = "A&AI";
+ public static final String DB = "DataBase";
+ public static final String APPC_PROVIDER = "APPC Provider";
+ public static final String APPC_OAM_PROVIDER = "APPC OAM Provider";
+ public static final String STATE_MACHINE = "StateMachine";
+ public static final String WORKFLOW_MANAGER = "WorkflowManager";
+ public static final String REQUEST_VALIDATOR = "RequestValidator";
+ public static final String LOCK_MANAGER = "LockManager";
+ public static final String REQUEST_HANDLER = "RequestHandler";
+ }
+
+ /**
+ * Constants of targeted service names
+ */
+ public static class TargetServiceNames {
+ private TargetServiceNames() {
+ throw new IllegalAccessError("TargetServiceNames");
+ }
+
+ /**
+ * Constants of AAI service names
+ */
+ public static class AAIServiceNames {
+ private AAIServiceNames() {
+ throw new IllegalAccessError("AAIServiceNames");
+ }
+ public static final String QUERY = "/aai/v14/network/generic-vnfs/generic-vnf";
+ public static final String GET_VNF_DATA = "getVnfData";
+ }
+
+ }
+
+}
diff --git a/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/LoggingUtils.java b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/LoggingUtils.java
new file mode 100644
index 000000000..d9470ddf2
--- /dev/null
+++ b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/LoggingUtils.java
@@ -0,0 +1,314 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.utils.logging;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
+import com.att.eelf.i18n.EELFResourceManager;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.UUID;
+import org.slf4j.MDC;
+
+import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
+
+/**
+ * Logging utilities
+ */
+public class LoggingUtils {
+
+ private static final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger();
+ private static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
+ private static final EELFLogger metricLogger = EELFManager.getInstance().getMetricsLogger();
+
+ private LoggingUtils() {
+ throw new IllegalAccessError("LoggingUtils");
+ }
+
+
+ public static void logErrorMessage(String errorCode, String errorDescription,
+ String targetEntity, String targetServiceName, String additionalMessage,
+ String className) {
+ logError(errorCode, errorDescription, targetEntity, targetServiceName, additionalMessage,
+ className);
+ }
+
+ public static void logErrorMessage(String targetEntity, String targetServiceName,
+ String additionalMessage, String className) {
+ logError("", "", targetEntity, targetServiceName, additionalMessage, className);
+ }
+
+ public static void logErrorMessage(String targetServiceName, String additionalMessage,
+ String className) {
+ logError("", "", LoggingConstants.TargetNames.APPC, targetServiceName, additionalMessage,
+ className);
+ }
+
+ private static void logError(String errorCode, String errorDescription, String targetEntity,
+ String targetServiceName, String additionalMessage, String className) {
+ populateErrorLogContext(errorCode, errorDescription, targetEntity, targetServiceName,
+ className);
+ int additionalLength = additionalMessage.length()<100 ? additionalMessage.length() : 100;
+ String additionalLog = additionalMessage == null ? "" : additionalMessage.replace("\n", "").substring(0, additionalLength);
+ errorLogger.error(additionalLog);
+ cleanErrorLogContext();
+ }
+
+ public static String formatException(Exception e) {
+ String outStr = EELFResourceManager.format(e);
+ outStr = outStr.replaceAll("[\\n]", "");
+ return outStr;
+ }
+
+ public static void logAuditMessage(Instant beginTimeStamp, Instant endTimeStamp, String code,
+ String responseDescription, String className) {
+ populateAuditLogContext(beginTimeStamp, endTimeStamp, code, responseDescription, className);
+ auditLogger.info(EELFResourceManager.format(Msg.APPC_AUDIT_MSG, MDC.get(MDC_SERVICE_NAME),
+ MDC.get(LoggingConstants.MDCKeys.TARGET_VIRTUAL_ENTITY),
+ MDC.get(LoggingConstants.MDCKeys.PARTNER_NAME), MDC.get(MDC_KEY_REQUEST_ID),
+ MDC.get(LoggingConstants.MDCKeys.BEGIN_TIMESTAMP),
+ MDC.get(LoggingConstants.MDCKeys.END_TIMESTAMP),
+ MDC.get(LoggingConstants.MDCKeys.RESPONSE_CODE)));
+ cleanAuditErrorContext();
+ }
+
+ public static String formMDCString() {
+ //Remove all newlines, tabs, pipes, escape all commas
+ StringBuilder sb = new StringBuilder();
+ for (String key : LoggingConstants.MDCKeys.MDC_KEYS) {
+ String value = MDC.get(key);
+
+ if (value != null) {
+ value = value.replaceAll("[\\n\\t\\|]", "");
+ value = value.replaceAll(",", "\\\\,");
+ }
+ else
+ value = "";
+
+ if (sb.length()==0)
+ sb.append(key + "=" + value);
+ else
+ sb.append("," + key + "=" + value);
+ }
+
+ return sb.toString();
+ }
+
+ public static String formServerFqdnString() {
+ return (System.getenv("fqdn")!=null) ? System.getenv("fqdn") : "www.appc.com";
+ }
+
+ public static void auditInfo(Instant beginTimeStamp, Instant endTimeStamp, String code,
+ String responseDescription, String className, EELFResolvableErrorEnum resourceId,
+ String... arguments) {
+ populateAuditLogContext(beginTimeStamp, endTimeStamp, code, responseDescription, className);
+ auditLogger.info(resourceId, arguments);
+ cleanAuditErrorContext();
+ }
+
+ public static void auditWarn(Instant beginTimeStamp, Instant endTimeStamp, String code,
+ String responseDescription, String className, EELFResolvableErrorEnum resourceId,
+ String... arguments) {
+ populateAuditLogContext(beginTimeStamp, endTimeStamp, code, responseDescription, className);
+ auditLogger.warn(resourceId, arguments);
+ cleanAuditErrorContext();
+ }
+
+ public static void logMetricsMessage(Instant beginTimeStamp, Instant endTimeStamp,
+ String targetEntity, String targetServiceName, String statusCode, String responseCode,
+ String responseDescription, String className) {
+ populateMetricLogContext(beginTimeStamp, endTimeStamp, targetEntity, targetServiceName,
+ statusCode, responseCode, responseDescription, className);
+ metricLogger.info(EELFResourceManager.format(Msg.APPC_METRIC_MSG, MDC.get(MDC_SERVICE_NAME),
+ MDC.get(LoggingConstants.MDCKeys.TARGET_VIRTUAL_ENTITY),
+ MDC.get(LoggingConstants.MDCKeys.PARTNER_NAME), MDC.get(MDC_KEY_REQUEST_ID),
+ MDC.get(LoggingConstants.MDCKeys.TARGET_ENTITY),
+ MDC.get(LoggingConstants.MDCKeys.TARGET_SERVICE_NAME),
+ MDC.get(LoggingConstants.MDCKeys.ELAPSED_TIME),
+ MDC.get(LoggingConstants.MDCKeys.STATUS_CODE)));
+ cleanMetricContext();
+ }
+
+ private static void populateAuditLogContext(Instant beginTimeStamp, Instant endTimeStamp,
+ String code, String responseDescription, String className) {
+ populateTimeContext(beginTimeStamp, endTimeStamp);
+ populateRequestContext();
+ String statusCode = ("100".equals(code) || "400".equals(code))
+ ? LoggingConstants.StatusCodes.COMPLETE : LoggingConstants.StatusCodes.ERROR;
+ populateResponseContext(statusCode, code, responseDescription);
+ MDC.put(LoggingConstants.MDCKeys.CLASS_NAME, className != null ? className : "");
+ MDC.put(LoggingConstants.MDCKeys.MDC_STRING, LoggingUtils.formMDCString());
+ }
+
+ private static void cleanAuditErrorContext() {
+ cleanRequestContext();
+ cleanTimeContext();
+ cleanResponseContext();
+ cleanErrorContext();
+ MDC.remove(LoggingConstants.MDCKeys.CLASS_NAME);
+ }
+
+ private static void populateErrorLogContext(String errorCode, String errorDescription,
+ String targetEntity, String targetServiceName, String className) {
+ populateErrorContext(errorCode, errorDescription);
+ populateTargetContext(targetEntity, targetServiceName != null ? targetServiceName : "");
+ MDC.put(LoggingConstants.MDCKeys.CLASS_NAME, className != null ? className : "");
+ }
+
+ private static void cleanErrorLogContext() {
+ cleanErrorContext();
+ cleanTargetContext();
+ MDC.remove(LoggingConstants.MDCKeys.CLASS_NAME);
+ }
+
+ private static void populateMetricLogContext(Instant beginTimeStamp, Instant endTimeStamp,
+ String targetEntity, String targetServiceName, String statusCode, String responseCode,
+ String responseDescription, String className) {
+ populateRequestContext();
+ populateTimeContext(beginTimeStamp, endTimeStamp);
+ populateTargetContext(targetEntity, targetServiceName);
+ populateResponseContext(statusCode, responseCode, responseDescription);
+ MDC.put(LoggingConstants.MDCKeys.CLASS_NAME, className != null ? className : "");
+ MDC.put(LoggingConstants.MDCKeys.MDC_STRING, LoggingUtils.formMDCString());
+ }
+
+ private static void cleanMetricContext() {
+ cleanRequestContext();
+ cleanTimeContext();
+ cleanTargetContext();
+ cleanResponseContext();
+ MDC.remove(LoggingConstants.MDCKeys.CLASS_NAME);
+ }
+
+ private static void populateTargetContext(String targetEntity, String targetServiceName) {
+ MDC.put(LoggingConstants.MDCKeys.TARGET_ENTITY, targetEntity != null ? targetEntity : "");
+ MDC.put(LoggingConstants.MDCKeys.TARGET_SERVICE_NAME,
+ targetServiceName != null ? targetServiceName : "");
+ }
+
+ private static void cleanTargetContext() {
+ MDC.remove(LoggingConstants.MDCKeys.TARGET_ENTITY);
+ MDC.remove(LoggingConstants.MDCKeys.TARGET_SERVICE_NAME);
+ }
+
+ private static void populateRequestContext() {
+ try {
+ UUID.fromString(MDC.get(MDC_KEY_REQUEST_ID));
+ //reaching here without exception means existing RequestId is
+ //valid UUID as per ECOMP logging standards, no-op
+ } catch (Exception e) {
+ MDC.put(MDC_KEY_REQUEST_ID, UUID.randomUUID().toString());
+ }
+
+ try {
+ String partnerName = MDC.get(LoggingConstants.MDCKeys.PARTNER_NAME);
+
+ //ECOMP logging standards require some value for PartnerName. Default to appc if empty
+ if (partnerName.isEmpty())
+ MDC.put(LoggingConstants.MDCKeys.PARTNER_NAME, "appc");
+ } catch (Exception e) {
+ MDC.put(LoggingConstants.MDCKeys.PARTNER_NAME, "appc");
+ }
+
+ try {
+ String serviceName = MDC.get(MDC_SERVICE_NAME);
+
+ //ECOMP logging standards require some value for ServiceName. Default to DEFAULT if empty
+ if (serviceName.isEmpty())
+ MDC.put(MDC_SERVICE_NAME, "DEFAULT");
+ } catch (Exception e) {
+ MDC.put(MDC_SERVICE_NAME, "DEFAULT");
+ }
+ }
+
+ private static void cleanRequestContext() {
+ MDC.remove(MDC_KEY_REQUEST_ID);
+ MDC.remove(LoggingConstants.MDCKeys.PARTNER_NAME);
+ MDC.remove(MDC_SERVICE_NAME);
+ }
+
+ private static void populateTimeContext(Instant beginTimeStamp, Instant endTimeStamp) {
+ String beginTime = "";
+ String endTime = "";
+ String elapsedTime = "";
+
+ if (beginTimeStamp != null && endTimeStamp != null) {
+ elapsedTime = String.valueOf(ChronoUnit.MILLIS.between(beginTimeStamp, endTimeStamp));
+ beginTime = generateTimestampStr(beginTimeStamp);
+ endTime = generateTimestampStr(endTimeStamp);
+ }
+
+ MDC.put(LoggingConstants.MDCKeys.BEGIN_TIMESTAMP, beginTime);
+ MDC.put(LoggingConstants.MDCKeys.END_TIMESTAMP, endTime);
+ MDC.put(LoggingConstants.MDCKeys.ELAPSED_TIME, elapsedTime);
+ }
+
+ public static String generateTimestampStr(Instant timeStamp) {
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+ TimeZone tz = TimeZone.getTimeZone("UTC");
+ df.setTimeZone(tz);
+ return df.format(Date.from(timeStamp));
+ }
+
+ private static void cleanTimeContext() {
+ MDC.remove(LoggingConstants.MDCKeys.BEGIN_TIMESTAMP);
+ MDC.remove(LoggingConstants.MDCKeys.END_TIMESTAMP);
+ MDC.remove(LoggingConstants.MDCKeys.ELAPSED_TIME);
+ }
+
+ private static void populateResponseContext(String statusCode, String responseCode,
+ String responseDescription) {
+ MDC.put(LoggingConstants.MDCKeys.STATUS_CODE, statusCode != null ? statusCode : "");
+ MDC.put(LoggingConstants.MDCKeys.RESPONSE_CODE, responseCode);
+ MDC.put(LoggingConstants.MDCKeys.RESPONSE_DESCRIPTION,
+ responseDescription != null ? responseDescription : "");
+ }
+
+ private static void cleanResponseContext() {
+ MDC.remove(LoggingConstants.MDCKeys.STATUS_CODE);
+ MDC.remove(LoggingConstants.MDCKeys.RESPONSE_CODE);
+ MDC.remove(LoggingConstants.MDCKeys.RESPONSE_DESCRIPTION);
+ }
+
+ private static void populateErrorContext(String errorCode, String errorDescription) {
+ String pattern = "[1-9]00";
+ //Logging specs mandate errorCode of 100|200|300|400|500|600|700|800|900
+ String errorValue = (errorCode!=null && errorCode.matches(pattern)) ? errorCode : "900";
+ MDC.put(LoggingConstants.MDCKeys.ERROR_CODE, errorValue);
+ MDC.put(LoggingConstants.MDCKeys.ERROR_DESCRIPTION, errorDescription);
+ }
+
+ private static void cleanErrorContext() {
+ MDC.remove(LoggingConstants.MDCKeys.ERROR_CODE);
+ MDC.remove(LoggingConstants.MDCKeys.ERROR_DESCRIPTION);
+ }
+
+}
diff --git a/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/Msg.java b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/Msg.java
new file mode 100644
index 000000000..242676d7d
--- /dev/null
+++ b/core/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/logging/Msg.java
@@ -0,0 +1,869 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.ccsdk.sli.core.utils.logging;
+
+import com.att.eelf.i18n.EELFResolvableErrorEnum;
+import com.att.eelf.i18n.EELFResourceManager;
+
+/**
+ * The messages issued by APPC components.
+ * <p>
+ * This message definition is shared by all APPC components.
+ * </p>
+ *
+ */
+@SuppressWarnings("nls")
+public enum Msg implements EELFResolvableErrorEnum {
+
+ /**
+ * ECOMP Application Controller (APP-C) initialization started at {0}
+ */
+ CONFIGURATION_STARTED,
+
+ /**
+ * Prior configuration has been cleared
+ */
+ CONFIGURATION_CLEARED,
+
+ /**
+ * Loading configuration properties from file "{0}"
+ */
+ LOADING_CONFIGURATION_OVERRIDES,
+
+ /**
+ * Configuration defaults loaded from resource file "{0}"
+ */
+ LOADING_DEFAULTS,
+
+ /**
+ * No default property resource "{0}" was found!
+ */
+ NO_DEFAULTS_FOUND,
+
+ /**
+ * Property "{0}" ="{1}"
+ */
+ PROPERTY_VALUE,
+
+ /**
+ * No configuration file named [{0}] was found on the configuration search path [{1}]. \ If a configuration file
+ * should have been loaded, check the file name and search path specified. CDP will proceed using the \ default
+ * values and command-line overrides (if any).
+ */
+ NO_OVERRIDE_PROPERTY_FILE_LOADED,
+
+ /**
+ * Searching path "{0}" for configuration settings "{1}"
+ */
+ SEARCHING_CONFIGURATION_OVERRIDES,
+
+ /**
+ * Loading application-specific override properties
+ */
+ LOADING_APPLICATION_OVERRIDES,
+
+ /**
+ * No application-specific override properties were provided!
+ */
+ NO_APPLICATION_OVERRIDES,
+
+ /**
+ * Merging system properties into configuration
+ */
+ MERGING_SYSTEM_PROPERTIES,
+
+ /**
+ * Setting property "{0}={1}" in system properties
+ */
+ SETTING_SPECIAL_PROPERTY,
+
+ /**
+ * Loading resource bundle "{0}"
+ */
+ LOADING_RESOURCE_BUNDLE,
+
+ /**
+ * Logging has already been initialized, check the container logging definitions to ensure they represent your
+ * desired logging configuration.
+ */
+ LOGGING_ALREADY_INITIALIZED,
+
+ /**
+ * Searching path "{0}" for log configuration file "{1}"
+ */
+ SEARCHING_LOG_CONFIGURATION,
+
+ /**
+ * Loading default logging configuration from system resource file "{0}"
+ */
+ LOADING_DEFAULT_LOG_CONFIGURATION,
+
+ /**
+ * No log configuration could be found or defaulted!
+ */
+ NO_LOG_CONFIGURATION,
+
+ /**
+ * An unsupported logging framework is bound to SLF4J. Only Logback or Log4J are supported.
+ */
+ UNSUPPORTED_LOGGING_FRAMEWORK,
+
+ /**
+ * Loading logging configuration from file "{0}"
+ */
+ LOADING_LOG_CONFIGURATION,
+
+ /**
+ * Provider {0} cannot be found or cannot be resolved to a valid provider.
+ */
+ UNKNOWN_PROVIDER,
+
+ /**
+ * Server name "{0}" with id "{1}" in tenant "{2}" and region "{3}" did not change state within the alloted time.
+ * Current state is "{4}" and the desired state(s) are "{5}"
+ */
+ SERVER_STATE_CHANGE_TIMEOUT,
+
+ /**
+ * Server name "{0}" with id "{1}" in tenant "{2}" has a state of deleted and cannot be {3}.
+ */
+ SERVER_DELETED,
+
+ /**
+ * Server name "{0}" with id "{1}" in tenant "{2}" has an unknown state of "{3}".
+ */
+ UNKNOWN_SERVER_STATE,
+
+ /**
+ * {0} component {1} is being initialized...
+ */
+ COMPONENT_INITIALIZING,
+
+ /**
+ * {0} component {1} has completed initialization
+ */
+ COMPONENT_INITIALIZED,
+
+ /**
+ * {0} component {1} is terminating...
+ */
+ COMPONENT_TERMINATING,
+
+ /**
+ * {0} component {1} has terminated
+ */
+ COMPONENT_TERMINATED,
+
+ /**
+ * Operation {0} is not supported or implemented at this time.
+ */
+ IAAS_ADAPTER_UNSUPPORTED_OPERATION,
+
+ /**
+ * Operation {0} called. Input document:\n{1}
+ */
+ IAAS_ADAPTER_RPC_CALLED,
+
+ /**
+ * Unable to locate the {0} service in the OSGi container
+ */
+ NO_SERVICE_FOUND,
+
+ /**
+ * Dump of context parameters for module {0}, RPC {1}, and version {2}
+ */
+ CONTEXT_PARAMETERS_DISPLAY,
+
+ /**
+ * Response properties from execution of module '{0}', RPC '{1}', and version '{2}' are:
+ */
+ RESPONSE_PARAMETERS_DISPLAY,
+
+ /**
+ * Service {0}:{1} was provided a null (empty) or invalid argument, '{2}' = '{3}'
+ */
+ NULL_OR_INVALID_ARGUMENT,
+
+ /**
+ * Service {0}:{1} is processing service '{2}' with request id '{3}'
+ */
+ PROCESSING_REQUEST,
+
+ /**
+ * Service {0}:{1} received request for service '{2}' but that service is invalid or unknown.
+ */
+ INVALID_SERVICE_REQUEST,
+
+ /**
+ * {0} registering service {1} using class {2}
+ */
+ REGISTERING_SERVICE,
+
+ /**
+ * {0} unregistering service {1}
+ */
+ UNREGISTERING_SERVICE,
+
+ /**
+ * {0} IAAS Adapter initializing provider {1} as {2}
+ */
+ LOADING_PROVIDER_DEFINITIONS,
+
+ /**
+ * {0} IAAS Adapter restart of server requested
+ */
+ RESTARTING_SERVER,
+
+ /**
+ * {0} IAAS Adapter rebuild of server requested
+ */
+ REBUILDING_SERVER,
+
+ /**
+ * {0} IAAS Adapter migrate of server requested
+ */
+ MIGRATING_SERVER,
+
+ /**
+ * {0} IAAS Adapter evacuate of server requested
+ */
+ EVACUATING_SERVER,
+
+ /**
+ * {0} IAAS Adapter create snapshot of server requested
+ */
+ SNAPSHOTING_SERVER,
+
+ /**
+ * {0} IAAS Adapter look for server requested
+ */
+ LOOKING_SERVER_UP,
+
+ /**
+ * {0} IAAS Adapter cannot perform requested service, VM url '{1}' is invalid
+ */
+ INVALID_SELF_LINK_URL,
+
+ /**
+ * Located server '{0}' on tenant '{1}' and in state '{2}'
+ */
+ SERVER_FOUND,
+
+ /**
+ * No server found in provider with self-link URL [{0}]
+ */
+ SERVER_NOT_FOUND,
+
+ /**
+ * Exception {0} was caught attempting {1} of server [{2}] on tenant [{3}]
+ */
+ SERVER_OPERATION_EXCEPTION,
+
+ /**
+ * One or more properties for [{0}] are missing, null, or empty. They are:
+ */
+ MISSING_REQUIRED_PROPERTIES,
+
+ /**
+ * The server [{0}] (id={1}) in tenant {2} is in error state, {3} is not allowed
+ */
+ SERVER_ERROR_STATE,
+
+ /**
+ * The image {0} could not be located for {1}
+ */
+ IMAGE_NOT_FOUND,
+
+ /**
+ * Time out waiting for {0} with name {1} (and id {2}) to reach one of {3} states, current state is {4}
+ */
+ STATE_CHANGE_TIMEOUT,
+
+ /**
+ * Exception {0} waiting for {1} with name {2} (and id {3}) to reach one of {4} states, current state is {5}
+ * cause={6}
+ */
+ STATE_CHANGE_EXCEPTION,
+
+ /**
+ * Server {0} is being stopped...
+ */
+ STOP_SERVER,
+
+ /**
+ * Server {0} is being started...
+ */
+ START_SERVER,
+
+ /**
+ * Server {0} is being resumed...
+ */
+ RESUME_SERVER,
+
+ /**
+ * Server {0} is being unpaused...
+ */
+ UNPAUSE_SERVER,
+
+ /**
+ * Server {0} is being rebuilt...
+ */
+ REBUILD_SERVER,
+
+ /**
+ * Connection to provider {0} at identity {1} using tenant name {2} (id {3}) failed, reason={4}, retrying in {5}
+ * seconds, attempt {6} of {7}.
+ */
+ CONNECTION_FAILED_RETRY,
+
+ /**
+ * Connection to provider {0} at service {1} failed after all retry attempts.
+ */
+ CONNECTION_FAILED,
+
+ /**
+ * {0} IAAS Adapter stop server requested
+ */
+ STOPPING_SERVER,
+
+ /**
+ * {0} IAAS Adapter start server requested
+ */
+ STARTING_SERVER,
+
+ /**
+ * Server {0} (id {1}) failed to rebuild, reason {2}
+ */
+ REBUILD_SERVER_FAILED,
+
+ /**
+ * Application {0} graph {1} response did not set the {2} parameter. This parameter is required for synchronization
+ * with the controller. Absence of this parameter is assumed to be a failure. Please correct the DG.
+ */
+ PARAMETER_IS_MISSING,
+
+ /**
+ * Application {0} graph {1} did not set parameter {2} to a valid numeric value ({3}). Please correct the DG.
+ */
+ PARAMETER_NOT_NUMERIC,
+
+ /**
+ * Application {0} graph {1} completed with failure: error code = {2}, message = {3}
+ */
+ DG_FAILED_RESPONSE,
+
+ /**
+ * Application {0} received exception {1} attempting to call graph {2}, exception message = {3}
+ */
+ EXCEPTION_CALLING_DG,
+
+ /**
+ * Application {0} was unable to locate graph {1}
+ */
+ GRAPH_NOT_FOUND,
+
+ /**
+ * Application {0} graph {1} responded with {3} properties
+ */
+ DEBUG_GRAPH_RESPONSE_HEADER,
+
+ /**
+ * {0}:{1} - {2} = {3}
+ */
+ DEBUG_GRAPH_RESPONSE_DETAIL,
+
+ /**
+ * Application {0} request {1} was supplied a property '{2}' with the value '{3}' that does not meet the required
+ * form(s):
+ */
+ INVALID_REQUIRED_PROPERTY,
+
+ /**
+ * Server {0} (id {1}) failed to migrate during {2} phase, reason {3}
+ */
+ MIGRATE_SERVER_FAILED,
+
+ /**
+ * Server {0} (id {1}) failed to evacuate, reason {2}
+ */
+ EVACUATE_SERVER_FAILED,
+
+ /**
+ * Server {0} evacuate from host {1} to host {2} failed during the rebuild on host {2}, reason {3}
+ */
+ EVACUATE_SERVER_REBUILD_FAILED,
+
+ /**
+ * APP-C instance is too busy
+ */
+ APPC_TOO_BUSY,
+
+ /**
+ * Concurrent access to server "{0}"
+ */
+ VF_SERVER_BUSY,
+
+ /**
+ * Server "{0}" does not support command "{1}" in the current state "{2}"
+ */
+ VF_ILLEGAL_COMMAND,
+
+ /**
+ * Server "{0}" cannot handle command "{1}" because of its doubtful state
+ */
+ VF_UNDEFINED_STATE,
+
+ /**
+ * No resource found with ID "{0}" in A&AI system
+ */
+ APPC_NO_RESOURCE_FOUND,
+
+ /**
+ * The request "{0}" for server "{1}" has exceeded its TTL limit of "{3}" seconds
+ */
+ APPC_EXPIRED_REQUEST,
+
+ /**
+ * Workflow for vnfType = "{0}" and command = "{1}" not found.
+ */
+ APPC_WORKFLOW_NOT_FOUND,
+
+ /**
+ * Null vnfId and command provided
+ */
+ APPC_INVALID_INPUT,
+
+ /**
+ * Operation '{0}' for VNF type '{1}' from Source '{2}' with RequestID '{3}' was started at '{4}' and ended at '{5}'
+ * with status code '{6}'
+ */
+ APPC_AUDIT_MSG,
+
+ /**
+ * APP-C is unable to communicate with A&AI
+ */
+ AAI_CONNECTION_FAILED,
+
+ /**
+ * APP-C is unable to update COMPONENT_ID {0} to {1} for reason {2}
+ */
+ AAI_UPDATE_FAILED,
+
+ /**
+ * APP-C is unable to retrieve VF/VFC {0} data for Transaction ID{1}as a result of A&AI communication failure or its
+ * internal error.
+ */
+ AAI_GET_DATA_FAILED,
+
+ /**
+ * A&AI at identity {0} using VNF_ID {1} failed, reason={2}, retrying in {3} seconds, attempt {4} of {5}
+ */
+ AAI_CONNECTION_FAILED_RETRY,
+
+ /**
+ * APP-C is unable to delete COMPONENT_ID {0} for reason {1}
+ */
+ AAI_DELETE_FAILED,
+
+ /**
+ * APP-C is unable to query AAI for VNF_ID {0}
+ */
+ AAI_QUERY_FAILED,
+
+ /**
+ * VNF {0} is configured
+ */
+ VNF_CONFIGURED,
+
+ /**
+ * VNF {0} is being configured
+ */
+ VNF_CONFIGURATION_STARTED,
+
+ /**
+ * VNF {0} configuration failed for reason {1}
+ */
+ VNF_CONFIGURATION_FAILED,
+
+ /**
+ * VNF {0} is being tested
+ */
+ VNF_TEST_STARTED,
+
+ /**
+ * VNF {0} was tested
+ */
+ VNF_TESTED,
+
+ /**
+ * VNF {0} test failed for reason {1}
+ */
+ VNF_TEST_FAILED,
+
+ /**
+ * VNF {0} test failed for reason {1}
+ */
+ VNF_NOT_FOUND,
+
+ /**
+ * VNF {0} Healthcheck operation failed for reason {1}
+ */
+ VNF_HEALTHCECK_FAILED,
+
+ /**
+ * VM {0} Healthcheck operation failed for reason {1}
+ */
+ VM_HEALTHCECK_FAILED,
+
+ /**
+ * Server {0} (id {1}) failed to stop during {2} phase, reason {3}
+ */
+ STOP_SERVER_FAILED,
+
+ /**
+ * Server {0} (id {1}) failed to terminate during {2} phase, reason {3}
+ */
+ TERMINATE_SERVER_FAILED,
+
+ /**
+ * {0} IAAS Adapter terminate server requested
+ */
+ TERMINATING_SERVER,
+
+ /**
+ * Server {0} is being terminated...
+ */
+ TERMINATE_SERVER,
+
+ /**
+ * Migrate {0} finished with status {1}. Start Time: {2}. End Time: {3}. Request ID: {4}. Reason:{5}...
+ */
+ MIGRATE_COMPLETE,
+
+ /**
+ * Restart {0} finished with status {1}. Start Time: {2}. End Time: {3}. Request ID: {4}. Reason:{5}...
+ */
+ RESTART_COMPLETE,
+
+ /**
+ * Rebuild {0} finished with status {1}. Start Time: {2}. End Time: {3}. Request ID: {4}. Reason:{5}...
+ */
+ REBUILD_COMPLETE,
+
+ /**
+ * Located stack '{0}' on tenant '{1}' and in state '{2}'
+ */
+ STACK_FOUND,
+
+ /**
+ * {0} IAAS Adapter terminate stack requested
+ */
+
+ TERMINATING_STACK,
+
+ /**
+ * stack {0} is being terminated...
+ */
+ TERMINATE_STACK,
+ /**
+ * No stack found in provider with self-link URL [{0}]
+ */
+
+ STACK_NOT_FOUND,
+
+ /**
+ * Exception {0} was caught attempting {1} of stack [{2}] on tenant [{3}]
+ */
+ STACK_OPERATION_EXCEPTION,
+
+ /**
+ * Stack {0} (id {1}) failed to terminate during {2} phase, reason {3}
+ */
+
+ TERMINATE_STACK_FAILED,
+
+ /**
+ * Exception {0} was caught attempting to close provider context for {1}.
+ */
+
+ CLOSE_CONTEXT_FAILED,
+
+ /**
+ * {0} IAAS Adapter snapshoting stack
+ */
+ SNAPSHOTING_STACK,
+
+ /**
+ * Stack {0} snapshoted, snapshot ID = [{1}].
+ */
+ STACK_SNAPSHOTED,
+
+ /**
+ * {0} IAAS Adapter restoring stack
+ */
+ RESTORING_STACK,
+
+ /**
+ * Stack {0} is restored to snapshot {1}.
+ */
+ STACK_RESTORED,
+
+ /**
+ * {0} IAAS Adapter checking server
+ */
+ CHECKING_SERVER,
+
+ /**
+ * Parameter {0} is missing in svc request of {1}.
+ */
+ MISSING_PARAMETER_IN_REQUEST,
+
+ /**
+ * Cannot establish connection to server {0} port {1} with user {2}.
+ */
+ CANNOT_ESTABLISH_CONNECTION,
+
+ /**
+ * Operation '{0}' for VNF type '{1}' from Source '{2}' with RequestID '{3}' on '{4}' with action '{5}'
+ * ended in {6}ms with result '{7}'
+ */
+ APPC_METRIC_MSG,
+
+ /**
+ * Parsing failied for{0}
+ */
+ INPUT_PAYLOAD_PARSING_FAILED,
+
+ /**
+ * Error occurred for due to {0}
+ */
+ APPC_EXCEPTION,
+
+ /**
+ * SSH Data Exception occurred due to {0}
+ */
+ SSH_DATA_EXCEPTION,
+
+ /**
+ * Json processing exception occurred due to {0}
+ */
+ JSON_PROCESSING_EXCEPTION,
+
+ /**
+ * Operation {0} succeed for {1}
+ */
+ SUCCESS_EVENT_MESSAGE,
+
+ /**
+ * Dependency model not found for VNF type {0} due to {1}
+ */
+ DEPENDENCY_MODEL_NOT_FOUND,
+
+ /**
+ * Invalid Dependency model for VNF Type {0} due to {1}
+ */
+ INVALID_DEPENDENCY_MODEL,
+
+ /**
+ * Failed to retrieve VNFC DG
+ */
+ FAILURE_RETRIEVE_VNFC_DG,
+
+ /**
+ * Network check for Server {0} failed for Port {1}
+ *
+ */
+ SERVER_NETWORK_ERROR,
+
+ /**
+ * Hypervisor check for Server {0} failed. Status is DOWN or UNKNOWN
+ *
+ */
+ HYPERVISOR_DOWN_ERROR,
+
+ /**
+ * Unable to determine Hypervisor status for Server {0}. failed.
+ *
+ */
+ HYPERVISOR_STATUS_UKNOWN,
+
+ /**
+ * Hypervisor Network check for Server {0} failed. Not reachable by APPC
+ *
+ */
+ HYPERVISOR_NETWORK_ERROR,
+
+ /**
+ * Restart application operation failed on server : {0}, reason {1}
+ */
+ APPLICATION_RESTART_FAILED,
+
+ /**
+ * Start application operation failed on server : {0}, reason {1}
+ */
+ APPLICATION_START_FAILED,
+
+ /**
+ * Start application operation failed on server : {0}, reason {1}
+ */
+ APPLICATION_STOP_FAILED,
+
+ /**
+ * Application on server {0} is being restarted...
+ */
+ RESTART_APPLICATION,
+
+ /**
+ * Application on server {0} is being started...
+ */
+ START_APPLICATION,
+
+ /**
+ * Application on server {0} is being started...
+ */
+ STOP_APPLICATION,
+
+ /**
+ * APPC LCM operations are disabled
+ */
+ LCM_OPERATIONS_DISABLED,
+
+ /**
+ * Application {0} received exception {1} while attempting to execute oam operation {2}, exception message = {3}|\
+ */
+ OAM_OPERATION_EXCEPTION,
+
+ /**
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_ENTERING_MAINTENANCE_MODE,
+
+ /**
+ * Application {0} is in {1}
+ */
+ OAM_OPERATION_MAINTENANCE_MODE,
+
+ /**
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_STARTING,
+
+ /**
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_STARTED,
+
+ /**
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_STOPPING,
+
+ /**
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_STOPPED,
+ /**
+ * A {1} API is not allowed when {0} is in the {2} state
+ */
+ INVALID_STATE_TRANSITION,
+
+ /**
+ * Application {0} was unable to find the Request Handler service
+ */
+ REQUEST_HANDLER_UNAVAILABLE,
+
+ /**
+ * Application {0} is {1}
+ */
+ OAM_OPERATION_RESTARTING,
+
+ /**
+ * Application {0} is {1} for restart
+ */
+ OAM_OPERATION_RESTARTED,
+
+ /**
+ * {0}
+ */
+ OAM_OPERATION_INVALID_INPUT,
+
+ ATTACHINGVOLUME_SERVER,
+
+ DETTACHINGVOLUME_SERVER,
+
+ REBOOT_SERVER,
+ /**
+ * {0} IAAS Adapter reboot of server requested
+ */
+ /**
+ * Unsupported identity service version, unable to retrieve ServiceCatalog
+ * for identity service {0}
+ */
+ IAAS_UNSUPPORTED_IDENTITY_SERVICE,
+
+ /**
+ * Sftp data transfer failed on connection to host {0} with user {1} for {2} operation, reason : {3}
+ */
+ SFTP_TRANSFER_FAILED,
+ /**
+ * Ssh session with host {0} has timed out during command {1} execution
+ */
+ SSH_CONNECTION_TIMEOUT,
+ /**
+ * Exception {0} was caught while posting action {1} to service {2}
+ */
+ POST_OPERATION_EXCEPTION,
+ /**
+ *Connecting to image service {0}failed
+ */
+ IMAGE_SERVICE_FAILED,
+ /**
+ * Time out waiting for volume {0} with device {1} (and server {2}) after retry one of {3} times, retry interval is {4}
+ */
+ VOLUME_ATTACH_TIMEOUT,
+ /**
+ * Time out waiting for volume {0} (from server {1}) after retry one of {2} times, retry interval is {3}
+ */
+ VOLUME_DETACH_TIMEOUT,
+ /**
+ * MSO throwing error from openstack{0}
+ */
+ MSO_EXCEPTION,
+ /**
+ * Server [{0}], ID [{1}], is in state [{2}] but is expected to be in one of [{3}]
+ */
+ OS_INVALID_SERVER_STATE,
+ /**
+ * Could not configure existing ssh session, reason: {0}
+ */
+ SSH_SESSION_CONFIG_ERROR
+ ;
+ /*
+ * Static initializer to ensure the resource bundles for this class are loaded...
+ */
+ static {
+ EELFResourceManager.loadMessageBundle("org/onap/appc/i18n/MessageResources");
+ }
+}