diff options
author | Stela Stoykova <Stela.Stoykova@amdocs.com> | 2019-05-27 14:57:34 -0400 |
---|---|---|
committer | Stela Stoykova <Stela.Stoykova@amdocs.com> | 2019-05-27 15:35:33 -0400 |
commit | 8524acbca18540f589dcb9d8335e3cc67fb6e059 (patch) | |
tree | 606ac86e9f72125114cb7a658364437d46729fe6 /champ-lib/champ-titan | |
parent | d1a8f8ff686326708829e51878b8c87643ff91a9 (diff) |
Updated champ-lib to use the correct logger
Issue-ID: AAI-2462
Signed-off-by: Stela Stoykova <Stela.Stoykova@amdocs.com>
Change-Id: I4a8e544c6eb44c6a3db295787b37f8787eabd50f
Diffstat (limited to 'champ-lib/champ-titan')
3 files changed, 97 insertions, 11 deletions
diff --git a/champ-lib/champ-titan/src/main/java/org/onap/aai/champtitan/graph/impl/ChampTitanMsgs.java b/champ-lib/champ-titan/src/main/java/org/onap/aai/champtitan/graph/impl/ChampTitanMsgs.java new file mode 100644 index 0000000..39bce81 --- /dev/null +++ b/champ-lib/champ-titan/src/main/java/org/onap/aai/champtitan/graph/impl/ChampTitanMsgs.java @@ -0,0 +1,40 @@ +/** + * ============LICENSE_START========================================== + * org.onap.aai + * =================================================================== + * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright © 2017-2018 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. + * ============LICENSE_END============================================ + */ +package org.onap.aai.champtitan.graph.impl; + +import com.att.eelf.i18n.EELFResourceManager; +import org.onap.aai.cl.eelf.LogMessageEnum; + +public enum ChampTitanMsgs implements LogMessageEnum { + + TITAN_CHAMP_GRAPH_IMPL_INFO, + TITAN_CHAMP_GRAPH_IMPL_ERROR, + TITAN_CHAMP_GRAPH_IMPL_WARN; + + + + /** + * Static initializer to ensure the resource bundles for this class are loaded... + */ + static { + EELFResourceManager.loadMessageBundle("logging/ChampTitanMsgs"); + } +} diff --git a/champ-lib/champ-titan/src/main/java/org/onap/aai/champtitan/graph/impl/TitanChampGraphImpl.java b/champ-lib/champ-titan/src/main/java/org/onap/aai/champtitan/graph/impl/TitanChampGraphImpl.java index 293b51c..2cec6ef 100644 --- a/champ-lib/champ-titan/src/main/java/org/onap/aai/champtitan/graph/impl/TitanChampGraphImpl.java +++ b/champ-lib/champ-titan/src/main/java/org/onap/aai/champtitan/graph/impl/TitanChampGraphImpl.java @@ -22,8 +22,16 @@ package org.onap.aai.champtitan.graph.impl; import java.security.SecureRandom; import java.time.temporal.ChronoUnit; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.Spliterator; +import java.util.Spliterators; import java.util.concurrent.ExecutionException; import java.util.stream.Stream; import java.util.stream.StreamSupport; @@ -47,8 +55,8 @@ import org.onap.aai.champcore.model.ChampRelationshipIndex; import org.onap.aai.champcore.model.ChampSchema; import org.onap.aai.champcore.schema.ChampSchemaEnforcer; import org.onap.aai.champcore.schema.DefaultChampSchemaEnforcer; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.onap.aai.cl.api.Logger; +import org.onap.aai.cl.eelf.LoggerFactory; import com.thinkaurelius.titan.core.Cardinality; import com.thinkaurelius.titan.core.EdgeLabel; @@ -67,7 +75,7 @@ import com.thinkaurelius.titan.graphdb.database.management.ManagementSystem; public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph { - private static final Logger LOGGER = LoggerFactory.getLogger(TitanChampGraphImpl.class); + private static final Logger LOGGER = LoggerFactory.getInstance().getLogger(TitanChampGraphImpl.class); private static final String TITAN_UNIQUE_SUFFIX = "graph.unique-instance-id-suffix"; private static final String TITAN_CASSANDRA_KEYSPACE = "storage.cassandra.keyspace"; private static final String TITAN_HBASE_TABLE = "storage.hbase.table"; @@ -115,7 +123,8 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph { throw new RuntimeException("Unknown storage.backend=" + storageBackend); } - LOGGER.info("Instantiated data access layer for Titan graph data store with backend: " + storageBackend); + LOGGER.info(ChampTitanMsgs.TITAN_CHAMP_GRAPH_IMPL_INFO, + "Instantiated data access layer for Titan graph data store with backend: " + storageBackend); this.graph = titanGraphBuilder.open(); } @@ -371,11 +380,13 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph { .timeout(REGISTER_OBJECT_INDEX_TIMEOUT_SECS, ChronoUnit.SECONDS) .call() .getSucceeded()) { - LOGGER.warn("Object index was created, but timed out while waiting for it to be registered"); + LOGGER.warn(ChampTitanMsgs.TITAN_CHAMP_GRAPH_IMPL_WARN, + "Object index was created, but timed out while waiting for it to be registered"); return; } } catch (InterruptedException e) { - LOGGER.warn("Interrupted while waiting for object index creation status"); + LOGGER.warn(ChampTitanMsgs.TITAN_CHAMP_GRAPH_IMPL_WARN, + "Interrupted while waiting for object index creation status"); Thread.currentThread().interrupt(); return; } @@ -387,11 +398,13 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph { updateIndexMgmt.updateIndex(updateIndexMgmt.getGraphIndex(indexName),SchemaAction.REINDEX).get(); updateIndexMgmt.commit(); } catch (InterruptedException e) { - LOGGER.warn("Interrupted while reindexing for object index"); + LOGGER.warn(ChampTitanMsgs.TITAN_CHAMP_GRAPH_IMPL_WARN, + "Interrupted while reindexing for object index"); Thread.currentThread().interrupt(); return; } catch (ExecutionException e) { - LOGGER.warn("Exception occurred during reindexing procedure for creating object index " + indexName, e); + LOGGER.warn(ChampTitanMsgs.TITAN_CHAMP_GRAPH_IMPL_WARN, + "Exception occurred during reindexing procedure for creating object index " + indexName + ". " + e.getMessage()); } try { @@ -400,7 +413,8 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph { .timeout(10, ChronoUnit.MINUTES) .call(); } catch (InterruptedException e) { - LOGGER.warn("Interrupted while waiting for index to transition to ENABLED state"); + LOGGER.warn(ChampTitanMsgs.TITAN_CHAMP_GRAPH_IMPL_WARN, + "Interrupted while waiting for index to transition to ENABLED state"); Thread.currentThread().interrupt(); return; } @@ -489,6 +503,7 @@ public final class TitanChampGraphImpl extends AbstractTinkerpopChampGraph { @Override public void createDefaultIndexes() { - LOGGER.error("No default indexes being created"); + LOGGER.error(ChampTitanMsgs.TITAN_CHAMP_GRAPH_IMPL_ERROR, + "No default indexes being created"); } } diff --git a/champ-lib/champ-titan/src/main/resources/logging/ChampTitanMsgs.properties b/champ-lib/champ-titan/src/main/resources/logging/ChampTitanMsgs.properties new file mode 100644 index 0000000..5b0e1bc --- /dev/null +++ b/champ-lib/champ-titan/src/main/resources/logging/ChampTitanMsgs.properties @@ -0,0 +1,31 @@ +#Resource key=Error Code|Message text|Resolution text |Description text +####### +#Newlines can be utilized to add some clarity ensuring continuing line +#has atleast one leading space +#ResourceKey=\ +# ERR0000E\ +# Sample error msg txt\ +# Sample resolution msg\ +# Sample description txt +# +###### +#Error code classification category +#000 Info/Debug +#100 Permission errors +#200 Availability errors/Timeouts +#300 Data errors +#400 Schema Interface type/validation errors +#500 Business process errors +#900 Unknown errors +# +######################################################################## + +TITAN_CHAMP_GRAPH_IMPL_INFO=\ + CT0011I|\ + TitanChampGraphImpl: {0} +TITAN_CHAMP_GRAPH_IMPL_ERROR=\ + CT0511E|\ + TitanChampGraphImpl Error: {0} +TITAN_CHAMP_GRAPH_IMPL_WARN=\ + CT0512E|\ + TitanChampGraphImpl Warning: {0} |