summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java131
-rw-r--r--src/main/java/org/onap/clamp/clds/config/SSLConfiguration.java56
-rw-r--r--src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java123
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java2
-rw-r--r--src/main/java/org/onap/clamp/clds/util/LoggingUtils.java23
-rw-r--r--src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java192
7 files changed, 299 insertions, 230 deletions
diff --git a/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java b/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java
index 93432c9f2..13dccdacb 100644
--- a/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java
+++ b/src/main/java/org/onap/clamp/clds/config/AAFConfiguration.java
@@ -22,49 +22,22 @@
*/
package org.onap.clamp.clds.config;
-import java.util.Properties;
-
import javax.servlet.Filter;
import org.onap.clamp.clds.filter.ClampCadiFilter;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
-import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
-@Component
@Configuration
@Profile("clamp-aaf-authentication")
-@ConfigurationProperties(prefix = "clamp.config.cadi")
public class AAFConfiguration {
- private static final String CADI_KEY_FILE = "cadi_keyfile";
- private static final String CADI_LOG_LEVEL = "cadi_loglevel";
- private static final String LATITUDE = "cadi_latitude";
- private static final String LONGITUDE = "cadi_longitude";
- private static final String LOCATE_URL = "aaf_locate_url";
- private static final String OAUTH_TOKEN_URL = "aaf_oauth2_token_url";
- private static final String OAUTH_INTROSPECT_URL = "aaf_oauth2_introspect_url";
- private static final String AAF_ENV = "aaf_env";
- private static final String AAF_URL = "aaf_url";
- private static final String X509_ISSUERS = "cadi_x509_issuers";
-
- private String keyFile;
- private String cadiLoglevel;
- private String cadiLatitude;
- private String cadiLongitude;
- private String aafLocateUrl;
- private String oauthTokenUrl;
- private String oauthIntrospectUrl;
- private String aafEnv;
- private String aafUrl;
- private String cadiX509Issuers;
/**
* Method to return clamp cadi filter.
- *
+ *
* @return Filter
*/
@Bean(name = "cadiFilter")
@@ -74,7 +47,7 @@ public class AAFConfiguration {
/**
* Method to register cadi filter.
- *
+ *
* @return FilterRegistrationBean
*/
@Bean
@@ -87,104 +60,4 @@ public class AAFConfiguration {
registration.setOrder(0);
return registration;
}
-
- public String getKeyFile() {
- return keyFile;
- }
-
- public void setKeyFile(String keyFile) {
- this.keyFile = keyFile;
- }
-
- public String getCadiLoglevel() {
- return cadiLoglevel;
- }
-
- public void setCadiLoglevel(String cadiLoglevel) {
- this.cadiLoglevel = cadiLoglevel;
- }
-
- public String getCadiLatitude() {
- return cadiLatitude;
- }
-
- public void setCadiLatitude(String cadiLatitude) {
- this.cadiLatitude = cadiLatitude;
- }
-
- public String getCadiLongitude() {
- return cadiLongitude;
- }
-
- public void setCadiLongitude(String cadiLongitude) {
- this.cadiLongitude = cadiLongitude;
- }
-
- public String getAafLocateUrl() {
- return aafLocateUrl;
- }
-
- public void setAafLocateUrl(String aafLocateUrl) {
- this.aafLocateUrl = aafLocateUrl;
- }
-
- public String getOauthTokenUrl() {
- return oauthTokenUrl;
- }
-
- public void setOauthTokenUrl(String oauthTokenUrl) {
- this.oauthTokenUrl = oauthTokenUrl;
- }
-
- public String getOauthIntrospectUrl() {
- return oauthIntrospectUrl;
- }
-
- public void setOauthIntrospectUrl(String oauthIntrospectUrl) {
- this.oauthIntrospectUrl = oauthIntrospectUrl;
- }
-
- public String getAafEnv() {
- return aafEnv;
- }
-
- public void setAafEnv(String aafEnv) {
- this.aafEnv = aafEnv;
- }
-
- public String getAafUrl() {
- return aafUrl;
- }
-
- public void setAafUrl(String aafUrl) {
- this.aafUrl = aafUrl;
- }
-
- public String getCadiX509Issuers() {
- return cadiX509Issuers;
- }
-
- public void setCadiX509Issuers(String cadiX509Issuers) {
- this.cadiX509Issuers = cadiX509Issuers;
- }
-
- public Properties getProperties() {
- Properties prop = System.getProperties();
- //prop.put("cadi_prop_files", "");
- prop.put(CADI_KEY_FILE, keyFile);
- prop.put(CADI_LOG_LEVEL, cadiLoglevel);
- prop.put(LATITUDE, cadiLatitude);
- prop.put(LONGITUDE, cadiLongitude);
- prop.put(LOCATE_URL, aafLocateUrl);
- if (oauthTokenUrl != null) {
- prop.put(OAUTH_TOKEN_URL, oauthTokenUrl);
- }
- if (oauthIntrospectUrl != null) {
- prop.put(OAUTH_INTROSPECT_URL, oauthIntrospectUrl);
- }
- prop.put(AAF_ENV, aafEnv);
- prop.put(AAF_URL, aafUrl);
- prop.put(X509_ISSUERS, cadiX509Issuers);
- return prop;
- }
} \ No newline at end of file
diff --git a/src/main/java/org/onap/clamp/clds/config/SSLConfiguration.java b/src/main/java/org/onap/clamp/clds/config/SSLConfiguration.java
deleted file mode 100644
index 6a97f2356..000000000
--- a/src/main/java/org/onap/clamp/clds/config/SSLConfiguration.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
- * reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-package org.onap.clamp.clds.config;
-
-import org.springframework.context.annotation.Configuration;
-
-import javax.annotation.PostConstruct;
-
-import org.springframework.beans.factory.annotation.Value;
-
-@Configuration
-public class SSLConfiguration {
- private static final String TRUST_STORE = "javax.net.ssl.trustStore";
- private static final String TRUST_STORE_PW = "javax.net.ssl.trustStorePassword";
- private static final String TRUST_STORE_TYPE = "javax.net.ssl.trustStoreType";
-
- @Value("${server.ssl.trust:none}")
- private String sslTruststoreFile;
- @Value("${server.ssl.trust-password:none}")
- private String sslTruststorePw;
- @Value("${server.ssl.trust-type:none}")
- private String sslTruststoreType;
-
- @PostConstruct
- private void configureSSL() {
- if (!sslTruststoreFile.equals("none")) {
- System.setProperty(TRUST_STORE, sslTruststoreFile);
- }
- if (!sslTruststoreType.equals("none")) {
- System.setProperty(TRUST_STORE_TYPE, sslTruststoreType);
- }
- if (!sslTruststorePw.equals("none")) {
- System.setProperty(TRUST_STORE_PW, sslTruststorePw);
- }
- }
-}
diff --git a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
index ed3dcb46a..f058a9e6a 100644
--- a/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
+++ b/src/main/java/org/onap/clamp/clds/filter/ClampCadiFilter.java
@@ -22,59 +22,122 @@
*/
package org.onap.clamp.clds.filter;
-import java.util.Properties;
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.StandardCopyOption;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
+import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.filter.CadiFilter;
-import org.onap.clamp.clds.config.AAFConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
public class ClampCadiFilter extends CadiFilter {
- private static final String CADI_TRUST_STORE = "cadi_truststore";
- private static final String CADI_TRUST_STORE_PW = "cadi_truststore_password";
- private static final String CADI_KEY_STORE = "cadi_keystore";
- private static final String CADI_KEY_STORE_PW = "cadi_keystore_password";
- private static final String ALIAS = "cadi_alias";
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(ClampCadiFilter.class);
+
+ @Autowired
+ private ApplicationContext appContext;
- @Value("${server.ssl.key-store:none}")
- private String keyStore;
+ @Value("${server.ssl.key-store:#{null}}")
+ private String keyStore;
- @Value("${clamp.config.cadi.cadiKeystorePassword:none}")
- private String keyStorePass;
+ @Value("${clamp.config.cadi.cadiKeystorePassword:#{null}}")
+ private String keyStorePass;
- @Value("${server.ssl.trust:none}")
- private String trustStore;
+ @Value("${server.ssl.trust-store:#{null}}")
+ private String trustStore;
- @Value("${clamp.config.cadi.cadiTruststorePassword:none}")
- private String trustStorePass;
+ @Value("${clamp.config.cadi.cadiTruststorePassword:#{null}}")
+ private String trustStorePass;
@Value("${server.ssl.key-alias:clamp@clamp.onap.org}")
- private String alias;
+ private String alias;
- @Autowired
- private AAFConfiguration aafConfiguration;
+ @Value("${clamp.config.cadi.keyFile:#{null}}")
+ private String keyFile;
+
+ @Value("${clamp.config.cadi.cadiLoglevel:#{null}}")
+ private String cadiLoglevel;
+
+ @Value("${clamp.config.cadi.cadiLatitude:#{null}}")
+ private String cadiLatitude;
+
+ @Value("${clamp.config.cadi.cadiLongitude:#{null}}")
+ private String cadiLongitude;
+
+ @Value("${clamp.config.cadi.aafLocateUrl:#{null}}")
+ private String aafLocateUrl;
+
+ @Value("${clamp.config.cadi.oauthTokenUrl:#{null}}")
+ private String oauthTokenUrl;
+
+ @Value("${clamp.config.cadi.oauthIntrospectUrl:#{null}}")
+ private String oauthIntrospectUrl;
+
+ @Value("${clamp.config.cadi.aafEnv:#{null}}")
+ private String aafEnv;
+
+ @Value("${clamp.config.cadi.aafUrl:#{null}}")
+ private String aafUrl;
+
+ @Value("${clamp.config.cadi.cadiX509Issuers:#{null}}")
+ private String cadiX509Issuers;
+
+ private void checkIfNullProperty(String key, String value) {
+ /* When value is null, so not defined in application.properties
+ set nothing in System properties */
+ if (value != null) {
+ /* Ensure that any properties already defined in System.prop by JVM params
+ won't be overwritten by Spring application.properties values */
+ System.setProperty(key, System.getProperty(key, value));
+ }
+ }
@Override
public void init(FilterConfig filterConfig) throws ServletException {
- Properties props = aafConfiguration.getProperties();
- props.setProperty(CADI_KEY_STORE, trimFileName(keyStore));
- props.setProperty(CADI_TRUST_STORE, trimFileName(trustStore));
- props.setProperty(ALIAS, alias);
- props.setProperty(CADI_KEY_STORE_PW, keyStorePass);
- props.setProperty(CADI_TRUST_STORE_PW, trustStorePass);
+ // set some properties in System so that Cadi filter will find its config
+ // The JVM values set will always overwrite the Spring ones.
+ checkIfNullProperty(Config.CADI_KEYFILE, convertSpringToPath(keyFile));
+ checkIfNullProperty(Config.CADI_LOGLEVEL, cadiLoglevel);
+ checkIfNullProperty(Config.CADI_LATITUDE, cadiLatitude);
+ checkIfNullProperty(Config.CADI_LONGITUDE, cadiLongitude);
+
+ checkIfNullProperty(Config.AAF_LOCATE_URL, aafLocateUrl);
+ checkIfNullProperty(Config.AAF_OAUTH2_TOKEN_URL, oauthTokenUrl);
+ checkIfNullProperty(Config.AAF_OAUTH2_INTROSPECT_URL, oauthIntrospectUrl);
+
+ checkIfNullProperty(Config.AAF_ENV, aafEnv);
+ checkIfNullProperty(Config.AAF_URL, aafUrl);
+ checkIfNullProperty(Config.CADI_X509_ISSUERS, cadiX509Issuers);
+ checkIfNullProperty(Config.CADI_KEYSTORE, convertSpringToPath(keyStore));
+ checkIfNullProperty(Config.CADI_TRUSTSTORE, convertSpringToPath(trustStore));
+ checkIfNullProperty(Config.CADI_ALIAS, alias);
+ checkIfNullProperty(Config.CADI_KEYSTORE_PASSWORD, keyStorePass);
+ checkIfNullProperty(Config.CADI_TRUSTSTORE_PASSWORD, trustStorePass);
super.init(filterConfig);
}
- private String trimFileName (String fileName) {
- int index= fileName.indexOf("file:");
- if (index == -1) {
- return fileName;
- } else {
- return fileName.substring(index+5);
+ private String convertSpringToPath(String fileName) {
+ try (InputStream ioFile = appContext.getResource(fileName).getInputStream()) {
+ if (!fileName.contains("file:")) {
+ File targetFile = new File(appContext.getResource(fileName).getFilename());
+ java.nio.file.Files.copy(ioFile, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
+ return targetFile.getPath();
+ } else {
+ return appContext.getResource(fileName).getFile().getPath();
+ }
+ } catch (IOException e) {
+ logger.error("Unable to open and copy the file: " + fileName, e);
+ return null;
}
+
}
}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index 2139b3d39..bc58ee69f 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -74,7 +74,7 @@ import org.onap.clamp.clds.sdc.controller.installer.CsarInstallerImpl;
import org.onap.clamp.clds.transform.XslTransformer;
import org.onap.clamp.clds.util.JacksonUtils;
import org.onap.clamp.clds.util.LoggingUtils;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.clamp.clds.util.ONAPLogConstants;
import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
index cca0afded..d82e7c6e7 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsTemplateService.java
@@ -33,7 +33,7 @@ import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.model.CldsTemplate;
import org.onap.clamp.clds.model.ValueItem;
import org.onap.clamp.clds.util.LoggingUtils;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.clamp.clds.util.ONAPLogConstants;
import org.slf4j.event.Level;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
diff --git a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
index a20a70040..cdb2e29c5 100644
--- a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
@@ -45,7 +45,6 @@ import org.slf4j.event.Level;
import org.springframework.security.core.context.SecurityContextHolder;
import org.onap.clamp.clds.service.DefaultUserNameHandler;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
/**
* This class handles the special info that appear in the log, like RequestID,
@@ -58,8 +57,6 @@ public class LoggingUtils {
/** String constant for messages <tt>ENTERING</tt>, <tt>EXITING</tt>, etc. */
private static final String EMPTY_MESSAGE = "";
- private static final String INVOCATIONID_OUT = "InvocationIDOut";
- private static final String TARGET_ENTITY = "TargetEngity";
/** Logger delegate. */
private EELFLogger mLogger;
@@ -209,8 +206,8 @@ public class LoggingUtils {
serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {
MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
}
-
- this.mLogger.info("ENTRY");
+
+ this.mLogger.info(ONAPLogConstants.Markers.ENTRY);
}
/**
@@ -224,7 +221,7 @@ public class LoggingUtils {
MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, defaultToEmpty(descrption));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_SEVERITY, defaultToEmpty(severity));
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, defaultToEmpty(status));
- this.mLogger.info("EXIT");
+ this.mLogger.info(ONAPLogConstants.Markers.EXIT);
}
finally {
MDC.clear();
@@ -255,13 +252,13 @@ public class LoggingUtils {
// Log INVOKE*, with the invocationID as the message body.
// (We didn't really want this kind of behavior in the standard,
// but is it worse than new, single-message MDC?)
- this.mLogger.info("INVOKE");
- this.mLogger.info("INVOKE-" + ONAPLogConstants.InvocationMode.SYNCHRONOUS.toString() + "{"+ invocationID +"}");
+ this.mLogger.info(ONAPLogConstants.Markers.INVOKE);
+ this.mLogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{"+ invocationID +"}");
return con;
}
public void invokeReturn() {
// Add the Invoke-return marker and clear the needed MDC
- this.mLogger.info("INVOKE-RETURN");
+ this.mLogger.info(ONAPLogConstants.Markers.INVOKE_RETURN);
invokeReturnContext();
}
@@ -313,9 +310,9 @@ public class LoggingUtils {
* @param invocationId The invocation ID
*/
private void invokeContext (String targetEntity, String targetServiceName, String invocationID) {
- MDC.put(TARGET_ENTITY, defaultToEmpty(targetEntity));
+ MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, defaultToEmpty(targetEntity));
MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, defaultToEmpty(targetServiceName));
- MDC.put(INVOCATIONID_OUT, invocationID);
+ MDC.put(ONAPLogConstants.MDCs.INVOCATIONID_OUT, invocationID);
MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
ZonedDateTime.now(ZoneOffset.UTC)
.format(DateTimeFormatter.ISO_INSTANT));
@@ -326,8 +323,8 @@ public class LoggingUtils {
*
*/
private void invokeReturnContext () {
- MDC.remove(TARGET_ENTITY);
+ MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- MDC.remove(INVOCATIONID_OUT);
+ MDC.remove(ONAPLogConstants.MDCs.INVOCATIONID_OUT);
}
}
diff --git a/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java b/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java
new file mode 100644
index 000000000..eea01a39a
--- /dev/null
+++ b/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java
@@ -0,0 +1,192 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.util;
+
+/**
+ * Constants for standard ONAP headers, MDCs, etc.
+ */
+public final class ONAPLogConstants {
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Constructors.
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Hide and forbid construction.
+ */
+ private ONAPLogConstants() {
+ throw new UnsupportedOperationException();
+ }
+
+
+ /**
+ * Marker constants.
+ */
+ public static final class Markers {
+
+ /** Marker reporting invocation. */
+ public static final String INVOKE = "INVOKE";
+
+ /** Marker reporting synchronous invocation. */
+ public static final String INVOKE_RETURN = "INVOKE-RETURN";
+
+ /** Marker reporting synchronous invocation. */
+ public static final String INVOKE_SYNC = "INVOKE-SYNCHRONOUS";
+
+ /** Marker reporting entry into a component. */
+ public static final String ENTRY = "ENTRY";
+
+ /** Marker reporting exit from a component. */
+ public static final String EXIT = "EXIT";
+
+ /**
+ * Hide and forbid construction.
+ */
+ private Markers() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * MDC name constants.
+ */
+ public static final class MDCs {
+
+ // Tracing. ////////////////////////////////////////////////////////////
+
+ /** MDC correlating messages for an invocation. */
+ public static final String INVOCATION_ID = "InvocationID";
+
+ /** MDC correlating messages for a logical transaction. */
+ public static final String REQUEST_ID = "RequestID";
+
+ /** MDC recording calling service. */
+ public static final String PARTNER_NAME = "PartnerName";
+
+ /** MDC recording current service. */
+ public static final String SERVICE_NAME = "ServiceName";
+
+ /** MDC recording target service. */
+ public static final String TARGET_SERVICE_NAME = "TargetServiceName";
+
+ /** MDC recording InvocationID Out. */
+ public static final String INVOCATIONID_OUT = "InvocationIDOut";
+
+ /** MDC recording target entity. */
+ public static final String TARGET_ENTITY = "TargetEngity";
+
+ /** MDC recording current service instance. */
+ public static final String INSTANCE_UUID = "InstanceUUID";
+
+ // Network. ////////////////////////////////////////////////////////////
+
+ /** MDC recording caller address. */
+ public static final String CLIENT_IP_ADDRESS = "ClientIPAddress";
+
+ /** MDC recording server address. */
+ public static final String SERVER_FQDN = "ServerFQDN";
+
+ /**
+ * MDC recording timestamp at the start of the current request,
+ * with the same scope as {@link #REQUEST_ID}.
+ *
+ * <p>Open issues:
+ * <ul>
+ * <ul>Easily confused with {@link #INVOKE_TIMESTAMP}.</ul>
+ * <ul>No mechanism for propagation between components, e.g. via HTTP headers.</ul>
+ * <ul>Whatever mechanism we define, it's going to be costly.</ul>
+ * </ul>
+ * </p>
+ * */
+ public static final String ENTRY_TIMESTAMP = "EntryTimestamp";
+
+ /** MDC recording timestamp at the start of the current invocation. */
+ public static final String INVOKE_TIMESTAMP = "InvokeTimestamp";
+
+ // Outcomes. ///////////////////////////////////////////////////////////
+
+ /** MDC reporting outcome code. */
+ public static final String RESPONSE_CODE = "ResponseCode";
+
+ /** MDC reporting outcome description. */
+ public static final String RESPONSE_DESCRIPTION = "ResponseDescription";
+
+ /** MDC reporting outcome error level. */
+ public static final String RESPONSE_SEVERITY = "Severity";
+
+ /** MDC reporting outcome error level. */
+ public static final String RESPONSE_STATUS_CODE = "StatusCode";
+
+ // Unsorted. ///////////////////////////////////////////////////////////
+
+ /**
+ * Hide and forbid construction.
+ */
+ private MDCs() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ /**
+ * Header name constants.
+ */
+ public static final class Headers {
+
+ /** HTTP <tt>X-ONAP-RequestID</tt> header. */
+ public static final String REQUEST_ID = "X-ONAP-RequestID";
+
+ /** HTTP <tt>X-ONAP-InvocationID</tt> header. */
+ public static final String INVOCATION_ID = "X-ONAP-InvocationID";
+
+ /** HTTP <tt>X-ONAP-PartnerName</tt> header. */
+ public static final String PARTNER_NAME = "X-ONAP-PartnerName";
+
+ /**
+ * Hide and forbid construction.
+ */
+ private Headers() {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ //
+ // Enums.
+ //
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Response success or not, for setting <tt>StatusCode</tt>.
+ */
+ public enum ResponseStatus {
+
+ /** Success. */
+ COMPLETED,
+
+ /** Not. */
+ ERROR,
+ }
+}