diff options
17 files changed, 156 insertions, 62 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 044af8ff499..873e4c5fad7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,7 @@ add_subdirectory(filedistribution) add_subdirectory(flags) add_subdirectory(fnet) add_subdirectory(fsa) +add_subdirectory(hosted-zone-api) add_subdirectory(jdisc_core) add_subdirectory(jdisc-security-filters) add_subdirectory(jdisc_http_service) diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java index bb5ba71700c..c8908495c0a 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/ApplicationContainerCluster.java @@ -87,7 +87,7 @@ public final class ApplicationContainerCluster extends ContainerCluster<Applicat addSimpleComponent("com.yahoo.container.jdisc.DeprecatedSecretStoreProvider"); addSimpleComponent("com.yahoo.container.jdisc.CertificateStoreProvider"); addSimpleComponent("com.yahoo.container.jdisc.AthenzIdentityProviderProvider"); - addSimpleComponent("ai.vespa.cloud.SystemInfo"); + addSimpleComponent("com.yahoo.container.jdisc.SystemInfoProvider"); addMetricsV2Handler(); addTestrunnerComponentsIfTester(deployState); } diff --git a/container-core/abi-spec.json b/container-core/abi-spec.json index 3e6276f3f6e..dac33d2d431 100644 --- a/container-core/abi-spec.json +++ b/container-core/abi-spec.json @@ -880,55 +880,5 @@ "public bridge synthetic java.lang.Object clone()" ], "fields": [] - }, - "ai.vespa.cloud.Environment": { - "superClass": "java.lang.Enum", - "interfaces": [], - "attributes": [ - "public", - "final", - "enum" - ], - "methods": [ - "public static ai.vespa.cloud.Environment[] values()", - "public static ai.vespa.cloud.Environment valueOf(java.lang.String)" - ], - "fields": [ - "public static final enum ai.vespa.cloud.Environment dev", - "public static final enum ai.vespa.cloud.Environment perf", - "public static final enum ai.vespa.cloud.Environment test", - "public static final enum ai.vespa.cloud.Environment staging", - "public static final enum ai.vespa.cloud.Environment prod" - ] - }, - "ai.vespa.cloud.SystemInfo": { - "superClass": "java.lang.Object", - "interfaces": [], - "attributes": [ - "public" - ], - "methods": [ - "public void <init>(com.yahoo.cloud.config.ConfigserverConfig)", - "public void <init>(ai.vespa.cloud.Zone)", - "public ai.vespa.cloud.Zone zone()" - ], - "fields": [] - }, - "ai.vespa.cloud.Zone": { - "superClass": "java.lang.Object", - "interfaces": [], - "attributes": [ - "public" - ], - "methods": [ - "public void <init>(ai.vespa.cloud.Environment, java.lang.String)", - "public ai.vespa.cloud.Environment environment()", - "public java.lang.String region()", - "public java.lang.String toString()", - "public int hashCode()", - "public boolean equals(java.lang.Object)", - "public static ai.vespa.cloud.Zone from(java.lang.String)" - ], - "fields": [] } }
\ No newline at end of file diff --git a/container-dev/pom.xml b/container-dev/pom.xml index 1bb06ab9694..dd2d9ceb188 100644 --- a/container-dev/pom.xml +++ b/container-dev/pom.xml @@ -187,6 +187,11 @@ <artifactId>config-bundle</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>hosted-zone-api</artifactId> + <version>${project.version}</version> + </dependency> <!-- NOTE: Dependencies below are added explicitly to exclude transitive deps that are not provided runtime by the container, and hence make them invisible to user projects' build classpath. diff --git a/container-disc/pom.xml b/container-disc/pom.xml index 15b8cd08808..48872d0665b 100644 --- a/container-disc/pom.xml +++ b/container-disc/pom.xml @@ -106,6 +106,12 @@ <artifactId>vespalog</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>hosted-zone-api</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> <!-- WARNING: These are only here to make bundlification work --> <dependency> <groupId>com.yahoo.vespa</groupId> @@ -184,6 +190,7 @@ container-search-and-docproc-jar-with-dependencies.jar, container-search-gui-jar-with-dependencies.jar, docprocs-jar-with-dependencies.jar, + hosted-zone-api-jar-with-dependencies.jar, jdisc-security-filters-jar-with-dependencies.jar, jdisc_http_service-jar-with-dependencies.jar, model-evaluation-jar-with-dependencies.jar, diff --git a/container-disc/src/main/java/com/yahoo/container/jdisc/SystemInfoProvider.java b/container-disc/src/main/java/com/yahoo/container/jdisc/SystemInfoProvider.java new file mode 100644 index 00000000000..0bb3832ddf5 --- /dev/null +++ b/container-disc/src/main/java/com/yahoo/container/jdisc/SystemInfoProvider.java @@ -0,0 +1,27 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.container.jdisc; + +import ai.vespa.cloud.Environment; +import ai.vespa.cloud.SystemInfo; +import ai.vespa.cloud.Zone; +import com.google.inject.Inject; +import com.yahoo.cloud.config.ConfigserverConfig; +import com.yahoo.component.AbstractComponent; +import com.yahoo.container.di.componentgraph.Provider; + +/** + * Provides information about the system in which this container is running. + * This is available and can be injected when running in a cloud environment. + * + * @author bratseth + */ +public class SystemInfoProvider extends AbstractComponent implements Provider<SystemInfo> { + + private final SystemInfo instance; + + @Inject public SystemInfoProvider(ConfigserverConfig config) { + this.instance = new SystemInfo(new Zone(Environment.valueOf(config.environment()), config.region())); + } + + @Override public SystemInfo get() { return instance; } +} diff --git a/dist/vespa.spec b/dist/vespa.spec index 690d4123de4..62707ef1881 100644 --- a/dist/vespa.spec +++ b/dist/vespa.spec @@ -596,6 +596,7 @@ fi %{_prefix}/lib/jars/docprocs-jar-with-dependencies.jar %{_prefix}/lib/jars/flags-jar-with-dependencies.jar %{_prefix}/lib/jars/hk2-*.jar +%{_prefix}/lib/jars/hosted-zone-api-jar-with-dependencies.jar %{_prefix}/lib/jars/jackson-*.jar %{_prefix}/lib/jars/javassist-*.jar %{_prefix}/lib/jars/javax.*.jar diff --git a/hosted-zone-api/CMakeLists.txt b/hosted-zone-api/CMakeLists.txt new file mode 100644 index 00000000000..cc6b2953759 --- /dev/null +++ b/hosted-zone-api/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. +install_fat_java_artifact(hosted-zone-api) diff --git a/hosted-zone-api/README.md b/hosted-zone-api/README.md new file mode 100644 index 00000000000..8f44632dde1 --- /dev/null +++ b/hosted-zone-api/README.md @@ -0,0 +1,4 @@ +<!-- Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +# hosted-zone-api + +Contains hosted Zone API for user facing Vespa Java APIs diff --git a/hosted-zone-api/abi-spec.json b/hosted-zone-api/abi-spec.json new file mode 100644 index 00000000000..e5d1db476c2 --- /dev/null +++ b/hosted-zone-api/abi-spec.json @@ -0,0 +1,51 @@ +{ + "ai.vespa.cloud.Environment": { + "superClass": "java.lang.Enum", + "interfaces": [], + "attributes": [ + "public", + "final", + "enum" + ], + "methods": [ + "public static ai.vespa.cloud.Environment[] values()", + "public static ai.vespa.cloud.Environment valueOf(java.lang.String)" + ], + "fields": [ + "public static final enum ai.vespa.cloud.Environment dev", + "public static final enum ai.vespa.cloud.Environment perf", + "public static final enum ai.vespa.cloud.Environment test", + "public static final enum ai.vespa.cloud.Environment staging", + "public static final enum ai.vespa.cloud.Environment prod" + ] + }, + "ai.vespa.cloud.SystemInfo": { + "superClass": "java.lang.Object", + "interfaces": [], + "attributes": [ + "public" + ], + "methods": [ + "public void <init>(ai.vespa.cloud.Zone)", + "public ai.vespa.cloud.Zone zone()" + ], + "fields": [] + }, + "ai.vespa.cloud.Zone": { + "superClass": "java.lang.Object", + "interfaces": [], + "attributes": [ + "public" + ], + "methods": [ + "public void <init>(ai.vespa.cloud.Environment, java.lang.String)", + "public ai.vespa.cloud.Environment environment()", + "public java.lang.String region()", + "public java.lang.String toString()", + "public int hashCode()", + "public boolean equals(java.lang.Object)", + "public static ai.vespa.cloud.Zone from(java.lang.String)" + ], + "fields": [] + } +}
\ No newline at end of file diff --git a/hosted-zone-api/pom.xml b/hosted-zone-api/pom.xml new file mode 100644 index 00000000000..05a291c52bf --- /dev/null +++ b/hosted-zone-api/pom.xml @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<!-- Copyright 2017 Yahoo Holdings. 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>hosted-zone-api</artifactId> + <packaging>container-plugin</packaging> + <version>7-SNAPSHOT</version> + + <dependencies> + <!-- provided --> + <dependency> + <groupId>com.yahoo.vespa</groupId> + <artifactId>annotations</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <!-- required for bundle-plugin to generate import-package statements for Java's standard library --> + <groupId>com.yahoo.vespa</groupId> + <artifactId>jdisc_core</artifactId> + <version>${project.version}</version> + <scope>provided</scope> + </dependency> + + <!-- test --> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>com.yahoo.vespa</groupId> + <artifactId>bundle-plugin</artifactId> + <extensions>true</extensions> + </plugin> + <plugin> + <groupId>com.yahoo.vespa</groupId> + <artifactId>abi-check-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + </plugin> + </plugins> + </build> +</project> diff --git a/container-core/src/main/java/ai/vespa/cloud/Environment.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/Environment.java index 8f1d9fc962a..8f1d9fc962a 100644 --- a/container-core/src/main/java/ai/vespa/cloud/Environment.java +++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/Environment.java diff --git a/container-core/src/main/java/ai/vespa/cloud/SystemInfo.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java index 0524ae072cd..0ac93861275 100644 --- a/container-core/src/main/java/ai/vespa/cloud/SystemInfo.java +++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/SystemInfo.java @@ -1,9 +1,6 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package ai.vespa.cloud; -import com.google.inject.Inject; -import com.yahoo.cloud.config.ConfigserverConfig; - /** * Provides information about the system in which this container is running. * This is available and can be injected when running in a cloud environment. @@ -14,13 +11,6 @@ public class SystemInfo { private final Zone zone; - /** Do not use */ - @Inject - public SystemInfo(ConfigserverConfig config) { - this.zone = new Zone(Environment.valueOf(config.environment()), config.region()); - } - - /** Create an instance for testing */ public SystemInfo(Zone zone) { this.zone = zone; } diff --git a/container-core/src/main/java/ai/vespa/cloud/Zone.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/Zone.java index 48293aa7908..48293aa7908 100644 --- a/container-core/src/main/java/ai/vespa/cloud/Zone.java +++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/Zone.java diff --git a/container-core/src/main/java/ai/vespa/cloud/package-info.java b/hosted-zone-api/src/main/java/ai/vespa/cloud/package-info.java index 259a2bda258..259a2bda258 100644 --- a/container-core/src/main/java/ai/vespa/cloud/package-info.java +++ b/hosted-zone-api/src/main/java/ai/vespa/cloud/package-info.java diff --git a/container-core/src/test/java/ai/vespa/cloud/SystemInfoTest.java b/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java index 6bc8b395e00..6bc8b395e00 100644 --- a/container-core/src/test/java/ai/vespa/cloud/SystemInfoTest.java +++ b/hosted-zone-api/src/test/java/ai/vespa/cloud/SystemInfoTest.java @@ -80,6 +80,8 @@ <module>filedistribution</module> <module>flags</module> <module>fsa</module> + <module>hosted-api</module> + <module>hosted-zone-api</module> <module>http-utils</module> <module>indexinglanguage</module> <module>jaxrs_client_utils</module> @@ -144,7 +146,6 @@ <module>zkfacade</module> <module>zookeeper-command-line-client</module> <module>zookeeper-server</module> - <module>hosted-api</module> </modules> </project> |