From 7a2c23b3ad83eab0eed5b990c70a1603447d5ee5 Mon Sep 17 00:00:00 2001 From: "Singla, Rajiv (rs153v)" Date: Wed, 15 Aug 2018 11:46:10 -0400 Subject: Standalone TCA with EELF Logger Issue-ID: DCAEGEN2-633 Change-Id: I4da76b532021c0d6248455e7bd6e77f4614c35a7 Signed-off-by: Singla, Rajiv (rs153v) --- .../utils/eelf/logger/api/noop/NoOpAuditLog.java | 90 ++++++++++++++++++++++ .../utils/eelf/logger/api/noop/NoOpDebugLog.java | 56 ++++++++++++++ .../utils/eelf/logger/api/noop/NoOpEELFLogger.java | 77 ++++++++++++++++++ .../utils/eelf/logger/api/noop/NoOpErrorLog.java | 68 ++++++++++++++++ .../utils/eelf/logger/api/noop/NoOpMetricLog.java | 89 +++++++++++++++++++++ .../utils/eelf/logger/api/noop/package-info.java | 26 +++++++ 6 files changed, 406 insertions(+) create mode 100644 eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpAuditLog.java create mode 100644 eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpDebugLog.java create mode 100644 eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpEELFLogger.java create mode 100644 eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpErrorLog.java create mode 100644 eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpMetricLog.java create mode 100644 eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/package-info.java (limited to 'eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop') diff --git a/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpAuditLog.java b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpAuditLog.java new file mode 100644 index 0000000..6c1c583 --- /dev/null +++ b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpAuditLog.java @@ -0,0 +1,90 @@ +/* + * ================================================================================ + * 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.dcae.utils.eelf.logger.api.noop; + + +import org.onap.dcae.utils.eelf.logger.api.info.LogLevelCategory; +import org.onap.dcae.utils.eelf.logger.api.log.AuditLog; +import org.onap.dcae.utils.eelf.logger.api.spec.AuditLogSpec; +import org.onap.dcae.utils.eelf.logger.api.spec.OptionalLogSpec; + +/** + * A no operation implementation of AuditLog + * + * @author Rajiv Singla + */ +public class NoOpAuditLog implements AuditLog { + + @Override + public void log(final LogLevelCategory logLevelCategory, final String message, final AuditLogSpec auditLogSpec, + final OptionalLogSpec optionalLogSpec, final String... args) { + // no operation + } + + @Override + public void log(final LogLevelCategory logLevelCategory, final String message, final AuditLogSpec auditLogSpec, + final String... args) { + // no operation + } + + @Override + public void info(final String message, final AuditLogSpec auditLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void info(final String message, final AuditLogSpec auditLogSpec, final String... args) { + // no operation + } + + @Override + public void warn(final String message, final AuditLogSpec auditLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void warn(final String message, final AuditLogSpec auditLogSpec, final String... args) { + // no operation + } + + @Override + public void error(final String message, final AuditLogSpec auditLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void error(final String message, final AuditLogSpec auditLogSpec, final String... args) { + // no operation + } + + @Override + public void fatal(final String message, final AuditLogSpec auditLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void fatal(final String message, final AuditLogSpec auditLogSpec, final String... args) { + // no operation + } +} diff --git a/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpDebugLog.java b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpDebugLog.java new file mode 100644 index 0000000..dd36b52 --- /dev/null +++ b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpDebugLog.java @@ -0,0 +1,56 @@ +/* + * ================================================================================ + * 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.dcae.utils.eelf.logger.api.noop; + + +import org.onap.dcae.utils.eelf.logger.api.info.LogLevelCategory; +import org.onap.dcae.utils.eelf.logger.api.log.DebugLog; +import org.onap.dcae.utils.eelf.logger.api.spec.DebugLogSpec; +import org.onap.dcae.utils.eelf.logger.api.spec.OptionalLogSpec; + +/** + * A no operation implementation of Debug Log + * + * @author Rajiv Singla + */ +public class NoOpDebugLog implements DebugLog { + @Override + public void log(final LogLevelCategory logLevelCategory, final String message, final DebugLogSpec debugLogSpec, + final OptionalLogSpec optionalLogSpec, final String... args) { + // no operation + } + + @Override + public void log(final LogLevelCategory logLevelCategory, final String message, final DebugLogSpec debugLogSpec, + final String... args) { + // no operation + } + + @Override + public void debug(final String message, final DebugLogSpec debugLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void debug(final String message, final DebugLogSpec debugLogSpec, final String... args) { + // no operation + } +} diff --git a/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpEELFLogger.java b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpEELFLogger.java new file mode 100644 index 0000000..c761ba1 --- /dev/null +++ b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpEELFLogger.java @@ -0,0 +1,77 @@ +/* + * ================================================================================ + * 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.dcae.utils.eelf.logger.api.noop; + + +import org.onap.dcae.utils.eelf.logger.api.log.AuditLog; +import org.onap.dcae.utils.eelf.logger.api.log.DebugLog; +import org.onap.dcae.utils.eelf.logger.api.log.EELFLogger; +import org.onap.dcae.utils.eelf.logger.api.log.EELFLoggerContext; +import org.onap.dcae.utils.eelf.logger.api.log.ErrorLog; +import org.onap.dcae.utils.eelf.logger.api.log.MetricLog; + +/** + * A no operation implementation of {@link EELFLogger} + * + * @author Rajiv Singla + */ +public class NoOpEELFLogger implements EELFLogger { + + private static final AuditLog NO_OP_AUDIT_LOG = new NoOpAuditLog(); + private static final MetricLog NO_OP_METRIC_LOG = new NoOpMetricLog(); + private static final ErrorLog NO_OP_ERROR_LOG = new NoOpErrorLog(); + private static final DebugLog NO_OP_DEBUG_LOG = new NoOpDebugLog(); + + private static final NoOpEELFLogger NO_OP_EELF_LOGGER = new NoOpEELFLogger(); + + private NoOpEELFLogger() { + // private constructor + } + + public static NoOpEELFLogger getInstance() { + return NO_OP_EELF_LOGGER; + } + + @Override + public AuditLog auditLog() { + return NO_OP_AUDIT_LOG; + } + + @Override + public MetricLog metricLog() { + return NO_OP_METRIC_LOG; + } + + @Override + public ErrorLog errorLog() { + return NO_OP_ERROR_LOG; + } + + @Override + public DebugLog debugLog() { + return NO_OP_DEBUG_LOG; + } + + @Override + public EELFLoggerContext loggingContext() { + return null; + } + +} diff --git a/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpErrorLog.java b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpErrorLog.java new file mode 100644 index 0000000..c1b4e13 --- /dev/null +++ b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpErrorLog.java @@ -0,0 +1,68 @@ +/* + * ================================================================================ + * 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.dcae.utils.eelf.logger.api.noop; + + +import org.onap.dcae.utils.eelf.logger.api.info.LogLevelCategory; +import org.onap.dcae.utils.eelf.logger.api.log.ErrorLog; +import org.onap.dcae.utils.eelf.logger.api.spec.ErrorLogSpec; +import org.onap.dcae.utils.eelf.logger.api.spec.OptionalLogSpec; + +/** + * A no operation implementation of Error Log + * + * @author Rajiv Singla + */ +public class NoOpErrorLog implements ErrorLog { + + @Override + public void log(final LogLevelCategory logLevelCategory, final String message, final ErrorLogSpec errorLogSpec, + final OptionalLogSpec optionalLogSpec, final String... args) { + // no operation + } + + @Override + public void log(final LogLevelCategory logLevelCategory, final String message, final ErrorLogSpec errorLogSpec, + final String... args) { + // no operation + } + + @Override + public void error(final String message, final ErrorLogSpec errorLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void error(final String message, final ErrorLogSpec errorLogSpec, final String... args) { + // no operation + } + + @Override + public void warn(final String message, final ErrorLogSpec errorLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void warn(final String message, final ErrorLogSpec errorLogSpec, final String... args) { + // no operation + } +} diff --git a/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpMetricLog.java b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpMetricLog.java new file mode 100644 index 0000000..1c67862 --- /dev/null +++ b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/NoOpMetricLog.java @@ -0,0 +1,89 @@ +/* + * ================================================================================ + * 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.dcae.utils.eelf.logger.api.noop; + + +import org.onap.dcae.utils.eelf.logger.api.info.LogLevelCategory; +import org.onap.dcae.utils.eelf.logger.api.log.MetricLog; +import org.onap.dcae.utils.eelf.logger.api.spec.MetricLogSpec; +import org.onap.dcae.utils.eelf.logger.api.spec.OptionalLogSpec; + +/** + * A no operation implementation of Metric Log + * + * @author Rajiv Singla + */ +public class NoOpMetricLog implements MetricLog { + @Override + public void log(final LogLevelCategory logLevelCategory, final String message, final MetricLogSpec metricLogSpec, + final OptionalLogSpec optionalLogSpec, final String... args) { + // no operation + } + + @Override + public void log(final LogLevelCategory logLevelCategory, final String message, final MetricLogSpec metricLogSpec, + final String... args) { + // no operation + } + + @Override + public void info(final String message, final MetricLogSpec metricLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void info(final String message, final MetricLogSpec metricLogSpec, final String... args) { + // no operation + } + + @Override + public void warn(final String message, final MetricLogSpec metricLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void warn(final String message, final MetricLogSpec metricLogSpec, final String... args) { + // no operation + } + + @Override + public void error(final String message, final MetricLogSpec metricLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void error(final String message, final MetricLogSpec metricLogSpec, final String... args) { + // no operation + } + + @Override + public void fatal(final String message, final MetricLogSpec metricLogSpec, final OptionalLogSpec optionalLogSpec, + final String... args) { + // no operation + } + + @Override + public void fatal(final String message, final MetricLogSpec metricLogSpec, final String... args) { + // no operation + } +} diff --git a/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/package-info.java b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/package-info.java new file mode 100644 index 0000000..f7ed917 --- /dev/null +++ b/eelf-logger/eelf-logger-api/src/main/java/org/onap/dcae/utils/eelf/logger/api/noop/package-info.java @@ -0,0 +1,26 @@ +/* + * ================================================================================ + * 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========================================================= + * + */ + +/** + * Contains no operation implementation of EELF Logging API. Generally used as a fallback when no EELF Logging + * implementation is detected in the application classpath + * + * @author Rajiv Singla + */ +package org.onap.dcae.utils.eelf.logger.api.noop; -- cgit 1.2.3-korg