diff --git a/java/paddle-serving-sdk-java/pom.xml b/java/paddle-serving-sdk-java/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..781c35f847407767fae9140ba8b419d8772cc1dc --- /dev/null +++ b/java/paddle-serving-sdk-java/pom.xml @@ -0,0 +1,301 @@ + + + + 4.0.0 + + io.paddle.serving.client + paddle-serving-sdk-java + 0.0.1 + jar + + paddle-serving-sdk-java + Java SDK for Paddle Sering Client. + https://github.com/PaddlePaddle/Serving + + + + Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + UTF-8 + 1.27.2 + 3.11.0 + 3.11.0 + 1.8 + 1.8 + + + + + + io.grpc + grpc-bom + ${grpc.version} + pom + import + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + io.grpc + grpc-netty-shaded + runtime + + + io.grpc + grpc-protobuf + + + io.grpc + grpc-stub + + + javax.annotation + javax.annotation-api + 1.2 + provided + + + io.grpc + grpc-testing + test + + + com.google.protobuf + protobuf-java-util + ${protobuf.version} + + + com.google.errorprone + error_prone_annotations + 2.3.4 + + + org.junit.jupiter + junit-jupiter + 5.5.2 + test + + + org.apache.commons + commons-text + 1.6 + + + org.apache.commons + commons-collections4 + 4.4 + + + org.json + json + 20190722 + + + org.slf4j + slf4j-api + 1.7.30 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.12.1 + + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + 3.1.0 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + ${java.home}/bin/javadoc + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + kr.motd.maven + os-maven-plugin + 1.6.2 + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + true + + ossrh + https://oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + true + false + release + deploy + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + 0.6.1 + + com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier} + + grpc-java + io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} + + + + + + compile + compile-custom + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce + + + + + + + enforce + + + + + + + maven-assembly-plugin + + + + true + my.fully.qualified.class.Main + + + + jar-with-dependencies + + + + + make-my-jar-with-dependencies + package + + single + + + + + + + + diff --git a/java/paddle-serving-sdk-java/src/main/java/io/paddle/serving/client/App.java b/java/paddle-serving-sdk-java/src/main/java/io/paddle/serving/client/App.java new file mode 100644 index 0000000000000000000000000000000000000000..987bca8731e383890f151d58fef04d806ddda9f2 --- /dev/null +++ b/java/paddle-serving-sdk-java/src/main/java/io/paddle/serving/client/App.java @@ -0,0 +1,15 @@ +package io.paddle.serving.client; + +import io.paddle.serving.grpc.*; + +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + SimpleResponse tmp = SimpleResponse.newBuilder() + .setErrCode(1) + .build(); + System.out.println( "Hello World!" ); + } +} diff --git a/java/paddle-serving-sdk-java/src/main/proto/multi_lang_general_model_service.proto b/java/paddle-serving-sdk-java/src/main/proto/multi_lang_general_model_service.proto new file mode 100644 index 0000000000000000000000000000000000000000..efdaf4fbc6b70b3f99f18ac391c391117e51492e --- /dev/null +++ b/java/paddle-serving-sdk-java/src/main/proto/multi_lang_general_model_service.proto @@ -0,0 +1,68 @@ +// Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +// +// 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 +// +// http://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. + +syntax = "proto2"; + +option java_multiple_files = true; +option java_package = "io.paddle.serving.grpc"; +option java_outer_classname = "ServingProto"; + +package paddle.serving.grpc; + +message Tensor { + optional bytes data = 1; + repeated int32 int_data = 2; + repeated int64 int64_data = 3; + repeated float float_data = 4; + optional int32 elem_type = 5; + repeated int32 shape = 6; + repeated int32 lod = 7; // only for fetch tensor currently +}; + +message FeedInst { repeated Tensor tensor_array = 1; }; + +message FetchInst { repeated Tensor tensor_array = 1; }; + +message InferenceRequest { + repeated FeedInst insts = 1; + repeated string feed_var_names = 2; + repeated string fetch_var_names = 3; + required bool is_python = 4 [ default = false ]; +}; + +message InferenceResponse { + repeated ModelOutput outputs = 1; + optional string tag = 2; + required int32 err_code = 3; +}; + +message ModelOutput { + repeated FetchInst insts = 1; + optional string engine_name = 2; +} + +message SetTimeoutRequest { required int32 timeout_ms = 1; } + +message SimpleResponse { required int32 err_code = 1; } + +message GetClientConfigRequest {} + +message GetClientConfigResponse { required string client_config_str = 1; } + +service MultiLangGeneralModelService { + rpc Inference(InferenceRequest) returns (InferenceResponse) {} + rpc SetTimeout(SetTimeoutRequest) returns (SimpleResponse) {} + rpc GetClientConfig(GetClientConfigRequest) + returns (GetClientConfigResponse) {} +}; diff --git a/java/paddle-serving-sdk-java/src/test/java/io/paddle/serving/client/AppTest.java b/java/paddle-serving-sdk-java/src/test/java/io/paddle/serving/client/AppTest.java new file mode 100644 index 0000000000000000000000000000000000000000..3d0994dc6255d0be811bec4c738e8eb5145a9f4e --- /dev/null +++ b/java/paddle-serving-sdk-java/src/test/java/io/paddle/serving/client/AppTest.java @@ -0,0 +1,20 @@ +package io.paddle.serving.client; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +}