* ============LICENSE_START==========================================
* org.onap.aai
* ===================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 2017 Amdocs
+ * 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.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END============================================
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.aai.champcore.graph.impl;
import java.util.Set;
import java.util.Spliterator;
import java.util.Spliterators;
-import java.util.Vector;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.apache.tinkerpop.gremlin.structure.Property;
import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.apache.tinkerpop.gremlin.structure.VertexProperty;
+import org.onap.aai.champcore.ChampCoreMsgs;
import org.onap.aai.champcore.ChampTransaction;
-import org.onap.aai.champcore.NoOpTinkerPopTransaction;
import org.onap.aai.champcore.exceptions.ChampMarshallingException;
import org.onap.aai.champcore.exceptions.ChampObjectNotExistsException;
import org.onap.aai.champcore.exceptions.ChampRelationshipNotExistsException;
import org.onap.aai.champcore.model.ChampSchema;
import org.onap.aai.champcore.model.fluent.partition.CreateChampPartitionable;
import org.onap.aai.champcore.transform.TinkerpopChampformer;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public abstract class AbstractTinkerpopChampGraph extends AbstractValidatingChampGraph {
- private static final Logger LOGGER = LoggerFactory.getLogger(AbstractTinkerpopChampGraph.class);
+ private static final Logger LOGGER = LoggerFactory.getInstance().getLogger(AbstractTinkerpopChampGraph.class);
private static final TinkerpopChampformer TINKERPOP_CHAMPFORMER = new TinkerpopChampformer();
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
return Stream.empty();
}
} catch (ChampUnmarshallingException e) {
- LOGGER.warn("Failed to unmarshall object", e);
+ LOGGER.warn(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_WARN,
+ "Failed to unmarshall object. " + e.getMessage());
return Stream.empty();
}
}
next = getChampformer().unmarshallObject(query.next());
return true;
} catch (ChampUnmarshallingException e) {
- LOGGER.warn("Failed to unmarshall tinkerpop vertex during query, returning partial results", e);
+ LOGGER.warn(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_WARN,
+ "Failed to unmarshall tinkerpop vertex during query, returning partial results" + e.getMessage());
}
}
tx.commit(); //Danger ahead if this iterator is not completely consumed
//then the transaction cache will hold stale values
} catch (ChampTransactionException e) {
- LOGGER.warn("Failed transaction commit due to: " + e.getMessage());
+ LOGGER.warn(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_WARN,
+ "Failed transaction commit due to: " + e.getMessage());
}
}
next = getChampformer().unmarshallRelationship(edges.next());
return true;
} catch (ChampUnmarshallingException e) {
- LOGGER.warn("Failed to unmarshall tinkerpop edge during query, returning partial results", e);
+ LOGGER.warn(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_WARN,
+ "Failed to unmarshall tinkerpop edge during query, returning partial results" + e.getMessage());
}
}
//consumed, then the transaction cache will be stale
} catch (ChampTransactionException e) {
- LOGGER.warn("Failed transaction commit due to: " + e.getMessage());
+ LOGGER.warn(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_WARN,
+ "Failed transaction commit due to: " + e.getMessage());
}
}
}
} catch (ChampUnmarshallingException e) {
- LOGGER.warn("Failed to unmarshall relationship", e);
+ LOGGER.warn(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_WARN,
+ "Failed to unmarshall relationship" + e.getMessage());
return Stream.empty();
}
}
next = getChampformer().unmarshallRelationship(query.next());
return true;
} catch (ChampUnmarshallingException e) {
- LOGGER.warn("Failed to unmarshall tinkerpop vertex during query, returning partial results", e);
+ LOGGER.warn(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_WARN,
+ "Failed to unmarshall tinkerpop vertex during query, returning partial results" + e.getMessage());
}
}
//consumed, then the transaction cache will be stale
} catch (ChampTransactionException e) {
- LOGGER.warn("Failed transaction commit due to " + e.getMessage());
+ LOGGER.warn(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_WARN,
+ "Failed transaction commit due to " + e.getMessage());
}
}
try {
getGraph().close();
} catch (Throwable t) {
- LOGGER.error("Exception while shutting down graph", t);
+ LOGGER.error(ChampCoreMsgs.CHAMPCORE_ABSTRACT_TINKERPOP_CHAMP_GRAPH_ERROR,
+ "Exception while shutting down graph" + t.getMessage());
}
} else {
throw new IllegalStateException("Cannot call shutdown() after shutdown() was already initiated");