summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src
diff options
context:
space:
mode:
Diffstat (limited to 'policy-endpoints/src')
-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
6 files changed, 52 insertions, 16 deletions
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();