aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java5
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/TopicEndpoint.java12
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/BusConsumer.java9
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedBusTopicSource.java3
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java3
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/drools/http/client/HttpClientFactory.java37
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/drools/http/client/internal/JerseyClient.java4
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java2
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java10
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java13
-rw-r--r--policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java2
11 files changed, 67 insertions, 33 deletions
diff --git a/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java b/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java
index 0e4ed792..5cbcf555 100644
--- a/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java
+++ b/feature-healthcheck/src/main/java/org/onap/policy/drools/healthcheck/HealthCheck.java
@@ -172,9 +172,11 @@ class HealthCheckMonitor implements HealthCheck {
try {
report.message = HttpClient.getBody(response, String.class);
} catch (Exception e) {
- logger.warn("{}: cannot get body from http-client {}", this, client, e);
+ logger.info("{}: cannot get body from http-client {}", this, client, e);
}
} catch (Exception e) {
+ logger.warn("{}: cannot contact http-client {}", this, client, e);
+
report.healthy = false;
reports.healthy = false;
}
@@ -202,6 +204,7 @@ class HealthCheckMonitor implements HealthCheck {
}
}
} catch (Exception e) {
+ logger.warn("{}: cannot start {}", this, e);
return false;
}
diff --git a/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/TopicEndpoint.java b/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/TopicEndpoint.java
index c1eb1e08..84cc1dee 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/TopicEndpoint.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/TopicEndpoint.java
@@ -564,7 +564,7 @@ class ProxyTopicEndpointManager implements TopicEndpoint {
if (uebSource != null)
sources.add(uebSource);
} catch (Exception e) {
- logger.info("No UEB source for topic: {}", topic);
+ logger.info("No UEB source for topic: {}", topic, e);
}
try {
@@ -572,7 +572,7 @@ class ProxyTopicEndpointManager implements TopicEndpoint {
if (dmaapSource != null)
sources.add(dmaapSource);
} catch (Exception e) {
- logger.info("No DMAAP source for topic: {}", topic);
+ logger.info("No DMAAP source for topic: {}", topic, e);
}
}
return sources;
@@ -596,7 +596,7 @@ class ProxyTopicEndpointManager implements TopicEndpoint {
if (uebSink != null)
sinks.add(uebSink);
} catch (Exception e) {
- logger.info("No UEB sink for topic: {}", topic);
+ logger.info("No UEB sink for topic: {}", topic, e);
}
try {
@@ -604,7 +604,7 @@ class ProxyTopicEndpointManager implements TopicEndpoint {
if (dmaapSink != null)
sinks.add(dmaapSink);
} catch (Exception e) {
- logger.info("No DMAAP sink for topic: {}", topic);
+ logger.info("No DMAAP sink for topic: {}", topic, e);
}
}
return sinks;
@@ -682,13 +682,13 @@ class ProxyTopicEndpointManager implements TopicEndpoint {
try {
sinks.add(this.getUebTopicSink(topicName));
} catch (Exception e) {
- ;
+ logger.debug("No sink for topic: {}", topicName, e);
}
try {
sinks.add(this.getDmaapTopicSink(topicName));
} catch (Exception e) {
- ;
+ logger.debug("No sink for topic: {}", topicName, e);
}
return sinks;
diff --git a/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/BusConsumer.java b/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/BusConsumer.java
index 0555940e..6122c5d0 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/BusConsumer.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/BusConsumer.java
@@ -20,6 +20,7 @@
package org.onap.policy.drools.event.comm.bus.internal;
+import java.io.IOException;
import java.net.MalformedURLException;
import java.security.GeneralSecurityException;
import java.util.ArrayList;
@@ -52,7 +53,7 @@ public interface BusConsumer {
* @return list of messages
* @throws Exception when error encountered by underlying libraries
*/
- public Iterable<String> fetch() throws Exception;
+ public Iterable<String> fetch() throws InterruptedException, IOException;
/**
* close underlying library consumer
@@ -136,7 +137,7 @@ public interface BusConsumer {
/**
* {@inheritDoc}
*/
- public Iterable<String> fetch() throws Exception {
+ public Iterable<String> fetch() throws IOException {
return this.consumer.fetch();
}
@@ -208,7 +209,8 @@ public interface BusConsumer {
/**
* {@inheritDoc}
*/
- public Iterable<String> fetch() throws Exception {
+ @Override
+ public Iterable<String> fetch() throws InterruptedException, IOException {
MRConsumerResponse response = this.consumer.fetchWithReturnConsumerResponse();
if (response == null) {
logger.warn("{}: DMaaP NULL response received", this);
@@ -245,6 +247,7 @@ public interface BusConsumer {
/**
* {@inheritDoc}
*/
+ @Override
public void close() {
synchronized (closeCondition) {
closeCondition.notifyAll();
diff --git a/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedBusTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedBusTopicSource.java
index c3960491..52438381 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedBusTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedBusTopicSource.java
@@ -20,6 +20,7 @@
package org.onap.policy.drools.event.comm.bus.internal;
+import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -146,7 +147,7 @@ public abstract class SingleThreadedBusTopicSource
/**
* Initialize the Bus client
*/
- public abstract void init() throws Exception;
+ public abstract void init() throws MalformedURLException;
@Override
public void register(TopicListener topicListener)
diff --git a/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java b/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
index dc70e529..6c1bc8a0 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/drools/event/comm/bus/internal/SingleThreadedDmaapTopicSource.java
@@ -20,6 +20,7 @@
package org.onap.policy.drools.event.comm.bus.internal;
+import java.net.MalformedURLException;
import java.util.List;
import java.util.Map;
@@ -146,7 +147,7 @@ public class SingleThreadedDmaapTopicSource extends SingleThreadedBusTopicSource
* Initialize the Cambria or MR Client
*/
@Override
- public void init() throws Exception {
+ public void init() throws MalformedURLException {
if (this.userName == null || this.userName.isEmpty() ||
this.password == null || this.password.isEmpty()) {
this.consumer =
diff --git a/policy-endpoints/src/main/java/org/onap/policy/drools/http/client/HttpClientFactory.java b/policy-endpoints/src/main/java/org/onap/policy/drools/http/client/HttpClientFactory.java
index c434c64f..aa0a8e6b 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/drools/http/client/HttpClientFactory.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/drools/http/client/HttpClientFactory.java
@@ -19,6 +19,8 @@
*/
package org.onap.policy.drools.http.client;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -30,26 +32,52 @@ import org.onap.policy.drools.properties.PolicyProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+/**
+ * Http Client Factory
+ */
public interface HttpClientFactory {
+ /**
+ * build and http client with the following parameters
+ */
public HttpClient build(String name, boolean https,
boolean selfSignedCerts,
String hostname, int port,
String baseUrl, String userName,
String password, boolean managed)
- throws Exception;
+ throws KeyManagementException, NoSuchAlgorithmException;
- public ArrayList<HttpClient> build(Properties properties) throws Exception;
+ /**
+ * build http client from properties
+ */
+ public ArrayList<HttpClient> build(Properties properties)
+ throws KeyManagementException, NoSuchAlgorithmException;
+ /**
+ * get http client
+ * @param name the name
+ * @return the http client
+ */
public HttpClient get(String name);
+ /**
+ * list of http clients
+ * @return http clients
+ */
public List<HttpClient> inventory();
+ /**
+ * destroy by name
+ * @param name name
+ */
public void destroy(String name);
public void destroy();
}
+/**
+ * http client factory implementation indexed by name
+ */
class IndexedHttpClientFactory implements HttpClientFactory {
/**
@@ -64,7 +92,7 @@ class IndexedHttpClientFactory implements HttpClientFactory {
String hostname, int port,
String baseUrl, String userName, String password,
boolean managed)
- throws Exception {
+ throws KeyManagementException, NoSuchAlgorithmException {
if (clients.containsKey(name))
return clients.get(name);
@@ -78,7 +106,8 @@ class IndexedHttpClientFactory implements HttpClientFactory {
}
@Override
- public synchronized ArrayList<HttpClient> build(Properties properties) throws Exception {
+ public synchronized ArrayList<HttpClient> build(Properties properties)
+ throws KeyManagementException, NoSuchAlgorithmException {
ArrayList<HttpClient> clientList = new ArrayList<HttpClient>();
String clientNames = properties.getProperty(PolicyProperties.PROPERTY_HTTP_CLIENT_SERVICES);
diff --git a/policy-endpoints/src/main/java/org/onap/policy/drools/http/client/internal/JerseyClient.java b/policy-endpoints/src/main/java/org/onap/policy/drools/http/client/internal/JerseyClient.java
index fe36740b..5dd97363 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/drools/http/client/internal/JerseyClient.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/drools/http/client/internal/JerseyClient.java
@@ -20,6 +20,8 @@
package org.onap.policy.drools.http.client.internal;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
@@ -67,7 +69,7 @@ public class JerseyClient implements HttpClient {
String hostname, int port,
String basePath, String userName,
String password)
- throws Exception {
+ throws KeyManagementException, NoSuchAlgorithmException {
super();
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java
index c4c61a8a..f531c441 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java
@@ -164,7 +164,7 @@ public interface DroolsController extends Startable, Lockable {
public void updateToVersion(String newGroupId, String newArtifactId, String newVersion,
List<TopicCoderFilterConfiguration> decoderConfigurations,
List<TopicCoderFilterConfiguration> encoderConfigurations)
- throws IllegalArgumentException, LinkageError, Exception;
+ throws IllegalArgumentException, LinkageError;
/**
* gets the classnames of facts as well as the current count
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
index c7a63a03..8b733970 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
@@ -58,12 +58,11 @@ public interface DroolsControllerFactory {
* @return the instantiated Drools Controller
* @throws IllegalArgumentException with invalid parameters
* @throws LinkageError Failure to link rules and models in Drools Libraries
- * @throws Exception Exception from Drools Libraries
*/
public DroolsController build(Properties properties,
List<? extends TopicSource> eventSources,
List<? extends TopicSink> eventSinks)
- throws IllegalArgumentException, LinkageError, Exception;
+ throws IllegalArgumentException, LinkageError;
/**
* Explicit construction of a Drools Controller
@@ -77,14 +76,13 @@ public interface DroolsControllerFactory {
* @return the instantiated Drools Controller
* @throws IllegalArgumentException with invalid parameters
* @throws LinkageError Failure to link rules and models in Drools Libraries
- * @throws Exception Exception from Drools Libraries
*/
public DroolsController build(String groupId,
String artifactId,
String version,
List<TopicCoderFilterConfiguration> decoderConfigurations,
List<TopicCoderFilterConfiguration> encoderConfigurations)
- throws IllegalArgumentException, LinkageError, Exception;
+ throws IllegalArgumentException, LinkageError;
/**
* Releases the Drools Controller from operation
@@ -177,7 +175,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory {
public DroolsController build(Properties properties,
List<? extends TopicSource> eventSources,
List<? extends TopicSink> eventSinks)
- throws IllegalArgumentException, LinkageError, Exception {
+ throws IllegalArgumentException, LinkageError {
String groupId = properties.getProperty(PolicyProperties.RULES_GROUPID);
if (groupId == null || groupId.isEmpty())
@@ -380,7 +378,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory {
String newVersion,
List<TopicCoderFilterConfiguration> decoderConfigurations,
List<TopicCoderFilterConfiguration> encoderConfigurations)
- throws IllegalArgumentException, LinkageError, Exception {
+ throws IllegalArgumentException, LinkageError {
if (newGroupId == null || newArtifactId == null || newVersion == null ||
newGroupId.isEmpty() || newArtifactId.isEmpty() || newVersion.isEmpty()) {
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
index db62f782..79743b00 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
@@ -172,7 +172,7 @@ public class MavenDroolsController implements DroolsController {
public void updateToVersion(String newGroupId, String newArtifactId, String newVersion,
List<TopicCoderFilterConfiguration> decoderConfigurations,
List<TopicCoderFilterConfiguration> encoderConfigurations)
- throws IllegalArgumentException, LinkageError, Exception {
+ throws IllegalArgumentException, LinkageError {
if (logger.isInfoEnabled())
logger.info("UPDATE-TO-VERSION: " + this + " -> {" + newGroupId + ":" + newArtifactId + ":" + newVersion + "}");
@@ -722,7 +722,7 @@ public class MavenDroolsController implements DroolsController {
List<PolicySession> sessions = this.getSessions();
for (PolicySession session : sessions) {
- if (sessionName.equals(session.getName()) || sessionName.equals(session.getName()))
+ if (sessionName.equals(session.getName()) || sessionName.equals(session.getFullName()))
return session;
}
@@ -752,8 +752,7 @@ public class MavenDroolsController implements DroolsController {
else
classNames.put(className, 1);
} catch (Exception e) {
- if (logger.isInfoEnabled())
- logger.info("Object cannot be retrieved from fact: " + fact);
+ logger.warn("Object cannot be retrieved from fact {}", fact, e);
}
}
@@ -800,8 +799,7 @@ public class MavenDroolsController implements DroolsController {
if (delete)
kieSession.delete(factHandle);
} catch (Exception e) {
- if (logger.isInfoEnabled())
- logger.info("Object cannot be retrieved from fact: " + factHandle);
+ logger.warn("Object cannot be retrieved from fact {}", factHandle, e);
}
}
@@ -846,8 +844,7 @@ public class MavenDroolsController implements DroolsController {
if (delete)
kieSession.delete(row.getFactHandle(queriedEntity));
} catch (Exception e) {
- if (logger.isInfoEnabled())
- logger.info("Object cannot be retrieved from fact: " + row);
+ logger.warn("Object cannot be retrieved from row: {}", row, e);
}
}
diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java
index 3fef6fa9..c4db6c7e 100644
--- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java
+++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java
@@ -221,7 +221,7 @@ public class NullDroolsController implements DroolsController {
public void updateToVersion(String newGroupId, String newArtifactId, String newVersion,
List<TopicCoderFilterConfiguration> decoderConfigurations,
List<TopicCoderFilterConfiguration> encoderConfigurations)
- throws IllegalArgumentException, LinkageError, Exception {
+ throws IllegalArgumentException, LinkageError {
throw new IllegalArgumentException(this.getClass().getCanonicalName() + " invoked");
}