aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-10-13 15:27:43 +0200
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>2024-10-17 09:53:19 +0200
commitd567ebe4b4f74ad9ac442cca27c361c971c67e1e (patch)
treec78c964e0a7e06dcdba9ef355aca35421b1e19a8 /src/main/java
parentad17eaad323295cd61effc6bb9931e872b9b2d92 (diff)
Upgrade aai-common dependency to 1.15.1-SNAPSHOT
- remove ActiveMq dependency Issue-ID: AAI-4017 Change-Id: Ie475172ad13bc5ddd482822db36f1ce48bc846c9 Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/onap/aai/migration/Migrator.java35
-rw-r--r--src/main/java/org/onap/aai/migration/NotificationHelper.java9
-rw-r--r--src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java10
-rw-r--r--src/main/java/org/onap/aai/util/SendMigrationNotifications.java7
4 files changed, 37 insertions, 24 deletions
diff --git a/src/main/java/org/onap/aai/migration/Migrator.java b/src/main/java/org/onap/aai/migration/Migrator.java
index 57291e0..ca9af63 100644
--- a/src/main/java/org/onap/aai/migration/Migrator.java
+++ b/src/main/java/org/onap/aai/migration/Migrator.java
@@ -38,6 +38,7 @@ import org.apache.tinkerpop.gremlin.structure.VertexProperty;
import org.json.JSONException;
import org.json.JSONObject;
import org.onap.aai.aailog.logs.AaiDebugLog;
+import org.onap.aai.config.SpringContextAware;
import org.onap.aai.edges.EdgeIngestor;
import org.onap.aai.edges.enums.EdgeType;
import org.onap.aai.edges.exceptions.AmbiguousRuleChoiceException;
@@ -47,6 +48,7 @@ import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
+import org.onap.aai.kafka.NotificationProducer;
import org.onap.aai.serialization.db.DBSerializer;
import org.onap.aai.serialization.db.EdgeSerializer;
import org.onap.aai.serialization.db.exceptions.NoEdgeRuleFoundException;
@@ -63,7 +65,7 @@ import org.slf4j.MDC;
@MigrationPriority(0)
@MigrationDangerRating(0)
public abstract class Migrator implements Runnable {
-
+
protected Logger logger = null;
protected DBSerializer serializer = null;
@@ -80,7 +82,7 @@ public abstract class Migrator implements Runnable {
protected static final String MIGRATION_ERROR = "Migration Error: ";
protected static final String MIGRATION_SUMMARY_COUNT = "Migration Summary Count: ";
-
+
private static AaiDebugLog debugLog = new AaiDebugLog();
static {
debugLog.setupMDC();
@@ -99,8 +101,9 @@ public abstract class Migrator implements Runnable {
this.edgeIngestor = edgeIngestor;
this.edgeSerializer = edgeSerializer;
this.schemaVersions = schemaVersions;
- initDBSerializer();
- this.notificationHelper = new NotificationHelper(loader, serializer, loaderFactory, schemaVersions, engine, "AAI-MIGRATION", this.getMigrationName());
+ initDBSerializer();
+ NotificationProducer notificationProducer = SpringContextAware.getBean(NotificationProducer.class);
+ this.notificationHelper = new NotificationHelper(notificationProducer, loader, serializer, loaderFactory, schemaVersions, engine, "AAI-MIGRATION", this.getMigrationName());
MDC.put("logFilenameAppender", this.getClass().getSimpleName());
logger = LoggerFactory.getLogger(this.getClass().getSimpleName());
logAndPrint(logger,"\tInitilization of " + this.getClass().getSimpleName() + " migration script complete.");
@@ -141,8 +144,8 @@ public abstract class Migrator implements Runnable {
if (dmaapMsgList.size() > 0) {
try {
Files.write(Paths.get(logDirectory+"/"+fileName), (Iterable<String>)dmaapMsgList.stream()::iterator);
- } catch (IOException e) {
- System.out.println("Unable to generate file with dmaap msgs for " + getMigrationName() +
+ } catch (IOException e) {
+ System.out.println("Unable to generate file with dmaap msgs for " + getMigrationName() +
" Exception is: " + e.getMessage());
logger.error("Unable to generate file with dmaap msgs for " + getMigrationName(), e);
}
@@ -299,7 +302,7 @@ public abstract class Migrator implements Runnable {
}
}
-
+
/**
* Creates the edge
*
@@ -321,7 +324,7 @@ public abstract class Migrator implements Runnable {
}
return newEdge;
}
-
+
/**
* Creates the edge
*
@@ -363,7 +366,7 @@ public abstract class Migrator implements Runnable {
}
/**
- * Creates the TREE edge
+ * Creates the TREE edge
*
* @param out the out
* @param in the in
@@ -373,9 +376,9 @@ public abstract class Migrator implements Runnable {
Edge newEdge = createEdge(EdgeType.TREE, out, in);
return newEdge;
}
-
+
/**
- * Creates the COUSIN edge
+ * Creates the COUSIN edge
*
* @param out the out
* @param in the in
@@ -396,19 +399,19 @@ public abstract class Migrator implements Runnable {
throw new RuntimeException("could not create seralizer", e);
}
}
-
+
/**
* These are the node types you would like your traversal to process
* @return
*/
public abstract Optional<String[]> getAffectedNodeTypes();
-
+
/**
* used as the "fromAppId" when modifying vertices
* @return
*/
public abstract String getMigrationName();
-
+
/**
* updates all internal vertex properties
* @param v
@@ -417,11 +420,11 @@ public abstract class Migrator implements Runnable {
protected void touchVertexProperties(Vertex v, boolean isNewVertex) {
this.serializer.touchStandardVertexProperties(v, isNewVertex);
}
-
+
public NotificationHelper getNotificationHelper() {
return this.notificationHelper;
}
-
+
/**
* Log and print.
*
diff --git a/src/main/java/org/onap/aai/migration/NotificationHelper.java b/src/main/java/org/onap/aai/migration/NotificationHelper.java
index 817e5df..de13dbb 100644
--- a/src/main/java/org/onap/aai/migration/NotificationHelper.java
+++ b/src/main/java/org/onap/aai/migration/NotificationHelper.java
@@ -32,6 +32,7 @@ import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.exceptions.AAIUnknownObjectException;
+import org.onap.aai.kafka.NotificationProducer;
import org.onap.aai.rest.notification.UEBNotification;
import org.onap.aai.serialization.db.DBSerializer;
import org.onap.aai.serialization.engines.TransactionalGraphEngine;
@@ -54,14 +55,16 @@ public class NotificationHelper {
protected final String transactionId;
protected final String sourceOfTruth;
protected final UEBNotification notification;
+ protected final NotificationProducer notificationProducer;
- public NotificationHelper(Loader loader, DBSerializer serializer, LoaderFactory loaderFactory, SchemaVersions schemaVersions, TransactionalGraphEngine engine, String transactionId, String sourceOfTruth) {
+ public NotificationHelper(NotificationProducer notificationProducer, Loader loader, DBSerializer serializer, LoaderFactory loaderFactory, SchemaVersions schemaVersions, TransactionalGraphEngine engine, String transactionId, String sourceOfTruth) {
this.loader = loader;
this.serializer = serializer;
this.engine = engine;
this.transactionId = transactionId;
this.sourceOfTruth = sourceOfTruth;
- this.notification = new UEBNotification(loader, loaderFactory, schemaVersions);
+ this.notification = new UEBNotification(loaderFactory, schemaVersions);
+ this.notificationProducer = notificationProducer;
MDC.put("logFilenameAppender", this.getClass().getSimpleName());
LOGGER = LoggerFactory.getLogger(this.getClass().getSimpleName());
@@ -113,7 +116,7 @@ public class NotificationHelper {
}
public void triggerEvents() throws AAIException {
- notification.triggerEvents();
+ notificationProducer.sendUEBNotification(notification);
}
public UEBNotification getNotifications() {
diff --git a/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java b/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java
index 865dc27..6cb6ed6 100644
--- a/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java
+++ b/src/main/java/org/onap/aai/util/SendDeleteMigrationNotifications.java
@@ -20,12 +20,15 @@
package org.onap.aai.util;
import com.att.eelf.configuration.Configuration;
+
+import org.onap.aai.config.SpringContextAware;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
+import org.onap.aai.kafka.NotificationProducer;
import org.onap.aai.migration.EventAction;
import org.onap.aai.migration.NotificationHelper;
import org.onap.aai.serialization.db.DBSerializer;
@@ -66,7 +69,7 @@ public class SendDeleteMigrationNotifications {
protected final LoaderFactory loaderFactory;
protected final SchemaVersions schemaVersions;
protected final SchemaVersion version;
-
+
public SendDeleteMigrationNotifications(LoaderFactory loaderFactory, SchemaVersions schemaVersions, String config, String path, int sleepInMilliSecs, int numToBatch, String requestId, EventAction eventAction, String eventSource) {
System.setProperty("aai.service.name", SendDeleteMigrationNotifications.class.getSimpleName());
Properties props = System.getProperties();
@@ -157,7 +160,8 @@ public class SendDeleteMigrationNotifications {
} catch (AAIException e) {
throw new RuntimeException("could not create serializer", e);
}
- this.notificationHelper = new NotificationHelper(loader, serializer, loaderFactory, schemaVersions, engine, requestId, this.eventSource);
+ NotificationProducer notificationProducer = SpringContextAware.getBean(NotificationProducer.class);
+ this.notificationHelper = new NotificationHelper(notificationProducer, loader, serializer, loaderFactory, schemaVersions, engine, requestId, this.eventSource);
}
protected void initGraph() {
@@ -173,4 +177,4 @@ public class SendDeleteMigrationNotifications {
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/org/onap/aai/util/SendMigrationNotifications.java b/src/main/java/org/onap/aai/util/SendMigrationNotifications.java
index c51de1e..a66e491 100644
--- a/src/main/java/org/onap/aai/util/SendMigrationNotifications.java
+++ b/src/main/java/org/onap/aai/util/SendMigrationNotifications.java
@@ -22,6 +22,7 @@ package org.onap.aai.util;
import com.att.eelf.configuration.Configuration;
import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource;
import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.onap.aai.config.SpringContextAware;
import org.onap.aai.db.props.AAIProperties;
import org.onap.aai.dbmap.AAIGraph;
import org.onap.aai.exceptions.AAIException;
@@ -29,6 +30,7 @@ import org.onap.aai.introspection.Introspector;
import org.onap.aai.introspection.Loader;
import org.onap.aai.introspection.LoaderFactory;
import org.onap.aai.introspection.ModelType;
+import org.onap.aai.kafka.NotificationProducer;
import org.onap.aai.migration.EventAction;
import org.onap.aai.migration.NotificationHelper;
import org.onap.aai.serialization.db.DBSerializer;
@@ -172,7 +174,8 @@ public class SendMigrationNotifications {
} catch (AAIException e) {
throw new RuntimeException("could not create serializer", e);
}
- this.notificationHelper = new NotificationHelper(loader, serializer, loaderFactory, schemaVersions, engine, requestId, this.eventSource);
+ NotificationProducer notificationProducer = SpringContextAware.getBean(NotificationProducer.class);
+ this.notificationHelper = new NotificationHelper(notificationProducer, loader, serializer, loaderFactory, schemaVersions, engine, requestId, this.eventSource);
}
protected void initGraph() {
@@ -188,4 +191,4 @@ public class SendMigrationNotifications {
}
-} \ No newline at end of file
+}