aboutsummaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main
diff options
context:
space:
mode:
authorwasala <przemyslaw.wasala@nokia.com>2018-04-24 15:00:26 +0200
committerwasala <przemyslaw.wasala@nokia.com>2018-04-25 19:28:44 +0200
commitd7640cf52a678a63698e1a2293e116b350eaa7f7 (patch)
tree11e3a577d9dab71bc6eaae64a84914591d9cdb18 /prh-app-server/src/main
parent74c5bf5b2f99043a8cb29aa8f2b9fde253b92e72 (diff)
Load configuration by executing tasks
Change-Id: Ie8f18a836e42dabd96a8bdb41e6ba8189c59e023 Issue-ID: DCAEGEN2-469 Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
Diffstat (limited to 'prh-app-server/src/main')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java2
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskImpl.java4
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java5
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java5
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java2
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/Task.java5
7 files changed, 22 insertions, 2 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
index d6ca423b..85ca5226 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
@@ -34,4 +34,6 @@ public interface AppConfig {
DmaapPublisherConfiguration getDmaapPublisherConfiguration();
+ void initFileStreamReader();
+
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
index 1bd90eef..2fa35608 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
@@ -72,6 +72,7 @@ public class PrhAppConfig implements AppConfig {
@NotEmpty
private String filepath;
+ @Override
public void initFileStreamReader() {
GsonBuilder gsonBuilder = new GsonBuilder();
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskImpl.java
index 47733946..9a256986 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AAIPublisherTaskImpl.java
@@ -68,6 +68,10 @@ public class AAIPublisherTaskImpl extends AAIPublisherTask<AAIHttpClientConfigur
}
@Override
+ void initConfigs() {
+ }
+
+ @Override
protected AAIHttpClientConfiguration resolveConfiguration() {
return prhAppConfig.getAAIHttpClientConfiguration();
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
index 1ee85d03..f7cc7e1d 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
@@ -70,4 +70,9 @@ public class DmaapConsumerTaskImpl extends DmaapConsumerTask<DmaapConsumerConfig
protected DmaapConsumerConfiguration resolveConfiguration() {
return prhAppConfig.getDmaapConsumerConfiguration();
}
+
+ @Override
+ protected void initConfigs() {
+ prhAppConfig.initFileStreamReader();
+ }
} \ No newline at end of file
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
index b14d8d37..74d08539 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
@@ -65,6 +65,11 @@ public class DmaapPublisherTaskImpl extends DmaapPublisherTask<DmaapPublisherCon
}
@Override
+ void initConfigs() {
+
+ }
+
+ @Override
protected DmaapPublisherConfiguration resolveConfiguration() {
return prhAppConfig.getDmaapPublisherConfiguration();
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
index a9c53ccc..c051afbc 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
@@ -21,6 +21,7 @@ package org.onap.dcaegen2.services.prh.tasks;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
+import org.onap.dcaegen2.services.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -53,6 +54,7 @@ public class ScheduledTasks {
LocalDateTime.now()));
setTaskExecutionFlow();
try {
+ dmaapConsumerTask.initConfigs();
dmaapConsumerTask.receiveRequest(null);
} catch (PrhTaskException e) {
logger
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/Task.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/Task.java
index f5e8b39e..3f521f2c 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/Task.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/Task.java
@@ -36,7 +36,8 @@ public abstract class Task {
}
public void receiveRequest(Object body) throws PrhTaskException {
- Object responseEntity = execute(body);
+
+ ResponseEntity responseEntity = execute(body);
if (taskProcess != null) {
taskProcess.receiveRequest(responseEntity);
}
@@ -44,5 +45,5 @@ public abstract class Task {
abstract ResponseEntity execute(Object object) throws PrhTaskException;
-
+ abstract void initConfigs();
}