/* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2021 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.pdp.xacml.application.common;
+import com.att.research.xacml.api.Response;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
-
+import org.apache.commons.lang3.tuple.Pair;
+import org.onap.policy.common.endpoints.http.client.HttpClient;
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.models.tosca.authorative.concepts.ToscaPolicy;
/**
* This interface is how the XACML REST controller can communicate
/**
* Initializes the application and gives it a Path for storing its
* data. The Path may be already populated with previous data.
+ * Also gives api rest parameters if needed.
*
* @param pathForData Local Path
+ * @param policyApiClient API rest client
*/
- void initialize(Path pathForData) throws XacmlApplicationException;
+ void initialize(Path pathForData, HttpClient policyApiClient)
+ throws XacmlApplicationException;
/**
* Returns a list of supported Tosca Policy Types.
*
* @return List of Strings (eg. "onap.policy.foo.bar")
*/
- List<ToscaPolicyTypeIdentifier> supportedPolicyTypes();
+ List<ToscaConceptIdentifier> supportedPolicyTypes();
/**
* Asks whether the application can support the incoming
* @param toscaPolicyId Identifier for policy type
* @return true if supported
*/
- boolean canSupportPolicyType(ToscaPolicyTypeIdentifier toscaPolicyId);
+ boolean canSupportPolicyType(ToscaConceptIdentifier toscaPolicyId);
+
+ /**
+ * Load a Tosca Policy.
+ *
+ * @param toscaPolicy object
+ */
+ void loadPolicy(ToscaPolicy toscaPolicy) throws XacmlApplicationException;
/**
- * Load a Map representation of a Tosca Policy.
+ * unloadPolicy a Tosca Policy.
*
- * @param toscaPolicies Map of Tosca Policy Objects
+ * @param toscaPolicy object
*/
- void loadPolicies(Map<String, Object> toscaPolicies) throws XacmlApplicationException;
+ boolean unloadPolicy(ToscaPolicy toscaPolicy) throws XacmlApplicationException;
/**
* Makes a decision given the incoming request and returns a response.
*
* @param request Incoming DecisionRequest object
+ * @param requestQueryParameters Http request query parameters
* @return response Responding DecisionResponse object
*/
- DecisionResponse makeDecision(DecisionRequest request);
+ Pair<DecisionResponse, Response> makeDecision(DecisionRequest request,
+ Map<String, String[]> requestQueryParameters);
}