diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ff1139acb..bc717beab2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -144,5 +144,39 @@ jobs: python3 setup.py sdist bdist_wheel python3 -m twine upload --verbose dist/* - # TODO(adchia): publish java sdk once maven repo is updated - # See https://github.com/feast-dev/feast-java/blob/master/.github/workflows/release.yml#L104 \ No newline at end of file + publish-java-sdk: + container: maven:3.6-jdk-11 + runs-on: ubuntu-latest + needs: get-version + steps: + - uses: actions/checkout@v2 + with: + submodules: 'true' + - name: Set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: '11' + java-package: jdk + architecture: x64 + - uses: actions/setup-python@v2 + with: + python-version: '3.7' + architecture: 'x64' + - uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-it-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-it-maven- + - name: Publish java sdk + env: + VERSION_WITHOUT_PREFIX: ${{ needs.get-version.outputs.version_without_prefix }} + GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + MAVEN_SETTINGS: ${{ secrets.MAVEN_SETTINGS }} + run: | + echo -n "$GPG_PUBLIC_KEY" > /root/public-key + echo -n "$GPG_PRIVATE_KEY" > /root/private-key + mkdir -p /root/.m2/ + echo -n "$MAVEN_SETTINGS" > /root/.m2/settings.xml + infra/scripts/publish-java-sdk.sh --revision ${VERSION_WITHOUT_PREFIX} --gpg-key-import-dir /root diff --git a/infra/scripts/publish-java-sdk.sh b/infra/scripts/publish-java-sdk.sh index ed00799e84..ce1f79d2f1 100755 --- a/infra/scripts/publish-java-sdk.sh +++ b/infra/scripts/publish-java-sdk.sh @@ -69,4 +69,4 @@ gpg --import --batch --yes $GPG_KEY_IMPORT_DIR/private-key echo "============================================================" echo "Deploying Java SDK with revision: $REVISION" echo "============================================================" -mvn -f java/pom.xml --projects datatypes/java,sdk/java -Drevision=$REVISION --batch-mode clean deploy +mvn -f java/pom.xml --projects .,datatypes/java,sdk/java -Drevision=$REVISION --batch-mode clean deploy diff --git a/java/common/pom.xml b/java/common/pom.xml index 0c5651876e..53ce690780 100644 --- a/java/common/pom.xml +++ b/java/common/pom.xml @@ -33,13 +33,14 @@ dev.feast - datatypes-java + feast-datatypes ${project.version} compile com.google.protobuf protobuf-java-util + ${protobuf.version} @@ -52,75 +53,34 @@ org.projectlombok lombok + ${lombok.version} com.google.auto.value auto-value-annotations + ${auto.value.version} com.google.code.gson gson + ${gson.version} io.gsonfire gson-fire + ${gson.fire.version} com.fasterxml.jackson.core jackson-databind + 2.10.1 com.fasterxml.jackson.datatype jackson-datatype-jsr310 - - - - - org.springframework - spring-context-support - - - net.devh - grpc-server-spring-boot-starter - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.springframework.boot - spring-boot-starter-data-jpa - - - org.springframework.boot - spring-boot-starter-web - - - org.hibernate.validator - hibernate-validator - 6.1.5.Final - - - - - org.springframework.security - spring-security-core - - - org.springframework.security - spring-security-config - - - org.springframework.security - spring-security-oauth2-resource-server - - - org.springframework.security - spring-security-oauth2-jose + 2.10.1 @@ -134,7 +94,6 @@ 0.3.1 - javax.xml.bind jaxb-api @@ -156,6 +115,7 @@ org.hamcrest hamcrest-library test + ${hamcrest.version} @@ -163,28 +123,12 @@ junit 4.13.2 - - org.springframework - spring-test - test - org.mockito mockito-core ${mockito.version} test - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - @@ -206,6 +150,13 @@ -Xms2048m -Xmx2048m -Djdk.net.URLClassPath.disableClassPathURLCheck=true + + org.sonatype.plugins + nexus-staging-maven-plugin + + true + + diff --git a/java/common/src/main/java/feast/common/logging/AuditLogger.java b/java/common/src/main/java/feast/common/logging/AuditLogger.java index 5f70fbfc97..f3538a794b 100644 --- a/java/common/src/main/java/feast/common/logging/AuditLogger.java +++ b/java/common/src/main/java/feast/common/logging/AuditLogger.java @@ -32,26 +32,23 @@ import org.slf4j.Marker; import org.slf4j.MarkerFactory; import org.slf4j.event.Level; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.info.BuildProperties; -import org.springframework.stereotype.Component; @Slf4j -@Component public class AuditLogger { private static final String FLUENTD_DESTINATION = "fluentd"; private static final Marker AUDIT_MARKER = MarkerFactory.getMarker("AUDIT_MARK"); private static FluentLogger fluentLogger; private static AuditLogProperties properties; - private static BuildProperties buildProperties; + private static String artifact; + private static String version; - @Autowired - public AuditLogger(LoggingProperties loggingProperties, BuildProperties buildProperties) { + public AuditLogger(LoggingProperties loggingProperties, String artifact, String version) { // Spring runs this constructor when creating the AuditLogger bean, // which allows us to populate the AuditLogger class with dependencies. // This allows us to use the dependencies in the AuditLogger's static methods AuditLogger.properties = loggingProperties.getAudit(); - AuditLogger.buildProperties = buildProperties; + AuditLogger.artifact = artifact; + AuditLogger.version = version; if (AuditLogger.properties.getMessageLogging() != null && AuditLogger.properties.getMessageLogging().isEnabled()) { AuditLogger.fluentLogger = @@ -69,12 +66,7 @@ public AuditLogger(LoggingProperties loggingProperties, BuildProperties buildPro * @param entryBuilder with all fields set except instance. */ public static void logMessage(Level level, MessageAuditLogEntry.Builder entryBuilder) { - log( - level, - entryBuilder - .setComponent(buildProperties.getArtifact()) - .setVersion(buildProperties.getVersion()) - .build()); + log(level, entryBuilder.setComponent(artifact).setVersion(version).build()); } /** @@ -90,10 +82,7 @@ public static void logAction( log( level, ActionAuditLogEntry.of( - buildProperties.getArtifact(), - buildProperties.getArtifact(), - LogResource.of(resourceType, resourceId), - action)); + artifact, version, LogResource.of(resourceType, resourceId), action)); } /** @@ -109,10 +98,7 @@ public static void logTransition( log( level, TransitionAuditLogEntry.of( - buildProperties.getArtifact(), - buildProperties.getArtifact(), - LogResource.of(resourceType, resourceId), - status)); + artifact, version, LogResource.of(resourceType, resourceId), status)); } /** diff --git a/java/common/src/main/java/feast/common/logging/interceptors/GrpcMessageInterceptor.java b/java/common/src/main/java/feast/common/logging/interceptors/GrpcMessageInterceptor.java index ffd7c6b954..661642a89a 100644 --- a/java/common/src/main/java/feast/common/logging/interceptors/GrpcMessageInterceptor.java +++ b/java/common/src/main/java/feast/common/logging/interceptors/GrpcMessageInterceptor.java @@ -30,10 +30,6 @@ import io.grpc.ServerInterceptor; import io.grpc.Status; import org.slf4j.event.Level; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Component; /** * GrpcMessageInterceptor intercepts a GRPC calls to log handling of GRPC messages to the Audit Log. @@ -41,7 +37,6 @@ * name and assumed authenticated identity (if authentication is enabled). NOTE: * GrpcMessageInterceptor assumes that all service calls are unary (ie single request/response). */ -@Component public class GrpcMessageInterceptor implements ServerInterceptor { private LoggingProperties loggingProperties; @@ -50,7 +45,6 @@ public class GrpcMessageInterceptor implements ServerInterceptor { * * @param loggingProperties properties used to configure logging interceptor. */ - @Autowired public GrpcMessageInterceptor(LoggingProperties loggingProperties) { this.loggingProperties = loggingProperties; } @@ -80,9 +74,7 @@ public Listener interceptCall( entryBuilder.setMethod(fullMethodName.substring(fullMethodName.indexOf("/") + 1)); // Attempt Extract current authenticated identity. - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - String identity = (authentication != null) ? getIdentity(authentication) : ""; - entryBuilder.setIdentity(identity); + entryBuilder.setIdentity(""); // Register forwarding call to intercept outgoing response and log to audit log call = @@ -115,13 +107,4 @@ public void onMessage(ReqT message) { } }; } - - /** - * Extract current authenticated identity from given {@link Authentication}. Extracts subject - * claim if specified in AuthorizationProperties, otherwise returns authentication subject. - */ - private String getIdentity(Authentication authentication) { - // use subject claim as identity if set in security authorization properties - return authentication.getName(); - } } diff --git a/java/datatypes/java/README.md b/java/datatypes/README.md similarity index 100% rename from java/datatypes/java/README.md rename to java/datatypes/README.md diff --git a/java/datatypes/java/src/main/proto/feast b/java/datatypes/java/src/main/proto/feast deleted file mode 120000 index 53364e5f45..0000000000 --- a/java/datatypes/java/src/main/proto/feast +++ /dev/null @@ -1 +0,0 @@ -../../../../../../protos/feast \ No newline at end of file diff --git a/java/datatypes/java/pom.xml b/java/datatypes/pom.xml similarity index 85% rename from java/datatypes/java/pom.xml rename to java/datatypes/pom.xml index fe6c380a10..a5c82d4c45 100644 --- a/java/datatypes/java/pom.xml +++ b/java/datatypes/pom.xml @@ -30,13 +30,13 @@ 11 11 - datatypes-java + feast-datatypes dev.feast feast-parent ${revision} - ../.. + ../ @@ -75,6 +75,13 @@ + + org.sonatype.plugins + nexus-staging-maven-plugin + + false + + @@ -83,29 +90,34 @@ com.google.guava guava + ${guava.version} com.google.protobuf protobuf-java + ${protobuf.version} io.grpc grpc-core + ${grpc.version} io.grpc grpc-protobuf + ${grpc.version} io.grpc grpc-services + ${grpc.version} io.grpc grpc-stub + ${grpc.version} - javax.annotation javax.annotation-api diff --git a/java/datatypes/src/main/proto/feast b/java/datatypes/src/main/proto/feast new file mode 120000 index 0000000000..463e4045de --- /dev/null +++ b/java/datatypes/src/main/proto/feast @@ -0,0 +1 @@ +../../../../../protos/feast \ No newline at end of file diff --git a/java/docs/coverage/java/pom.xml b/java/docs/coverage/pom.xml similarity index 96% rename from java/docs/coverage/java/pom.xml rename to java/docs/coverage/pom.xml index 5f79422496..f6e08909ee 100644 --- a/java/docs/coverage/java/pom.xml +++ b/java/docs/coverage/pom.xml @@ -30,7 +30,7 @@ dev.feast feast-parent ${revision} - ../../.. + ../.. Feast Coverage Java @@ -61,7 +61,7 @@ dev.feast - feast-sdk + feast-serving-client ${project.version} diff --git a/java/pom.xml b/java/pom.xml index 6857bce4c0..0431f881a5 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -28,17 +28,17 @@ pom - datatypes/java + datatypes storage/api storage/connectors serving - sdk/java - docs/coverage/java + sdk + docs/coverage common - 0.15.2-SNAPSHOT + 0.17.1-SNAPSHOT https://github.com/feast-dev/feast UTF-8 @@ -47,10 +47,6 @@ 1.30.2 3.12.2 3.16.1 - 2.3.1.RELEASE - 5.2.7.RELEASE - 5.3.0.RELEASE - 2.9.0.RELEASE 1.111.1 0.8.0 1.9.10 @@ -62,7 +58,6 @@ 2.17.1 2.9.9 2.0.2 - 2.5.0.RELEASE 1.18.12 1.8.4 2.8.6 @@ -72,9 +67,9 @@ 2.3.1 1.3.2 2.0.1.Final - 2.8.0 0.20.0 1.6.6 + 29.0-jre - - org.apache.commons - commons-lang3 - ${commons.lang3.version} - - - - com.google.inject - guice - 5.0.1 - - - - - com.google.cloud - google-cloud-bigquery - ${com.google.cloud.version} - - - com.google.cloud - google-cloud-storage - ${com.google.cloud.version} - - - - - com.google.cloud - google-cloud-nio - 0.83.0-alpha - - - - io.opencensus - opencensus-api - ${opencensus.version} - - - io.opencensus - opencensus-contrib-grpc-util - ${opencensus.version} - - - io.opencensus - opencensus-contrib-http-util - ${opencensus.version} - - - - - io.grpc - grpc-core - ${grpc.version} - - - io.grpc - grpc-api - ${grpc.version} - - - io.grpc - grpc-context - ${grpc.version} - - - io.grpc - grpc-all - ${grpc.version} - - - io.grpc - grpc-okhttp - ${grpc.version} - - - io.grpc - grpc-auth - ${grpc.version} - - - io.grpc - grpc-grpclb - ${grpc.version} - - - io.grpc - grpc-alts - ${grpc.version} - - - io.grpc - grpc-netty - ${grpc.version} - - - io.grpc - grpc-netty-shaded - ${grpc.version} - - - io.grpc - grpc-protobuf - ${grpc.version} - - - io.grpc - grpc-services - ${grpc.version} - - - io.grpc - grpc-stub - ${grpc.version} - - - io.grpc - grpc-testing - ${grpc.version} - test - - - - - org.apache.arrow - arrow-java-root - 5.0.0 - pom - - - - - org.apache.arrow - arrow-vector - 5.0.0 - - - - - org.apache.arrow - arrow-memory - 5.0.0 - pom - - - - - org.apache.arrow - arrow-memory-netty - 5.0.0 - runtime - - - - - net.devh - grpc-server-spring-boot-starter - ${grpc.spring.boot.starter.version} - - - - - io.prometheus - simpleclient - ${io.prometheus.version} - - - io.prometheus - simpleclient_servlet - ${io.prometheus.version} - - - - - org.springframework.security - spring-security-core - ${spring.security.version} - - - org.springframework.security - spring-security-config - ${spring.security.version} - - - org.springframework.security - spring-security-oauth2-resource-server - ${spring.security.version} - - - org.springframework.security - spring-security-oauth2-jose - ${spring.security.version} - - - com.google.auth - google-auth-library-oauth2-http - ${google.auth.library.oauth2.http.version} - - - - - joda-time - joda-time - ${joda.time.version} - - - com.datadoghq - java-dogstatsd-client - 2.6.1 - - - com.google.guava - guava - 29.0-jre - - - com.google.protobuf - protobuf-java - ${protobuf.version} - - - com.google.protobuf - protobuf-java-util - ${protobuf.version} - - - org.projectlombok - lombok - ${lombok.version} - provided - - - com.google.auto.value - auto-value-annotations - ${auto.value.version} - - - com.google.auto.value - auto-value - ${auto.value.version} - - - com.google.code.gson - gson - ${gson.version} - - - io.gsonfire - gson-fire - ${gson.fire.version} - - - - com.github.kstyrc - embedded-redis - 0.6 - test - - - - - - net.bytebuddy - byte-buddy - ${byte-buddy.version} - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.springframework.boot - spring-boot-starter-web - ${spring.boot.version} - - - org.springframework.boot - spring-boot-starter-logging - - - - - org.apache.logging.log4j - log4j-api - ${log4jVersion} - - - org.apache.logging.log4j - log4j-core - ${log4jVersion} - - - org.apache.logging.log4j - log4j-jul - ${log4jVersion} - - - org.apache.logging.log4j - log4j-web - ${log4jVersion} - org.apache.logging.log4j log4j-slf4j-impl @@ -462,26 +156,6 @@ 1.7.30 - - - - org.springframework.boot - spring-boot-dependencies - ${spring.boot.version} - pom - import - - - com.squareup.okio - okio - 1.17.2 - javax.xml.bind jaxb-api @@ -497,6 +171,19 @@ validation-api ${javax.validation.version} + + + org.junit.platform + junit-platform-engine + 1.8.2 + test + + + org.junit.platform + junit-platform-commons + 1.8.2 + test + @@ -693,22 +380,6 @@ - - org.springframework.boot - spring-boot-maven-plugin - - - true - - - - build-info - - build-info - - - - org.sonatype.plugins @@ -720,6 +391,7 @@ https://oss.sonatype.org/ true + true @@ -137,6 +142,13 @@ org.jacoco jacoco-maven-plugin + + org.sonatype.plugins + nexus-staging-maven-plugin + + false + + diff --git a/java/sdk/java/src/main/java/dev/feast/FeastClient.java b/java/sdk/src/main/java/dev/feast/FeastClient.java similarity index 100% rename from java/sdk/java/src/main/java/dev/feast/FeastClient.java rename to java/sdk/src/main/java/dev/feast/FeastClient.java diff --git a/java/sdk/java/src/main/java/dev/feast/RequestUtil.java b/java/sdk/src/main/java/dev/feast/RequestUtil.java similarity index 100% rename from java/sdk/java/src/main/java/dev/feast/RequestUtil.java rename to java/sdk/src/main/java/dev/feast/RequestUtil.java diff --git a/java/sdk/java/src/main/java/dev/feast/Row.java b/java/sdk/src/main/java/dev/feast/Row.java similarity index 100% rename from java/sdk/java/src/main/java/dev/feast/Row.java rename to java/sdk/src/main/java/dev/feast/Row.java diff --git a/java/sdk/java/src/main/java/dev/feast/SecurityConfig.java b/java/sdk/src/main/java/dev/feast/SecurityConfig.java similarity index 100% rename from java/sdk/java/src/main/java/dev/feast/SecurityConfig.java rename to java/sdk/src/main/java/dev/feast/SecurityConfig.java diff --git a/java/sdk/java/src/test/java/dev/feast/FeastClientTest.java b/java/sdk/src/test/java/dev/feast/FeastClientTest.java similarity index 100% rename from java/sdk/java/src/test/java/dev/feast/FeastClientTest.java rename to java/sdk/src/test/java/dev/feast/FeastClientTest.java diff --git a/java/sdk/java/src/test/java/dev/feast/RequestUtilTest.java b/java/sdk/src/test/java/dev/feast/RequestUtilTest.java similarity index 96% rename from java/sdk/java/src/test/java/dev/feast/RequestUtilTest.java rename to java/sdk/src/test/java/dev/feast/RequestUtilTest.java index 21fb145b24..e5684ecd18 100644 --- a/java/sdk/java/src/test/java/dev/feast/RequestUtilTest.java +++ b/java/sdk/src/test/java/dev/feast/RequestUtilTest.java @@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList; import com.google.protobuf.TextFormat; -import feast.common.models.Feature; import feast.proto.serving.ServingAPIProto.FeatureReferenceV2; import java.util.Arrays; import java.util.Comparator; @@ -68,7 +67,9 @@ void renderFeatureRef_ShouldReturnFeatureRefString( List expected, List input) { input = input.stream().map(ref -> ref.toBuilder().build()).collect(Collectors.toList()); List actual = - input.stream().map(ref -> Feature.getFeatureReference(ref)).collect(Collectors.toList()); + input.stream() + .map(ref -> String.format("%s:%s", ref.getFeatureViewName(), ref.getFeatureName())) + .collect(Collectors.toList()); assertEquals(expected.size(), actual.size()); for (int i = 0; i < expected.size(); i++) { assertEquals(expected.get(i), actual.get(i)); diff --git a/java/serving/pom.xml b/java/serving/pom.xml index 0da96ead95..b6f787ad30 100644 --- a/java/serving/pom.xml +++ b/java/serving/pom.xml @@ -48,6 +48,7 @@ org.apache.maven.plugins maven-jar-plugin + 3.2.2 @@ -87,7 +88,7 @@ dev.feast - datatypes-java + feast-datatypes ${project.version} @@ -119,38 +120,45 @@ org.slf4j slf4j-simple + 1.7.30 org.apache.logging.log4j log4j-web + ${log4jVersion} io.grpc grpc-services + ${grpc.version} io.grpc grpc-stub + ${grpc.version} com.google.protobuf protobuf-java-util + ${protobuf.version} com.google.guava guava + ${guava.version} joda-time joda-time + ${joda.time.version} @@ -198,7 +206,7 @@ com.google.auto.value auto-value-annotations - 1.6.6 + ${auto.value.version} @@ -231,11 +239,13 @@ io.grpc grpc-testing + ${grpc.version} org.mockito mockito-core + ${mockito.version} test @@ -281,11 +291,19 @@ com.fasterxml.jackson.dataformat jackson-dataformat-yaml + 2.11.0 + + + + com.fasterxml.jackson.core + jackson-annotations + 2.12.2 com.github.kstyrc embedded-redis + 0.6 test @@ -340,6 +358,13 @@ false + + org.sonatype.plugins + nexus-staging-maven-plugin + + true + + diff --git a/java/serving/src/main/java/feast/serving/config/ServerModule.java b/java/serving/src/main/java/feast/serving/config/ServerModule.java index cb3a18cf95..5428306f2b 100644 --- a/java/serving/src/main/java/feast/serving/config/ServerModule.java +++ b/java/serving/src/main/java/feast/serving/config/ServerModule.java @@ -18,9 +18,12 @@ import com.google.inject.AbstractModule; import com.google.inject.Provides; +import feast.serving.controller.HealthServiceController; import feast.serving.grpc.OnlineServingGrpcServiceV2; +import feast.serving.service.ServingServiceV2; import io.grpc.Server; import io.grpc.ServerBuilder; +import io.grpc.health.v1.HealthGrpc; import io.grpc.protobuf.services.ProtoReflectionService; import io.opentracing.contrib.grpc.TracingServerInterceptor; @@ -35,13 +38,20 @@ protected void configure() { public Server provideGrpcServer( ApplicationProperties applicationProperties, OnlineServingGrpcServiceV2 onlineServingGrpcServiceV2, - TracingServerInterceptor tracingServerInterceptor) { + TracingServerInterceptor tracingServerInterceptor, + HealthGrpc.HealthImplBase healthImplBase) { ServerBuilder serverBuilder = ServerBuilder.forPort(applicationProperties.getGrpc().getServer().getPort()); serverBuilder .addService(ProtoReflectionService.newInstance()) - .addService(tracingServerInterceptor.intercept(onlineServingGrpcServiceV2)); + .addService(tracingServerInterceptor.intercept(onlineServingGrpcServiceV2)) + .addService(healthImplBase); return serverBuilder.build(); } + + @Provides + public HealthGrpc.HealthImplBase healthService(ServingServiceV2 servingServiceV2) { + return new HealthServiceController(servingServiceV2); + } } diff --git a/java/serving/src/main/java/feast/serving/config/ServingApiConfiguration.java b/java/serving/src/main/java/feast/serving/config/ServingApiConfiguration.java deleted file mode 100644 index ce4fe13437..0000000000 --- a/java/serving/src/main/java/feast/serving/config/ServingApiConfiguration.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright 2018-2019 The Feast Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package feast.serving.config; - -import java.util.List; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.converter.HttpMessageConverter; -import org.springframework.http.converter.protobuf.ProtobufJsonFormatHttpMessageConverter; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -@Configuration -public class ServingApiConfiguration implements WebMvcConfigurer { - @Autowired private ProtobufJsonFormatHttpMessageConverter protobufConverter; - - @Bean - ProtobufJsonFormatHttpMessageConverter protobufHttpMessageConverter() { - return new ProtobufJsonFormatHttpMessageConverter(); - } - - @Override - public void configureMessageConverters(List> converters) { - converters.add(protobufConverter); - } -} diff --git a/java/serving/src/main/java/feast/serving/config/WebSecurityConfig.java b/java/serving/src/main/java/feast/serving/config/WebSecurityConfig.java deleted file mode 100644 index 04d3f4b5af..0000000000 --- a/java/serving/src/main/java/feast/serving/config/WebSecurityConfig.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright 2018-2020 The Feast Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package feast.serving.config; - -import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; - -/** - * WebSecurityConfig disables auto configuration of Spring HTTP Security and allows security methods - * to be overridden - */ -@Configuration -@EnableWebSecurity -public class WebSecurityConfig extends WebSecurityConfigurerAdapter { - - /** - * Allows for custom web security rules to be applied. - * - * @param http {@link HttpSecurity} for configuring web based security - * @throws Exception exception - */ - @Override - protected void configure(HttpSecurity http) throws Exception { - - // Bypasses security/authentication for the following paths - http.authorizeRequests() - .antMatchers("/actuator/**", "/metrics/**") - .permitAll() - .anyRequest() - .authenticated() - .and() - .csrf() - .disable(); - } -} diff --git a/java/serving/src/main/java/feast/serving/controller/HealthServiceController.java b/java/serving/src/main/java/feast/serving/controller/HealthServiceController.java index ef675d4c15..2f98ae032f 100644 --- a/java/serving/src/main/java/feast/serving/controller/HealthServiceController.java +++ b/java/serving/src/main/java/feast/serving/controller/HealthServiceController.java @@ -16,24 +16,20 @@ */ package feast.serving.controller; +import com.google.inject.Inject; import feast.proto.serving.ServingAPIProto.GetFeastServingInfoRequest; -import feast.serving.interceptors.GrpcMonitoringInterceptor; import feast.serving.service.ServingServiceV2; import io.grpc.health.v1.HealthGrpc.HealthImplBase; import io.grpc.health.v1.HealthProto.HealthCheckRequest; import io.grpc.health.v1.HealthProto.HealthCheckResponse; import io.grpc.health.v1.HealthProto.ServingStatus; import io.grpc.stub.StreamObserver; -import net.devh.boot.grpc.server.service.GrpcService; -import org.springframework.beans.factory.annotation.Autowired; // Reference: https://github.com/grpc/grpc/blob/master/doc/health-checking.md - -@GrpcService(interceptors = {GrpcMonitoringInterceptor.class}) public class HealthServiceController extends HealthImplBase { private final ServingServiceV2 servingService; - @Autowired + @Inject public HealthServiceController(final ServingServiceV2 servingService) { this.servingService = servingService; } diff --git a/java/serving/src/main/java/feast/serving/controller/ServingServiceGRpcController.java b/java/serving/src/main/java/feast/serving/controller/ServingServiceGRpcController.java deleted file mode 100644 index bc6af8ecce..0000000000 --- a/java/serving/src/main/java/feast/serving/controller/ServingServiceGRpcController.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright 2018-2019 The Feast Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package feast.serving.controller; - -import feast.proto.serving.ServingAPIProto; -import feast.proto.serving.ServingAPIProto.GetFeastServingInfoRequest; -import feast.proto.serving.ServingAPIProto.GetFeastServingInfoResponse; -import feast.proto.serving.ServingServiceGrpc.ServingServiceImplBase; -import feast.serving.config.ApplicationProperties; -import feast.serving.exception.SpecRetrievalException; -import feast.serving.service.ServingServiceV2; -import feast.serving.util.RequestHelper; -import io.grpc.Status; -import io.grpc.stub.StreamObserver; -import io.opentracing.Span; -import io.opentracing.Tracer; -import org.slf4j.Logger; - -public class ServingServiceGRpcController extends ServingServiceImplBase { - - private static final Logger log = - org.slf4j.LoggerFactory.getLogger(ServingServiceGRpcController.class); - private final ServingServiceV2 servingServiceV2; - private final String version; - private final Tracer tracer; - - public ServingServiceGRpcController( - ServingServiceV2 servingServiceV2, - ApplicationProperties applicationProperties, - Tracer tracer) { - this.servingServiceV2 = servingServiceV2; - this.version = applicationProperties.getFeast().getVersion(); - this.tracer = tracer; - } - - @Override - public void getFeastServingInfo( - GetFeastServingInfoRequest request, - StreamObserver responseObserver) { - GetFeastServingInfoResponse feastServingInfo = servingServiceV2.getFeastServingInfo(request); - feastServingInfo = feastServingInfo.toBuilder().setVersion(version).build(); - responseObserver.onNext(feastServingInfo); - responseObserver.onCompleted(); - } - - @Override - public void getOnlineFeatures( - ServingAPIProto.GetOnlineFeaturesRequest request, - StreamObserver responseObserver) { - try { - // authorize for the project in request object. - RequestHelper.validateOnlineRequest(request); - Span span = tracer.buildSpan("getOnlineFeaturesV2").start(); - ServingAPIProto.GetOnlineFeaturesResponse onlineFeatures = - servingServiceV2.getOnlineFeatures(request); - if (span != null) { - span.finish(); - } - - responseObserver.onNext(onlineFeatures); - responseObserver.onCompleted(); - } catch (SpecRetrievalException e) { - log.error("Failed to retrieve specs from Registry", e); - responseObserver.onError( - Status.NOT_FOUND.withDescription(e.getMessage()).withCause(e).asException()); - } catch (Exception e) { - log.warn("Failed to get Online Features", e); - responseObserver.onError( - Status.INTERNAL.withDescription(e.getMessage()).withCause(e).asRuntimeException()); - } - } -} diff --git a/java/serving/src/main/java/feast/serving/controller/ServingServiceRestController.java b/java/serving/src/main/java/feast/serving/controller/ServingServiceRestController.java deleted file mode 100644 index 1983f3ebce..0000000000 --- a/java/serving/src/main/java/feast/serving/controller/ServingServiceRestController.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * Copyright 2018-2019 The Feast Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package feast.serving.controller; - -import static feast.serving.util.mappers.ResponseJSONMapper.mapGetOnlineFeaturesResponse; - -import feast.proto.serving.ServingAPIProto; -import feast.proto.serving.ServingAPIProto.GetFeastServingInfoRequest; -import feast.proto.serving.ServingAPIProto.GetFeastServingInfoResponse; -import feast.serving.config.ApplicationProperties; -import feast.serving.service.ServingServiceV2; -import feast.serving.util.RequestHelper; -import java.util.List; -import java.util.Map; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; - -public class ServingServiceRestController { - - private final ServingServiceV2 servingService; - private final String version; - - public ServingServiceRestController( - ServingServiceV2 servingService, ApplicationProperties applicationProperties) { - this.servingService = servingService; - this.version = applicationProperties.getFeast().getVersion(); - } - - @RequestMapping(value = "/api/v1/info", produces = "application/json") - public GetFeastServingInfoResponse getInfo() { - GetFeastServingInfoResponse feastServingInfo = - servingService.getFeastServingInfo(GetFeastServingInfoRequest.getDefaultInstance()); - return feastServingInfo.toBuilder().setVersion(version).build(); - } - - @RequestMapping( - value = "/api/v1/features/online", - produces = "application/json", - consumes = "application/json") - public List> getOnlineFeatures( - @RequestBody ServingAPIProto.GetOnlineFeaturesRequest request) { - RequestHelper.validateOnlineRequest(request); - ServingAPIProto.GetOnlineFeaturesResponse onlineFeatures = - servingService.getOnlineFeatures(request); - return mapGetOnlineFeaturesResponse(onlineFeatures); - } -} diff --git a/java/serving/src/main/java/feast/serving/service/OnlineTransformationService.java b/java/serving/src/main/java/feast/serving/service/OnlineTransformationService.java index a535eacb9e..ea404ff7a5 100644 --- a/java/serving/src/main/java/feast/serving/service/OnlineTransformationService.java +++ b/java/serving/src/main/java/feast/serving/service/OnlineTransformationService.java @@ -34,6 +34,7 @@ import io.grpc.ManagedChannel; import io.grpc.ManagedChannelBuilder; import io.grpc.Status; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.channels.Channels; import java.util.*; @@ -49,7 +50,6 @@ import org.apache.arrow.vector.util.ByteArrayReadableSeekableByteChannel; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; -import org.apache.tomcat.util.http.fileupload.ByteArrayOutputStream; import org.slf4j.Logger; public class OnlineTransformationService implements TransformationService { diff --git a/java/storage/api/pom.xml b/java/storage/api/pom.xml index 583bcd0640..90f656e281 100644 --- a/java/storage/api/pom.xml +++ b/java/storage/api/pom.xml @@ -32,16 +32,10 @@ dev.feast - datatypes-java + feast-datatypes ${project.version} - - - - - - com.google.auto.value auto-value-annotations diff --git a/java/storage/connectors/pom.xml b/java/storage/connectors/pom.xml index e896910e73..11e32a154c 100644 --- a/java/storage/connectors/pom.xml +++ b/java/storage/connectors/pom.xml @@ -41,7 +41,7 @@ dev.feast - datatypes-java + feast-datatypes ${project.version} diff --git a/java/storage/connectors/redis/pom.xml b/java/storage/connectors/redis/pom.xml index 7b0c944a66..ce25f41da6 100644 --- a/java/storage/connectors/redis/pom.xml +++ b/java/storage/connectors/redis/pom.xml @@ -48,6 +48,7 @@ com.google.guava guava + ${guava.version} @@ -61,6 +62,7 @@ com.github.kstyrc embedded-redis + 0.6 test @@ -68,12 +70,14 @@ org.hamcrest hamcrest-core test + ${hamcrest.version} org.hamcrest hamcrest-library test + ${hamcrest.version} @@ -93,7 +97,7 @@ org.slf4j slf4j-simple - 1.7.30 + 1.7.32 test