summaryrefslogtreecommitdiffstats
path: root/applications/common/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-03-17 15:10:17 -0400
committerJim Hahn <jrh3@att.com>2021-03-17 16:30:13 -0400
commit3e9fe84af892cd75c564da90481800a4131fc009 (patch)
tree8b54a93f852b43be17e43e909bd0ae8822a7a861 /applications/common/src/main
parent2cb02e53d2eb0374b13b92e87afaf86b0b4c7383 (diff)
Change RestServerParameters to BusTopicParams
HTTP client parameters should be based on BusTopicParams instead of RestServerParameters, modified the policyApiParameters. Issue-ID: POLICY-3147 Change-Id: I73aa34bec3ab7e27e7a3474260f411ed55b6f933 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'applications/common/src/main')
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCaller.java21
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlApplicationServiceProvider.java6
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java7
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java8
4 files changed, 16 insertions, 26 deletions
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCaller.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCaller.java
index 7d360da2..52ecd84b 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCaller.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/PolicyApiCaller.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * 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 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,7 +27,6 @@ import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.endpoints.http.client.HttpClient;
import org.onap.policy.common.endpoints.http.client.HttpClientConfigException;
import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
@@ -50,20 +49,12 @@ public class PolicyApiCaller {
* @param params target specification
* @throws PolicyApiException if an error occurs
*/
- public PolicyApiCaller(RestServerParameters params) throws PolicyApiException {
- BusTopicParams busParams = new BusTopicParams();
- busParams.setClientName("policy-api");
- busParams.setHostname(params.getHost());
- busParams.setManaged(false);
- busParams.setPassword(params.getPassword());
- busParams.setPort(params.getPort());
- busParams.setUseHttps(params.isHttps());
- busParams.setUserName(params.getUserName());
-
+ public PolicyApiCaller(BusTopicParams params) throws PolicyApiException {
try {
- httpClient = makeClient(busParams);
+ params.setClientName("policy-api");
+ httpClient = makeClient(params);
} catch (HttpClientConfigException e) {
- throw new PolicyApiException("connection to host: " + busParams.getHostname(), e);
+ throw new PolicyApiException("connection to host: " + params.getHostname(), e);
}
}
@@ -92,7 +83,7 @@ public class PolicyApiCaller {
}
} catch (RuntimeException e) {
- logger.warn("policy-api connection error");
+ logger.warn("policy-api connection error, client info: {} ", httpClient);
throw new PolicyApiException(type.toString(), e);
}
}
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlApplicationServiceProvider.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlApplicationServiceProvider.java
index d80572a2..7512fb76 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlApplicationServiceProvider.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/XacmlApplicationServiceProvider.java
@@ -1,7 +1,7 @@
/* ============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");
@@ -27,7 +27,7 @@ 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.parameters.RestServerParameters;
+import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -66,7 +66,7 @@ public interface XacmlApplicationServiceProvider {
* @param pathForData Local Path
* @param policyApiParameters API rest parameters
*/
- void initialize(Path pathForData, RestServerParameters policyApiParameters)
+ void initialize(Path pathForData, BusTopicParams policyApiParameters)
throws XacmlApplicationException;
/**
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
index 329a21ca..3222f4ad 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
@@ -2,7 +2,7 @@
* ============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 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -51,7 +51,7 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.RuleType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.TargetType;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.coder.StandardYamlCoder;
@@ -92,7 +92,7 @@ public class StdMatchableTranslator extends StdBaseTranslator implements Matcha
private final Map<ToscaConceptIdentifier, MatchablePolicyType> matchableCache = new HashMap<>();
@Setter
- private RestServerParameters apiRestParameters;
+ private BusTopicParams apiRestParameters;
@Setter
private Path pathForData;
@@ -579,7 +579,6 @@ public class StdMatchableTranslator extends StdBaseTranslator implements Matcha
policyTemplate = api.getPolicyType(policyTypeId);
} catch (PolicyApiException e) {
LOGGER.error("Failed to make API call", e);
- LOGGER.error("parameters: {} ", this.apiRestParameters);
return null;
}
LOGGER.info("Successfully pulled {}", policyTypeId);
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java
index fcfbf535..5e00499e 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdXacmlApplicationServiceProvider.java
@@ -2,7 +2,7 @@
* ============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 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,7 +41,7 @@ import java.util.Map;
import java.util.Properties;
import lombok.Getter;
import org.apache.commons.lang3.tuple.Pair;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
+import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -64,7 +64,7 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica
private Path pathForData = null;
@Getter
- private RestServerParameters policyApiParameters;
+ private BusTopicParams policyApiParameters;
private Properties pdpProperties = null;
private PDPEngine pdpEngine = null;
private Map<ToscaPolicy, Path> mapLoadedPolicies = new HashMap<>();
@@ -84,7 +84,7 @@ public abstract class StdXacmlApplicationServiceProvider implements XacmlApplica
}
@Override
- public void initialize(Path pathForData, RestServerParameters policyApiParameters)
+ public void initialize(Path pathForData, BusTopicParams policyApiParameters)
throws XacmlApplicationException {
//
// Save our path