diff options
Diffstat (limited to 'src/main/java/org/onap/music/eelf/logging')
7 files changed, 0 insertions, 1035 deletions
diff --git a/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java b/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java deleted file mode 100644 index a8012c82..00000000 --- a/src/main/java/org/onap/music/eelf/logging/EELFLoggerDelegate.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * =================================================================== - * 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.music.eelf.logging; - -import static com.att.eelf.configuration.Configuration.MDC_SERVER_FQDN; -import static com.att.eelf.configuration.Configuration.MDC_SERVER_IP_ADDRESS; -import static com.att.eelf.configuration.Configuration.MDC_SERVICE_INSTANCE_ID; -import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME; -import java.net.InetAddress; -import java.text.MessageFormat; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; -import javax.servlet.http.HttpServletRequest; -import org.slf4j.MDC; -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; -import com.att.eelf.configuration.SLF4jWrapper; - -public class EELFLoggerDelegate extends SLF4jWrapper implements EELFLogger { - - public static final EELFLogger errorLogger = EELFManager.getInstance().getErrorLogger(); - public static final EELFLogger applicationLogger = - EELFManager.getInstance().getApplicationLogger(); - public static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); - public static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); - public static final EELFLogger debugLogger = EELFManager.getInstance().getDebugLogger(); - public static final EELFLogger securityLogger = EELFManager.getInstance().getSecurityLogger(); - - private String className; - private static ConcurrentMap<String, EELFLoggerDelegate> classMap = new ConcurrentHashMap<>(); - - public EELFLoggerDelegate(final String className) { - super(className); - this.className = className; - } - - /** - * Convenience method that gets a logger for the specified class. - * - * @see #getLogger(String) - * - * @param clazz - * @return Instance of EELFLoggerDelegate - */ - public static EELFLoggerDelegate getLogger(Class<?> clazz) { - return getLogger(clazz.getName()); - } - - /** - * Gets a logger for the specified class name. If the logger does not already exist in the map, - * this creates a new logger. - * - * @param className If null or empty, uses EELFLoggerDelegate as the class name. - * @return Instance of EELFLoggerDelegate - */ - public static EELFLoggerDelegate getLogger(final String className) { - String classNameNeverNull = className == null || "".equals(className) - ? EELFLoggerDelegate.class.getName() - : className; - EELFLoggerDelegate delegate = classMap.get(classNameNeverNull); - if (delegate == null) { - delegate = new EELFLoggerDelegate(className); - classMap.put(className, delegate); - } - return delegate; - } - - /** - * Logs a message at the lowest level: trace. - * - * @param logger - * @param msg - */ - public void trace(EELFLogger logger, String msg) { - if (logger.isTraceEnabled()) { - logger.trace(msg); - } - } - - /** - * Logs a message with parameters at the lowest level: trace. - * - * @param logger - * @param msg - * @param arguments - */ - public void trace(EELFLogger logger, String msg, Object... arguments) { - if (logger.isTraceEnabled()) { - logger.trace(msg, arguments); - } - } - - /** - * Logs a message and throwable at the lowest level: trace. - * - * @param logger - * @param msg - * @param th - */ - public void trace(EELFLogger logger, String msg, Throwable th) { - if (logger.isTraceEnabled()) { - logger.trace(msg, th); - } - } - - /** - * Logs a message at the second-lowest level: debug. - * - * @param logger - * @param msg - */ - public void debug(EELFLogger logger, String msg) { - if (logger.isDebugEnabled()) { - logger.debug(msg); - } - } - - /** - * Logs a message with parameters at the second-lowest level: debug. - * - * @param logger - * @param msg - * @param arguments - */ - public void debug(EELFLogger logger, String msg, Object... arguments) { - if (logger.isDebugEnabled()) { - logger.debug(msg, arguments); - } - } - - /** - * Logs a message and throwable at the second-lowest level: debug. - * - * @param logger - * @param msg - * @param th - */ - public void debug(EELFLogger logger, String msg, Throwable th) { - if (logger.isDebugEnabled()) { - logger.debug(msg, th); - } - } - - /** - * Logs a message at info level. - * - * @param logger - * @param msg - */ - public void info(EELFLogger logger, String msg) { - logger.info(className + " - "+msg); - } - - /** - * Logs a message with parameters at info level. - * - * @param logger - * @param msg - * @param arguments - */ - public void info(EELFLogger logger, String msg, Object... arguments) { - logger.info(msg, arguments); - } - - /** - * Logs a message and throwable at info level. - * - * @param logger - * @param msg - * @param th - */ - public void info(EELFLogger logger, String msg, Throwable th) { - logger.info(msg, th); - } - - /** - * Logs a message at warn level. - * - * @param logger - * @param msg - */ - public void warn(EELFLogger logger, String msg) { - logger.warn(msg); - } - - /** - * Logs a message with parameters at warn level. - * - * @param logger - * @param msg - * @param arguments - */ - public void warn(EELFLogger logger, String msg, Object... arguments) { - logger.warn(msg, arguments); - } - - /** - * Logs a message and throwable at warn level. - * - * @param logger - * @param msg - * @param th - */ - public void warn(EELFLogger logger, String msg, Throwable th) { - logger.warn(msg, th); - } - - /** - * Logs a message at error level. - * - * @param logger - * @param msg - * - */ - public void error(EELFLogger logger, String msg) { - logger.error(className+ " - " + msg); - } - - /** - * Logs a message at error level. - * - * @param logger - * @param msg - */ - public void error(EELFLogger logger, Exception e) { - logger.error(className+ " - ", e); - } - - /** - * Logs a message with parameters at error level. - * - * @param logger - * @param msg - * @param arguments - * - */ - public void error(EELFLogger logger, String msg, Object... arguments) { - logger.error(msg, arguments); - } - - /** - * Logs a message with parameters at error level. - * - * @param logger - * @param msg - * @param arguments - */ - public void error(EELFLogger logger, Exception e, Object... arguments) { - logger.error("Exception", e, arguments); - } - - /** - * Logs a message and throwable at error level. - * - * @param logger - * @param msg - * @param th - */ - public void error(EELFLogger logger, String msg, Throwable th) { - logger.error(msg, th); - } - - /** - * Logs a message with the associated alarm severity at error level. - * - * @param logger - * @param msg - * @param severtiy - */ - public void error(EELFLogger logger, String msg, Object /* AlarmSeverityEnum */ severtiy) { - logger.error(msg); - } - - /** - * Initializes the logger context. - */ - public void init() { - setGlobalLoggingContext(); - final String msg = - "############################ Logging is started. ############################"; - // These loggers emit the current date-time without being told. - info(applicationLogger, msg); - error(errorLogger, msg); - debug(debugLogger, msg); - info(auditLogger, msg); - info(metricsLogger, msg); - info(securityLogger, msg); - - } - - /** - * Builds a message using a template string and the arguments. - * - * @param message - * @param args - * @return - */ - private String formatMessage(String message, Object... args) { - StringBuilder sbFormattedMessage = new StringBuilder(); - if (args != null && args.length > 0 && message != null && message != "") { - MessageFormat mf = new MessageFormat(message); - sbFormattedMessage.append(mf.format(args)); - } else { - sbFormattedMessage.append(message); - } - - return sbFormattedMessage.toString(); - } - - /** - * Loads all the default logging fields into the MDC context. - */ - private void setGlobalLoggingContext() { - MDC.put(MDC_SERVICE_INSTANCE_ID, ""); - try { - MDC.put(MDC_SERVER_FQDN, InetAddress.getLocalHost().getHostName()); - MDC.put(MDC_SERVER_IP_ADDRESS, InetAddress.getLocalHost().getHostAddress()); - } catch (Exception e) { - errorLogger.error("setGlobalLoggingContext failed", e); - } - } - - public static void mdcPut(String key, String value) { - MDC.put(key, value); - } - - public static String mdcGet(String key) { - return MDC.get(key); - } - - public static void mdcRemove(String key) { - MDC.remove(key); - } - - /** - * Loads the RequestId/TransactionId into the MDC which it should be receiving with an each - * incoming REST API request. Also, configures few other request based logging fields into the - * MDC context. - * - * @param req - * @param appName - */ - public void setRequestBasedDefaultsIntoGlobalLoggingContext(HttpServletRequest req, - String appName) { - // Load the default fields - setGlobalLoggingContext(); - - // Load the request based fields - if (req != null) { - // Rest Path - MDC.put(MDC_SERVICE_NAME, req.getServletPath()); - - // Client IPAddress i.e. IPAddress of the remote host who is making - // this request. - String clientIPAddress = req.getHeader("X-FORWARDED-FOR"); - if (clientIPAddress == null) { - clientIPAddress = req.getRemoteAddr(); - } - } - } -} diff --git a/src/main/java/org/onap/music/eelf/logging/MusicContainerFilter.java b/src/main/java/org/onap/music/eelf/logging/MusicContainerFilter.java deleted file mode 100644 index bac02afa..00000000 --- a/src/main/java/org/onap/music/eelf/logging/MusicContainerFilter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * =================================================================== - * 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.music.eelf.logging; - -import java.io.IOException; - -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerResponseContext; -import javax.ws.rs.container.ContainerResponseFilter; - -import org.springframework.stereotype.Component; - - -/** - * This filter filter/modifies outbound http responses just before sending back to client. - * - * @author sp931a - * - */ -@Component -public class MusicContainerFilter implements ContainerResponseFilter { - - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicContainerFilter.class); - - public MusicContainerFilter() { - - } - - @Override - public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) - throws IOException { - if (null != EELFLoggerDelegate.mdcGet("transactionId")) { - EELFLoggerDelegate.mdcRemove("transactionId"); - } - - if (null != EELFLoggerDelegate.mdcGet("conversationId")) { - EELFLoggerDelegate.mdcRemove("conversationId"); - } - - if (null != EELFLoggerDelegate.mdcGet("clientId")) { - EELFLoggerDelegate.mdcRemove("clientId"); - } - - if (null != EELFLoggerDelegate.mdcGet("messageId")) { - EELFLoggerDelegate.mdcRemove("messageId"); - } - } - -} diff --git a/src/main/java/org/onap/music/eelf/logging/MusicLoggingServletFilter.java b/src/main/java/org/onap/music/eelf/logging/MusicLoggingServletFilter.java deleted file mode 100644 index c8c6ba65..00000000 --- a/src/main/java/org/onap/music/eelf/logging/MusicLoggingServletFilter.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * =================================================================== - * Modifications Copyright (C) 2019 IBM - * =================================================================== - * 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.music.eelf.logging; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Collectors; - -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.onap.music.authentication.AuthorizationError; -import org.onap.music.main.MusicUtil; - -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * - * This is the first filter in the chain to be executed before cadi - * authentication. The priority has been set in <code>MusicApplication</code> - * through filter registration bean - * - * The responsibility of this filter is to validate header values as per - * contract and write it to MDC and http response header back. - * - * - * @author sp931a - * - */ - -public class MusicLoggingServletFilter implements Filter { - - private EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MusicLoggingServletFilter.class); - // client transaction id, specific to client system, set in properties - public static final String CONVERSATION_ID = MusicUtil.getConversationIdPrefix() + "ConversationId"; - - // can be used as correlation-id in case of callback, also this can be passed to - // other services for tracking. - public static final String MESSAGE_ID = MusicUtil.getMessageIdPrefix() + "MessageId"; - - // client id would be the unique client source-system-id, i;e VALET or CONDUCTOR - // etc - public static final String CLIENT_ID = MusicUtil.getClientIdPrefix() + "ClientId"; - - // unique transaction of the source system - private static final String TRANSACTION_ID = MusicUtil.getTransIdPrefix() + "Transaction-Id"; - - public MusicLoggingServletFilter() throws ServletException { - super(); - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException { - - logger.info(EELFLoggerDelegate.securityLogger, - "In MusicLogginServletFilter doFilter start() :: [\"+MusicUtil.getTransIdRequired()+\",\"+MusicUtil.getConversationIdRequired()+\",\"+MusicUtil.getClientIdRequired()+\",\"+MusicUtil.getMessageIdRequired()"); - - HttpServletRequest httpRequest = null; - HttpServletResponse httpResponse = null; - Map<String, String> headerMap = null; - Map<String, String> upperCaseHeaderMap = null; - - if (null != request && null != response) { - httpRequest = (HttpServletRequest) request; - httpResponse = (HttpServletResponse) response; - - headerMap = getHeadersInfo(httpRequest); - - // The custom header values automatically converted into lower case, not sure - // why ? So i had to covert all keys to upper case - // The response header back to client will have all custom header values as - // upper case. - upperCaseHeaderMap = headerMap.entrySet().stream() - .collect(Collectors.toMap(entry -> entry.getKey().toUpperCase(), entry -> entry.getValue())); - // Enable/disable keys are present in /opt/app/music/etc/music.properties - - if (MusicUtil.getTransIdRequired() - && !upperCaseHeaderMap.containsKey(TRANSACTION_ID.toUpperCase())) { - populateError(httpResponse, "Transaction id '" + TRANSACTION_ID - + "' required on http header"); - return; - } else { - populateMDCAndResponseHeader(upperCaseHeaderMap, TRANSACTION_ID, "transactionId", - MusicUtil.getTransIdRequired(), httpResponse); - } - - if (MusicUtil.getConversationIdRequired() - && !upperCaseHeaderMap.containsKey(CONVERSATION_ID.toUpperCase())) { - populateError(httpResponse, "Conversation Id '" + CONVERSATION_ID - + "' required on http header"); - return; - } else { - populateMDCAndResponseHeader(upperCaseHeaderMap, CONVERSATION_ID, "conversationId", - MusicUtil.getConversationIdRequired(), httpResponse); - } - - if (MusicUtil.getMessageIdRequired() - && !upperCaseHeaderMap.containsKey(MESSAGE_ID.toUpperCase())) { - populateError(httpResponse, "Message Id '" + MESSAGE_ID - + "' required on http header"); - return; - } else { - populateMDCAndResponseHeader(upperCaseHeaderMap, MESSAGE_ID, "messageId", - MusicUtil.getMessageIdRequired(), httpResponse); - } - - if (MusicUtil.getClientIdRequired() - && !upperCaseHeaderMap.containsKey(CLIENT_ID.toUpperCase())) { - populateError(httpResponse, "Client Id '" + CLIENT_ID - + "' required on http header"); - return; - } else { - populateMDCAndResponseHeader(upperCaseHeaderMap, CLIENT_ID, "clientId", - MusicUtil.getClientIdRequired(), httpResponse); - } - - } - - logger.info(EELFLoggerDelegate.securityLogger, - "In MusicLogginServletFilter doFilter. Header values validated sucessfully"); - - chain.doFilter(request, response); - } - - private void populateError(HttpServletResponse httpResponse, String errMsg) throws IOException { - AuthorizationError authError = new AuthorizationError(); - authError.setResponseCode(HttpServletResponse.SC_BAD_REQUEST); - authError.setResponseMessage(errMsg); - - byte[] responseToSend = restResponseBytes(authError); - httpResponse.setHeader("Content-Type", "application/json"); - - // ideally the http response code should be 200, as this is a biz validation - // failure. For now, keeping it consistent with other places. - httpResponse.setStatus(HttpServletResponse.SC_BAD_REQUEST); - httpResponse.getOutputStream().write(responseToSend); - } - - private void populateMDCAndResponseHeader(Map<String, String> headerMap, String idKey, String mdcKey, - boolean isRequired, HttpServletResponse httpResponse) { - - idKey = idKey.trim().toUpperCase(); - - // 1. setting the keys & value in MDC for future use 2.setting the values in - // http response header back to client. - if (isRequired && (headerMap.containsKey(idKey))) { - EELFLoggerDelegate.mdcPut(mdcKey, headerMap.get(idKey)); - httpResponse.addHeader(idKey, headerMap.get(idKey)); - } else { - // do nothing - } - } - - private Map<String, String> getHeadersInfo(HttpServletRequest request) { - - Map<String, String> map = new HashMap<String, String>(); - - Enumeration<String> headerNames = request.getHeaderNames(); - while (headerNames.hasMoreElements()) { - String key = (String) headerNames.nextElement(); - String value = request.getHeader(key); - map.put(key, value); - } - - return map; - } - - private byte[] restResponseBytes(AuthorizationError eErrorResponse) throws IOException { - String serialized = new ObjectMapper().writeValueAsString(eErrorResponse); - return serialized.getBytes(); - } -} diff --git a/src/main/java/org/onap/music/eelf/logging/format/AppMessages.java b/src/main/java/org/onap/music/eelf/logging/format/AppMessages.java deleted file mode 100644 index 5af3661c..00000000 --- a/src/main/java/org/onap/music/eelf/logging/format/AppMessages.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * Copyright (c) 2019 IBM Intellectual Property - * =================================================================== - * 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.music.eelf.logging.format; - -/** - * @author inam - * - */ -public enum AppMessages { - - - - /* - * 100-199 Security/Permission Related - Authentication problems - * [ERR100E] Missing Information - * [ERR101E] Authentication error occured - * - * 200-299 Availability/Timeout Related/IO - connectivity error - connection timeout - * [ERR200E] Connectivity - * [ERR201E] Host not available - * [ERR202E] Error while connecting to Cassandra cluster - * [ERR203E] IO Error has occured - * [ERR204E] Execution Interrupted - * [ERR205E] Session Expired - * [ERR206E] Cache not authenticated - * - * - * 300-399 Data Access/Integrity Related - * [ERR300E] Incorrect data - * - * 400-499 - Cassandra Query Related - * [ERR400E] Error while processing prepared query object - * [ERR401E] Executing Session Failure for Request - * [ERR402E] Ill formed queryObject for the request - * [ERR403E] Error processing Prepared Query Object - * - * 500-599 - Locking Related - * [ERR500E] Invalid lock - * [ERR501E] Locking Error has occured - * [ERR502E] Deprecated - * [ERR503E] Failed to aquire lock store handle - * [ERR504E] Failed to create Lock Reference - * [ERR505E] Lock does not exist - * [ERR506E] Failed to aquire lock - * [ERR507E] Lock not aquired - * [ERR508E] Lock state not set - * [ERR509E] Lock not destroyed - * [ERR510E] Lock not released - * [ERR511E] Lock not deleted - * [ERR512E] Deprecated - * - * - * 600 - 699 - Music Service Errors - * [ERR600E] Error initializing the cache - * - * 700-799 Schema Interface Type/Validation - received Pay-load checksum is - * invalid - received JSON is not valid - * - * 800-899 Business/Flow Processing Related - check out to service is not - * allowed - Roll-back is done - failed to generate heat file - * - * - * 900-999 Unknown Errors - Unexpected exception - * [ERR900E] Unexpected error occured - * [ERR901E] Number format exception - * - * - * 1000-1099 Reserved - do not use - * - */ - - - - - MISSINGINFO("[ERR100E]", "Missing Information ","Details: NA", "Please check application credentials and/or headers"), - AUTHENTICATIONERROR("[ERR101E]", "Authentication error occured ","Details: NA", "Please verify application credentials"), - CONNCECTIVITYERROR("[ERR200E]"," Connectivity error","Details: NA ","Please check connectivity to external resources"), - HOSTUNAVAILABLE("[ERR201E]","Host not available","Details: NA","Please verify the host details"), - CASSANDRACONNECTIVITY("[ERR202E]","Error while connecting to Cassandra cluster",""," Please check cassandra cluster details"), - IOERROR("[ERR203E]","IO Error has occured","","Please check IO"), - EXECUTIONINTERRUPTED("[ERR204E]"," Execution Interrupted","",""), - SESSIONEXPIRED("[ERR205E]"," Session Expired","","Session has expired."), - CACHEAUTHENTICATION("[ERR206E]","Cache not authenticated",""," Cache not authenticated"), - - INCORRECTDATA("[ERR300E]"," Incorrect data",""," Please verify the request payload and try again"), - MULTIPLERECORDS("[ERR301E]"," Multiple records found",""," Please verify the request payload and try again"), - ALREADYEXIST("[ERR302E]"," Record already exist",""," Please verify the request payload and try again"), - MISSINGDATA("[ERR300E]"," Incorrect data",""," Please verify the request payload and try again"), - - QUERYERROR("[ERR400E]","Error while processing prepared query object",""," Please verify the query"), - SESSIONFAILED("[ERR401E]","Executing Session Failure for Request","","Please verify the session and request"), - - INVALIDLOCK("[ERR500E]"," Invalid lock or acquire failed",""," Lock is not valid to aquire"), - LOCKINGERROR("[ERR501E]"," Locking Error has occured",""," Locking Error has occured"), - LOCKHANDLE("[ERR503E]","Failed to aquire lock store handle",""," Failed to aquire lock store handle"), - CREATELOCK("[ERR504E]","Failed to aquire lock store handle ","","Failed to aquire lock store handle "), - LOCKSTATE("[ERR508E]"," Lock state not set",""," Lock state not set"), - DESTROYLOCK("[ERR509E]"," Lock not destroyed",""," Lock not destroyed"), - RELEASELOCK("[ERR510E]"," Lock not released",""," Lock not released"), - DELTELOCK("[ERR511E]",""," Lock not deleted "," Lock not deleted "), - CACHEERROR("[ERR600E]"," Error initializing the cache",""," Error initializing the cache"), - - UNKNOWNERROR("[ERR900E]"," Unexpected error occured",""," Please check logs for details"); - - - - - private ErrorTypes eType; - private ErrorSeverity alarmSeverity; - private ErrorSeverity errorSeverity; - private String errorCode; - private String errorDescription; - private String details; - private String resolution; - - - AppMessages(String errorCode, String errorDescription, String details,String resolution) { - - this.errorCode = errorCode; - this.errorDescription = errorDescription; - this.details = details; - this.resolution = resolution; - } - - - public ErrorTypes getEType() { - return eType; - } - - public ErrorSeverity getAlarmSeverity() { - return alarmSeverity; - } - public ErrorSeverity getErrorSeverity() { - return errorSeverity; - } - - public void setDetails(String details){ this.details=details; } - - public String getDetails() { - return this.details; - } - - public void setResolution(String resolution){ this.resolution=resolution; } - - public String getResolution() { - return this.resolution; - } - - public void setErrorCode(String errorCode){ this.errorCode=errorCode; } - - public String getErrorCode() { - return this.errorCode; - } - - public void setErrorDescription(String errorDescription){ this.errorDescription=errorDescription; } - - public String getErrorDescription() { - return this.errorDescription; - } - - - - - - - -} diff --git a/src/main/java/org/onap/music/eelf/logging/format/ErrorCodes.java b/src/main/java/org/onap/music/eelf/logging/format/ErrorCodes.java deleted file mode 100644 index 91ee3473..00000000 --- a/src/main/java/org/onap/music/eelf/logging/format/ErrorCodes.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * =================================================================== - * 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.music.eelf.logging.format; - - - -/** - * @author inam - * - */ -public enum ErrorCodes { - - - /* - * 100-199 Security/Permission Related - Authentication problems - * [ERR100E] Missing Information - * [ERR101E] Authentication error occured - * - * 200-299 Availability/Timeout Related/IO - connectivity error - connection timeout - * [ERR200E] Connectivity - * [ERR201E] Host not available - * [ERR202E] Error while connecting to Cassandra cluster - * [ERR203E] IO Error has occured - * [ERR204E] Execution Interrupted - * [ERR205E] Session Expired - * [ERR206E] Cache not authenticated - * - * - * 300-399 Data Access/Integrity Related - * - * 400-499 - Cassandra Query Related - * [ERR400E] Error while processing prepared query object - * [ERR401E] Executing Session Failure for Request - * [ERR402E] Ill formed queryObject for the request - * [ERR403E] Error processing Prepared Query Object - * - * 500-599 - Zookeepr/Locking Related - * [ERR500E] Invalid lock - * [ERR501E] Locking Error has occured - * [ERR502E] Zookeeper error has occured - * [ERR503E] Failed to aquire lock store handle - * [ERR504E] Failed to create Lock Reference - * [ERR505E] Lock does not exist - * [ERR506E] Failed to aquire lock - * [ERR507E] Lock not aquired - * [ERR508E] Lock state not set - * [ERR509E] Lock not destroyed - * [ERR510E] Lock not released - * [ERR511E] Lock not deleted - * [ERR512E] Failed to get Lock Handle - * - * - * 600 - 699 - Music Service Errors - * [ERR600E] Error initializing the cache - * - * 700-799 Schema Interface Type/Validation - received Pay-load checksum is - * invalid - received JSON is not valid - * - * 800-899 Business/Flow Processing Related - check out to service is not - * allowed - Roll-back is done - failed to generate heat file - * - * - * 900-999 Unknown Errors - Unexpected exception - * [ERR900E] Unexpected error occured - * [ERR901E] Number format exception - * - * - * 1000-1099 Reserved - do not use - * - */ - - /*SUCCESS("Success"), FAILURE("Failure"); - - private String result; - - ResultType(String result) { - this.result = result; - } - - public String getResult() { - return result; - } -*/ - - - -} diff --git a/src/main/java/org/onap/music/eelf/logging/format/ErrorSeverity.java b/src/main/java/org/onap/music/eelf/logging/format/ErrorSeverity.java deleted file mode 100644 index 4e798239..00000000 --- a/src/main/java/org/onap/music/eelf/logging/format/ErrorSeverity.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * =================================================================== - * 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.music.eelf.logging.format; - -/** - * @author inam - * - */ -public enum ErrorSeverity { - INFO, - WARN, - ERROR, - FATAL, - CRITICAL, - MAJOR, - MINOR, - NONE, -} diff --git a/src/main/java/org/onap/music/eelf/logging/format/ErrorTypes.java b/src/main/java/org/onap/music/eelf/logging/format/ErrorTypes.java deleted file mode 100644 index 9bdbf20f..00000000 --- a/src/main/java/org/onap/music/eelf/logging/format/ErrorTypes.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * ============LICENSE_START========================================== - * org.onap.music - * =================================================================== - * Copyright (c) 2017 AT&T Intellectual Property - * =================================================================== - * 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.music.eelf.logging.format; - -import com.att.eelf.i18n.EELFResolvableErrorEnum; - -/** - * @author inam - * - */ -public enum ErrorTypes implements EELFResolvableErrorEnum { - - - CONNECTIONERROR, - SESSIONEXPIRED, - AUTHENTICATIONERROR, - CACHEERROR, - SERVICEUNAVAILABLE, - QUERYERROR, - DATAERROR, - GENERALSERVICEERROR, - MUSICSERVICEERROR, - LOCKINGERROR, - UNKNOWN, - -} |