diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-05-10 17:28:52 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-05-10 17:28:52 +0200 |
commit | a2951db5a477ff02774bfabe1cead78ef9d013fe (patch) | |
tree | 39d6ebc6abfab833951ab5240b0c50e54da2125b /vespa-feed-client | |
parent | 22b4ff81bd1cb4ce254fcf0150088e628d281688 (diff) |
Add Maven module for new feed client
Diffstat (limited to 'vespa-feed-client')
11 files changed, 197 insertions, 0 deletions
diff --git a/vespa-feed-client/CMakeLists.txt b/vespa-feed-client/CMakeLists.txt new file mode 100644 index 00000000000..ee6dfdeff05 --- /dev/null +++ b/vespa-feed-client/CMakeLists.txt @@ -0,0 +1,2 @@ +# Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +# TODO Install fat jar
\ No newline at end of file diff --git a/vespa-feed-client/OWNERS b/vespa-feed-client/OWNERS new file mode 100644 index 00000000000..606d074d8a8 --- /dev/null +++ b/vespa-feed-client/OWNERS @@ -0,0 +1,2 @@ +bjorncs +jonmv diff --git a/vespa-feed-client/README.md b/vespa-feed-client/README.md new file mode 100644 index 00000000000..cef0815da66 --- /dev/null +++ b/vespa-feed-client/README.md @@ -0,0 +1,2 @@ +# vespa-feed-client +Java client library for feeding over HTTP/2 at `/document/v1/` diff --git a/vespa-feed-client/pom.xml b/vespa-feed-client/pom.xml new file mode 100644 index 00000000000..32b44012107 --- /dev/null +++ b/vespa-feed-client/pom.xml @@ -0,0 +1,75 @@ +<?xml version="1.0"?> +<!-- Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>com.yahoo.vespa</groupId> + <artifactId>parent</artifactId> + <version>7-SNAPSHOT</version> + <relativePath>../parent/pom.xml</relativePath> + </parent> + <artifactId>vespa-feed-client</artifactId> + <packaging>jar</packaging> + <version>7-SNAPSHOT</version> + + <properties> + <!-- Used by internal properties that are still using JDK8--> + <maven.compiler.release>8</maven.compiler.release> + </properties> + + <dependencies> + <!-- provided --> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.bouncycastle</groupId> + <artifactId>bcpkix-jdk15on</artifactId> + <scope>provided</scope> + </dependency> + + <!-- compile scope --> + <dependency> + <groupId>org.apache.httpcomponents.client5</groupId> + <artifactId>httpclient5</artifactId> + <scope>compile</scope> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- test scope --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <jdkToolchain> + <version>${java.version}</version> + </jdkToolchain> + <source>${java.version}</source> + <target>${java.version}</target> + <showDeprecation>true</showDeprecation> + <compilerArgs> + <arg>-Xlint:all</arg> + <arg>-Xlint:-serial</arg> + <arg>-Werror</arg> + </compilerArgs> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClient.java b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClient.java new file mode 100644 index 00000000000..af652401044 --- /dev/null +++ b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClient.java @@ -0,0 +1,18 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.feed.client; + +import java.util.concurrent.Future; + +/** + * @author bjorncs + */ +public interface FeedClient { + Future<Result> put(String documentId, String documentJson, OperationParameters params, ResultCallback callback); + Future<Result> remove(String documentId, OperationParameters params, ResultCallback callback); + Future<Result> update(String documentId, String documentJson, OperationParameters params, ResultCallback callback); + + interface ResultCallback { + void completed(Result result); + void failed(FeedException e); + } +} diff --git a/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClientBuilder.java b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClientBuilder.java new file mode 100644 index 00000000000..338c97b04ad --- /dev/null +++ b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClientBuilder.java @@ -0,0 +1,14 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.feed.client; + +/** + * @author bjorncs + */ +public class FeedClientBuilder { + + public static FeedClientBuilder create() { return new FeedClientBuilder(); } + + private FeedClientBuilder() {} + + public FeedClient build() { return new FeedClientImpl(this); } +} diff --git a/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClientImpl.java b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClientImpl.java new file mode 100644 index 00000000000..bfe845aee66 --- /dev/null +++ b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedClientImpl.java @@ -0,0 +1,29 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.feed.client; + +import java.util.concurrent.Future; + +/** + * @author bjorncs + */ +class FeedClientImpl implements FeedClient { + + FeedClientImpl(FeedClientBuilder builder) { + + } + + @Override + public Future<Result> put(String documentId, String documentJson, OperationParameters params, ResultCallback callback) { + return null; + } + + @Override + public Future<Result> remove(String documentId, OperationParameters params, ResultCallback callback) { + return null; + } + + @Override + public Future<Result> update(String documentId, String documentJson, OperationParameters params, ResultCallback callback) { + return null; + } +} diff --git a/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedException.java b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedException.java new file mode 100644 index 00000000000..d3de5e0cbe1 --- /dev/null +++ b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/FeedException.java @@ -0,0 +1,8 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.feed.client; + +/** + * @author bjorncs + */ +public class FeedException extends RuntimeException { +} diff --git a/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/OperationParameters.java b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/OperationParameters.java new file mode 100644 index 00000000000..4b323ed5a68 --- /dev/null +++ b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/OperationParameters.java @@ -0,0 +1,28 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.feed.client; + +import java.time.Duration; +import java.util.Optional; + +/** + * @author bjorncs + */ +public class OperationParameters { + + public static Builder builder() { return new Builder(); } + + private OperationParameters(Builder builder) { + + } + + public Optional<String> documentCondition() { return Optional.empty(); } + public Optional<Duration> operationTimeout() { return Optional.empty(); } + + public static class Builder { + + private Builder() {} + + public OperationParameters build() { return new OperationParameters(this); } + + } +} diff --git a/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/Result.java b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/Result.java new file mode 100644 index 00000000000..3a3f695ca2b --- /dev/null +++ b/vespa-feed-client/src/main/java/com/yahoo/vespa/feed/client/Result.java @@ -0,0 +1,19 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.feed.client; + +import java.util.Optional; + +/** + * @author bjorncs + */ +public class Result { + + public enum Type { + + } + + public Type type() { return null; } + public String documentId() { return null; } + public String resultMessage() { return null; } + public Optional<String> traceMessage() { return Optional.empty(); } +} diff --git a/vespa-feed-client/src/test/java/.gitignore b/vespa-feed-client/src/test/java/.gitignore new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/vespa-feed-client/src/test/java/.gitignore |