aboutsummaryrefslogtreecommitdiffstats
path: root/rest-services/cbs-client/src/main
diff options
context:
space:
mode:
authorPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2019-03-20 11:40:27 +0100
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2019-03-22 12:19:23 +0100
commite1e919792e77cd504e41bb21f93b3a50ef894541 (patch)
treeb6e6af8dac76710f2b93d5b8a8f0b14aa63ecafd /rest-services/cbs-client/src/main
parent9b5df83176a2e2bf20442285b01ba4cd710fb7b8 (diff)
Add JavaDoc to CBS streams API
Change-Id: Ia702750e0ec6bf54418eafb00523681429d86b22 Issue-ID: DCAEGEN2-1341 Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
Diffstat (limited to 'rest-services/cbs-client/src/main')
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/StreamParsingException.java4
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/DataStreams.java100
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParser.java2
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParsers.java32
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/DataStreamUtils.java5
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/GsonUtils.java3
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/AafCredentials.java4
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStream.java4
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStreamDirection.java9
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/RawDataStream.java5
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SinkStream.java5
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SourceStream.java5
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouter.java20
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSink.java12
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSource.java11
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/Kafka.java24
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSink.java1
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSource.java5
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouter.java19
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSink.java3
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSource.java3
21 files changed, 248 insertions, 28 deletions
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/StreamParsingException.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/StreamParsingException.java
index aa8c2ed7..ca531e82 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/StreamParsingException.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/StreamParsingException.java
@@ -36,6 +36,10 @@ public class StreamParsingException extends CbsClientException {
this.cause = cause;
}
+ public StreamParsingException(String message) {
+ this(new StreamParserError(message));
+ }
+
public StreamParserError cause() {
return cause;
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/DataStreams.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/DataStreams.java
index 4fdb31b1..648b7a61 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/DataStreams.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/DataStreams.java
@@ -29,6 +29,38 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.Dat
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.RawDataStream;
/**
+ * Extract streams from the application configuration represented as GSON JsonObject.
+ *
+ * Example input:
+ * <pre>
+ * {
+ * "application_config_1": "value_1,
+ * ...
+ * "streams_publishes": {
+ * "stream1": {
+ * "type": "message_router",
+ * "dmaap_info": {
+ * ...
+ * }
+ * },
+ * "stream2": {
+ * "type": "data_router",
+ * "dmaap_info": {
+ * ...
+ * }
+ * }
+ * },
+ * "streams_subscribes": {
+ * "stream3": {
+ * "type": "message_router",
+ * "dmaap_info": {
+ * ...
+ * }
+ * },
+ * }
+ * }
+ * </pre>
+ *
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
* @since 1.1.4
*/
@@ -38,10 +70,78 @@ public final class DataStreams {
private DataStreams() {
}
+ /**
+ * <p>
+ * Extracts sources from application configuration. Parses <em>streams_subscribes</em> subtree.
+ * </p>
+ *
+ * <p>
+ * For sample input it will yield:
+ * </p>
+ *
+ * <pre>
+ * [
+ * RawDataStream{
+ * name="stream3"
+ * type="message_router"
+ * direction=SOURCE
+ * descriptor=JsonObject{
+ * type: "message_router",
+ * dmaap_info: {
+ * ...
+ * }
+ * }
+ * }
+ * ]
+ * </pre>
+ *
+ * @param rootJson - the full application configuration
+ * @return io.vavr.collection.Stream of data streams
+ */
public static Stream<RawDataStream<JsonObject>> namedSources(JsonObject rootJson) {
return createCollectionOfStreams(rootJson, DataStreamDirection.SOURCE);
}
+
+ /**
+ * <p>
+ * Extracts sinks from application configuration. Parses <em>streams_publishes</em> subtree.
+ * </p>
+ *
+ * <p>
+ * For sample input it will yield:
+ * </p>
+ *
+ * <pre>
+ * [
+ * RawDataStream{
+ * name="stream1"
+ * type="message_router"
+ * direction=SINK
+ * descriptor=JsonObject{
+ * type: "message_router",
+ * dmaap_info: {
+ * ...
+ * }
+ * }
+ * },
+ * RawDataStream{
+ * name="stream2"
+ * type="data_router"
+ * direction=SINK
+ * descriptor=JsonObject{
+ * type: "data_router"
+ * dmaap_info: {
+ * ...
+ * }
+ * }
+ * }
+ * ]
+ * </pre>
+ *
+ * @param rootJson - the full application configuration
+ * @return io.vavr.collection.Stream of data streams
+ */
public static Stream<RawDataStream<JsonObject>> namedSinks(JsonObject rootJson) {
return createCollectionOfStreams(rootJson, DataStreamDirection.SINK);
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParser.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParser.java
index 460d7100..a8ce3644 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParser.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParser.java
@@ -25,6 +25,8 @@ import org.onap.dcaegen2.services.sdk.rest.services.annotations.ExperimentalApi;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.DataStream;
/**
+ * Represents parser taking GSON JsonObject as an input
+ *
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
* @since 1.1.4
*/
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParsers.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParsers.java
index 7ae92baf..7476e976 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParsers.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/streams/StreamFromGsonParsers.java
@@ -29,6 +29,8 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl.streams.gson
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap.*;
/**
+ * Factory methods for GSON-based {@code StreamParser}s
+ *
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
* @since 1.1.4
*/
@@ -37,26 +39,56 @@ public final class StreamFromGsonParsers {
private StreamFromGsonParsers() {
}
+ /**
+ * Creates a stream parser capable of parsing Kafka sinks.
+ *
+ * @return a stream parser
+ */
public static StreamFromGsonParser<KafkaSink> kafkaSinkParser() {
return KafkaSinkParser.create();
}
+ /**
+ * Creates a stream parser capable of parsing Kafka sources.
+ *
+ * @return a stream parser
+ */
public static StreamFromGsonParser<KafkaSource> kafkaSourceParser() {
return KafkaSourceParser.create();
}
+ /**
+ * Creates a stream parser capable of parsing DMaaP Message Router sinks.
+ *
+ * @return a stream parser
+ */
public static StreamFromGsonParser<MessageRouterSink> messageRouterSinkParser() {
return MessageRouterSinkParser.create();
}
+ /**
+ * Creates a stream parser capable of parsing DMaaP Message Router sources.
+ *
+ * @return a stream parser
+ */
public static StreamFromGsonParser<MessageRouterSource> messageRouterSourceParser() {
return MessageRouterSourceParser.create();
}
+ /**
+ * Creates a stream parser capable of parsing DMaaP Data Router sinks.
+ *
+ * @return a stream parser
+ */
public static StreamFromGsonParser<DataRouterSink> dataRouterSinkParser() {
return DataRouterSinkParser.create();
}
+ /**
+ * Creates a stream parser capable of parsing DMaaP Data Router sources.
+ *
+ * @return a stream parser
+ */
public static StreamFromGsonParser<DataRouterSource> dataRouterSourceParser() {
return DataRouterSourceParser.create();
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/DataStreamUtils.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/DataStreamUtils.java
index d34b1440..1148574e 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/DataStreamUtils.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/DataStreamUtils.java
@@ -24,6 +24,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import io.vavr.collection.Stream;
import java.io.IOException;
+import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.exceptions.StreamParsingException;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.DataStreamDirection;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.ImmutableRawDataStream;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.RawDataStream;
@@ -48,11 +49,11 @@ public final class DataStreamUtils {
String expectedType,
DataStreamDirection expectedDirection) {
if (!json.type().equals(expectedType)) {
- throw new IllegalArgumentException(
+ throw new StreamParsingException(
"Invalid stream type. Expected '" + expectedType + "', but was '" + json.type() + "'");
}
if (json.direction() != expectedDirection) {
- throw new IllegalArgumentException(
+ throw new StreamParsingException(
"Invalid stream direction. Expected '" + expectedDirection + "', but was '" + json.direction()
+ "'");
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/GsonUtils.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/GsonUtils.java
index 0b662286..0fdec5d8 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/GsonUtils.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/streams/gson/GsonUtils.java
@@ -32,6 +32,7 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Map.Entry;
import java.util.stream.Collectors;
+import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.exceptions.StreamParsingException;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl.streams.gson.dmaap.mr.GsonAdaptersMessageRouterDmaapInfo;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl.streams.gson.kafka.GsonAdaptersKafkaInfo;
import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.GsonAdaptersAafCredentials;
@@ -71,7 +72,7 @@ public final class GsonUtils {
public static JsonElement requiredChild(JsonObject parent, String childName) {
return optionalChild(parent, childName)
- .getOrElseThrow(() -> new IllegalArgumentException(
+ .getOrElseThrow(() -> new StreamParsingException(
"Could not find sub-node '" + childName + "'. Actual sub-nodes: "
+ stringifyChildrenNames(parent)));
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/AafCredentials.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/AafCredentials.java
index c3c70b78..9fa83bcb 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/AafCredentials.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/AafCredentials.java
@@ -28,8 +28,10 @@ import org.jetbrains.annotations.Nullable;
import org.onap.dcaegen2.services.sdk.rest.services.annotations.ExperimentalApi;
/**
+ * Represents the AAF Credentials. Currently it contains only user name and password.
+ *
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@ExperimentalApi
@Value.Immutable
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStream.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStream.java
index 37bf7e57..1950a304 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStream.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStream.java
@@ -24,8 +24,10 @@ import org.immutables.value.Value;
import org.onap.dcaegen2.services.sdk.rest.services.annotations.ExperimentalApi;
/**
+ * Represents a named data stream.
+ *
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@ExperimentalApi
public interface DataStream {
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStreamDirection.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStreamDirection.java
index f3cac547..3d05c9a9 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStreamDirection.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/DataStreamDirection.java
@@ -21,8 +21,10 @@
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams;
/**
+ * The direction of the stream, ie. whether it's input ({@code SOURCE}) or output ({@code SINK}) stream.
+ *
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @since March 2019
+ * @since 1.1.4
*/
public enum DataStreamDirection {
@@ -35,6 +37,11 @@ public enum DataStreamDirection {
this.configurationKey = configurationKey;
}
+ /**
+ * The configuration key under which the single stream definitions should reside.
+ *
+ * @return the configuration key
+ */
public String configurationKey() {
return configurationKey;
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/RawDataStream.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/RawDataStream.java
index 7a39ede5..d6bc8000 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/RawDataStream.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/RawDataStream.java
@@ -23,8 +23,11 @@ package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams;
import org.immutables.value.Value;
/**
+ * Represents a raw/uninterpreted data stream.
+ *
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @since March 2019
+ * @since 1.1.4
+ * @param <T> type of raw data, eg. JsonObject
*/
@Value.Immutable
public interface RawDataStream<T> {
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SinkStream.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SinkStream.java
index e3389207..7002fd68 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SinkStream.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SinkStream.java
@@ -23,10 +23,11 @@ package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams;
import org.onap.dcaegen2.services.sdk.rest.services.annotations.ExperimentalApi;
/**
- * AKA PublishStream
+ * Represents an output stream, ie. one of objects in <em>streams_publishes</em> array from application configuration.
+ * Application can put data to this stream.
*
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@ExperimentalApi
public interface SinkStream extends DataStream {
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SourceStream.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SourceStream.java
index 2bea143b..c5ab8a34 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SourceStream.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/SourceStream.java
@@ -23,10 +23,11 @@ package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams;
import org.onap.dcaegen2.services.sdk.rest.services.annotations.ExperimentalApi;
/**
- * AKA SubscribeStream
+ * Represents an input stream, ie. one of objects in <em>streams_subscribes</em> array from application configuration.
+ * Application can read data from this stream.
*
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@ExperimentalApi
public interface SourceStream extends DataStream {
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouter.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouter.java
index b4b5549e..072d4b0b 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouter.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouter.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
@@ -27,17 +26,34 @@ import org.onap.dcaegen2.services.sdk.rest.services.annotations.ExperimentalApi;
/**
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@ExperimentalApi
public interface DataRouter {
+ /**
+ * DCAE location for the publisher, used to set up routing.
+ */
@SerializedName("location")
@Nullable String location();
+ /**
+ * Username
+ * <ul>
+ * <li>Data Router uses to authenticate to the subscriber when delivering files OR</li>
+ * <li>the publisher uses to authenticate to Data Router.</li>
+ * </ul>
+ */
@SerializedName("username")
@Nullable String username();
+ /**
+ * Password
+ * <ul>
+ * <li>Data Router uses to authenticate to the subscriber when delivering files OR</li>
+ * <li>the publisher uses to authenticate to Data Router.</li>
+ * </ul>
+ */
@SerializedName("password")
@Nullable String password();
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSink.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSink.java
index 60d91009..baddb91e 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSink.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSink.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
@@ -30,19 +29,28 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.Sin
/**
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@Gson.TypeAdapters
@ExperimentalApi
@Value.Immutable
public interface DataRouterSink extends DataRouter, SinkStream {
+ /**
+ * URL to which the publisher makes Data Router publish requests.
+ */
@SerializedName("publish_url")
String publishUrl();
+ /**
+ * Publisher id in Data Router
+ */
@SerializedName("publisher_id")
@Nullable String publisherId();
+ /**
+ * URL from which log data for the feed can be obtained.
+ */
@SerializedName("log_url")
@Nullable String logUrl();
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSource.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSource.java
index b6dedb7a..d089a403 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSource.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/DataRouterSource.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
@@ -30,17 +29,23 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.Sou
/**
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@Gson.TypeAdapters
@ExperimentalApi
@Value.Immutable
public interface DataRouterSource extends DataRouter, SourceStream {
- // in future, since crucial need to be verified if could be nullable
+ /**
+ * URL to which the Data Router should deliver files.
+ */
+ // TODO: since crucial, we need to verify if it should be non-null
@SerializedName("delivery_url")
@Nullable String deliveryUrl();
+ /**
+ * Subscriber id in Data Router.
+ */
@SerializedName("subscriber_id")
@Nullable String subscriberId();
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/Kafka.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/Kafka.java
index 1810fc6c..42558cbf 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/Kafka.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/Kafka.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
import static io.vavr.Predicates.not;
@@ -35,21 +34,44 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.Aaf
@ExperimentalApi
public interface Kafka {
+ /**
+ * Kafka bootstrap servers as defined in Kafka client documentation under <em>bootstrap.servers</em> configuration
+ * key.
+ */
String bootstrapServers();
+ /**
+ * The name of the topic where application should publish or subscribe for the messages.
+ */
String topicName();
+ /**
+ * The credentials to use when authenticating to Kafka cluster or null when connection should be unauthenticated.
+ */
@Nullable AafCredentials aafCredentials();
+ /**
+ * AAF client role that’s requesting publish or subscribe access to the topic.
+ */
@Nullable String clientRole();
+ /**
+ * Client id for given AAF client.
+ */
@Nullable String clientId();
+ /**
+ * The limit on the size of message published to/subscribed from the topic. Can be used to set Kafka client
+ * <em>max.request.size</em> configuration property.
+ */
@Value.Default
default int maxPayloadSizeBytes() {
return 1024 * 1024;
}
+ /**
+ * The {@code bootstrapServers} converted to the list of servers' addresses.
+ */
@Value.Derived
default List<String> bootstrapServerList() {
return List.of(bootstrapServers().split(",")).filter(not(String::isEmpty));
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSink.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSink.java
index 09322e4a..bd6ab1ca 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSink.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSink.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
import org.immutables.value.Value;
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSource.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSource.java
index 65280a98..78f5c3af 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSource.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/KafkaSource.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
import org.immutables.value.Value;
@@ -33,5 +32,9 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.Sou
@Value.Immutable
public interface KafkaSource extends Kafka, SourceStream {
+ /**
+ * A unique string that identifies the consumer group this consumer belongs to as defined in Kafka consumer
+ * configuration key <em>group.id</em>.
+ */
@Nullable String consumerGroupId();
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouter.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouter.java
index 7ed720d0..3cca5134 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouter.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouter.java
@@ -17,10 +17,8 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
-
import com.google.gson.annotations.SerializedName;
import org.jetbrains.annotations.Nullable;
import org.onap.dcaegen2.services.sdk.rest.services.annotations.ExperimentalApi;
@@ -28,23 +26,38 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.Aaf
/**
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@ExperimentalApi
public interface MessageRouter {
+ /**
+ * URL for accessing the topic to publish or receive events.
+ */
@SerializedName("topic_url")
String topicUrl();
+ /**
+ * AAF client role that’s requesting publish or subscribe access to the topic.
+ */
@SerializedName("client_role")
@Nullable String clientRole();
+ /**
+ * Client id for given AAF client.
+ */
@SerializedName("client_id")
@Nullable String clientId();
+ /**
+ * DCAE location for the publisher or subscriber, used to set up routing.
+ */
@SerializedName("location")
@Nullable String location();
+ /**
+ * The AAF credentials.
+ */
@SerializedName("aaf_credentials")
@Nullable AafCredentials aafCredentials();
}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSink.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSink.java
index 8f4a5339..3af79638 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSink.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSink.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
import org.immutables.value.Value;
@@ -26,7 +25,7 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.Sin
/**
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@ExperimentalApi
@Value.Immutable
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSource.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSource.java
index ab802034..c7159f26 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSource.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/streams/dmaap/MessageRouterSource.java
@@ -17,7 +17,6 @@
* limitations under the License.
* ============LICENSE_END=====================================
*/
-
package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.dmaap;
import org.immutables.value.Value;
@@ -26,7 +25,7 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.streams.Sou
/**
* @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
- * @version 1.2.1
+ * @since 1.1.4
*/
@ExperimentalApi
@Value.Immutable