From 037e421b700ba836e053fdc58101104a0b6ccb0e Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Fri, 28 Jun 2019 11:36:58 +0000 Subject: Remove topic.properties and incorporate into overall properties 1) The properties in the topic.properties file is moved into overall config json file and the topic.properties file is removed. 2) Common parameters such as RestServer and Topic related parameters from policy-common is used. Change-Id: Ifc25185c8f717c95a226b2db25c1a8e96b9bbff9 Issue-ID: POLICY-1744 Signed-off-by: a.sreekumar --- .../onappf/ApexStarterCommandLineArguments.java | 1 - .../apex/services/onappf/ApexStarterMain.java | 14 +----- .../parameters/ApexStarterParameterGroup.java | 5 ++- .../onappf/parameters/RestServerParameters.java | 52 ---------------------- .../onappf/rest/ApexStarterRestServer.java | 2 +- 5 files changed, 6 insertions(+), 68 deletions(-) delete mode 100644 services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/RestServerParameters.java (limited to 'services/services-onappf/src/main/java') 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 4813eb356..dcd797249 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; -- cgit 1.2.3-korg