summaryrefslogtreecommitdiffstats
path: root/services/services-onappf/src/main
diff options
context:
space:
mode:
authorRam Krishna Verma <ram.krishna.verma@est.tech>2019-07-01 08:57:52 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-01 08:57:52 +0000
commitc4baac8a79b0ca6340693ae47f9c424f3612e3bd (patch)
tree5a696cbb454e880bcf38996ac71bdd65cbd40651 /services/services-onappf/src/main
parent423e98641ca7fe79a1b1bb897aa8a4b17ba5ee4d (diff)
parent037e421b700ba836e053fdc58101104a0b6ccb0e (diff)
Merge "Remove topic.properties and incorporate into overall properties"
Diffstat (limited to 'services/services-onappf/src/main')
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterCommandLineArguments.java1
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java14
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java5
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/RestServerParameters.java52
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/ApexStarterRestServer.java2
-rw-r--r--services/services-onappf/src/main/resources/config/OnapPfConfig.json12
-rw-r--r--services/services-onappf/src/main/resources/config/topic.properties23
7 files changed, 18 insertions, 91 deletions
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterCommandLineArguments.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterCommandLineArguments.java
index 369737440..6f57859b9 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterCommandLineArguments.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterCommandLineArguments.java
@@ -163,7 +163,6 @@ public class ApexStarterCommandLineArguments {
*/
public void validate() throws ApexStarterException {
validateReadableFile("apex starter configuration", configurationFilePath);
- validateReadableFile("apex starter properties", propertyFilePath);
}
/**
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java
index e5986bd3d..15d9a8395 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterMain.java
@@ -20,13 +20,12 @@
package org.onap.policy.apex.services.onappf;
-import java.io.FileInputStream;
import java.util.Arrays;
import java.util.Properties;
-
import org.onap.policy.apex.services.onappf.exception.ApexStarterException;
import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterGroup;
import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterHandler;
+import org.onap.policy.common.endpoints.utils.ParameterUtils;
import org.onap.policy.common.utils.services.Registry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,16 +77,7 @@ public class ApexStarterMain {
}
// Read the properties
- final Properties topicProperties = new Properties();
- try {
- final String propFile = arguments.getFullPropertyFilePath();
- try (FileInputStream stream = new FileInputStream(propFile)) {
- topicProperties.load(stream);
- }
- } catch (final Exception e) {
- LOGGER.error(APEX_STARTER_FAIL_MSG, e);
- return;
- }
+ Properties topicProperties = ParameterUtils.getTopicProperties(parameterGroup.getTopicParameterGroup());
// create the activator
activator = new ApexStarterActivator(parameterGroup, topicProperties);
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java
index db51803be..1d1b2473e 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java
@@ -21,7 +21,8 @@
package org.onap.policy.apex.services.onappf.parameters;
import lombok.Getter;
-
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
@@ -37,7 +38,7 @@ import org.onap.policy.common.parameters.annotations.NotNull;
public class ApexStarterParameterGroup extends ParameterGroupImpl {
private RestServerParameters restServerParameters;
private PdpStatusParameters pdpStatusParameters;
-
+ private TopicParameterGroup topicParameterGroup;
/**
* Create the apex starter parameter group.
*
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/RestServerParameters.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/RestServerParameters.java
deleted file mode 100644
index fafca0c9e..000000000
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/RestServerParameters.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.apex.services.onappf.parameters;
-
-import lombok.Getter;
-
-import org.onap.policy.common.parameters.ParameterGroupImpl;
-import org.onap.policy.common.parameters.annotations.Min;
-import org.onap.policy.common.parameters.annotations.NotBlank;
-import org.onap.policy.common.parameters.annotations.NotNull;
-
-/**
- * Class to hold all parameters needed for services-onappf rest server.
- *
- * @author Ajith Sreekumar (ajith.sreekumar@est.tech)
- */
-@NotNull
-@NotBlank
-@Getter
-public class RestServerParameters extends ParameterGroupImpl {
- private String host;
-
- @Min(value = 1)
- private int port;
-
- private String userName;
- private String password;
- private boolean https;
- private boolean aaf;
-
- public RestServerParameters() {
- super("RestServerParameters");
- }
-}
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/ApexStarterRestServer.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/ApexStarterRestServer.java
index 3f2ca7224..ba5585b85 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/ApexStarterRestServer.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/ApexStarterRestServer.java
@@ -24,9 +24,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import org.onap.policy.apex.services.onappf.parameters.RestServerParameters;
import org.onap.policy.common.capabilities.Startable;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
import org.onap.policy.common.gson.GsonMessageBodyHandler;
import org.slf4j.Logger;
diff --git a/services/services-onappf/src/main/resources/config/OnapPfConfig.json b/services/services-onappf/src/main/resources/config/OnapPfConfig.json
index 22e544abe..95e28a325 100644
--- a/services/services-onappf/src/main/resources/config/OnapPfConfig.json
+++ b/services/services-onappf/src/main/resources/config/OnapPfConfig.json
@@ -12,5 +12,17 @@
"pdpType":"apex",
"description":"Pdp Heartbeat",
"supportedPolicyTypes":[{"name":"onap.policies.controlloop.operational.Apex","version":"1.0.0"}]
+ },
+ "topicParameterGroup": {
+ "topicSources" : [{
+ "topic" : "POLICY-PDP-PAP",
+ "servers" : [ "message-router" ],
+ "topicCommInfrastructure" : "dmaap"
+ }],
+ "topicSinks" : [{
+ "topic" : "POLICY-PDP-PAP",
+ "servers" : [ "message-router" ],
+ "topicCommInfrastructure" : "dmaap"
+ }]
}
} \ No newline at end of file
diff --git a/services/services-onappf/src/main/resources/config/topic.properties b/services/services-onappf/src/main/resources/config/topic.properties
deleted file mode 100644
index b61626b2d..000000000
--- a/services/services-onappf/src/main/resources/config/topic.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-# ============LICENSE_START=======================================================
-# Copyright (C) 2019 Nordix Foundation.
-# ================================================================================
-# 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.
-#
-# SPDX-License-Identifier: Apache-2.0
-# ============LICENSE_END=========================================================
-
-dmaap.source.topics=POLICY-PDP-PAP
-dmaap.sink.topics=POLICY-PDP-PAP
-
-dmaap.source.topics.POLICY-PDP-PAP.servers= message-router
-dmaap.sink.topics.POLICY-PDP-PAP.servers= message-router \ No newline at end of file