* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.onap.policy.xacml.pdp.application.monitoring;
import com.att.research.xacml.api.Response;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslator;
import org.onap.policy.pdp.xacml.application.common.std.StdCombinedPolicyResultsTranslator;
import org.onap.policy.pdp.xacml.application.common.std.StdXacmlApplicationServiceProvider;
public static final String VERSION_100 = "1.0.0";
- private StdCombinedPolicyResultsTranslator translator = new StdCombinedPolicyResultsTranslator();
- private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>();
+ private final StdCombinedPolicyResultsTranslator translator = new StdCombinedPolicyResultsTranslator();
/**
* Constructor.
*/
public MonitoringPdpApplication() {
+ super();
+
+ applicationName = "monitoring";
+ actions = List.of("configure");
//
- // By default this supports just Monitoring policy types
+ // By default, this supports just Monitoring policy types
//
- supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(ONAP_MONITORING_BASE_POLICY_TYPE, VERSION_100));
- }
-
- @Override
- public String applicationName() {
- return "monitoring";
- }
-
- @Override
- public List<String> actionDecisionsSupported() {
- return Arrays.asList("configure");
- }
-
- @Override
- public synchronized List<ToscaPolicyTypeIdentifier> supportedPolicyTypes() {
- return supportedPolicyTypes;
+ supportedPolicyTypes.add(new ToscaConceptIdentifier(ONAP_MONITORING_BASE_POLICY_TYPE, VERSION_100));
}
@Override
- public boolean canSupportPolicyType(ToscaPolicyTypeIdentifier policyTypeId) {
+ public boolean canSupportPolicyType(ToscaConceptIdentifier policyTypeId) {
//
// For Monitoring, we will attempt to support all versions
// of the policy type. Since we are only packaging a decision
// Make the decision
//
Pair<DecisionResponse, Response> decisionPair = super.makeDecision(request, requestQueryParams);
- DecisionResponse decisionResponse = decisionPair.getKey();
+ var decisionResponse = decisionPair.getKey();
//
// Abbreviate results if needed
//
*
* @param queryParams - http request query parameters
*/
- private boolean checkAbbreviateResults(Map<String, String[]> queryParams) {
+ protected boolean checkAbbreviateResults(Map<String, String[]> queryParams) {
if (queryParams != null && !queryParams.isEmpty()) {
// Check if query params contains "abbrev" flag
if (queryParams.containsKey("abbrev")) {