Updates generated code to reflect the proto changes in #19

This commit is contained in:
Tim Emiola 2015-02-18 17:22:46 -08:00
parent 813112ec42
commit e342471965
5 changed files with 75 additions and 75 deletions

View File

@ -13,150 +13,150 @@ import static com.google.net.stubby.stub.ServerCalls.asyncUnaryRequestCall;
import static com.google.net.stubby.stub.ServerCalls.asyncStreamingRequestCall;
@javax.annotation.Generated("by gRPC proto compiler")
public class GreetingsGrpc {
public class GreeterGrpc {
private static final com.google.net.stubby.stub.Method<ex.grpc.Helloworld.HelloRequest,
ex.grpc.Helloworld.HelloReply> METHOD_HELLO =
ex.grpc.Helloworld.HelloReply> METHOD_SAY_HELLO =
com.google.net.stubby.stub.Method.create(
com.google.net.stubby.MethodType.UNARY, "hello",
com.google.net.stubby.MethodType.UNARY, "sayHello",
com.google.net.stubby.proto.ProtoUtils.marshaller(ex.grpc.Helloworld.HelloRequest.PARSER),
com.google.net.stubby.proto.ProtoUtils.marshaller(ex.grpc.Helloworld.HelloReply.PARSER));
public static GreetingsStub newStub(com.google.net.stubby.Channel channel) {
return new GreetingsStub(channel, CONFIG);
public static GreeterStub newStub(com.google.net.stubby.Channel channel) {
return new GreeterStub(channel, CONFIG);
}
public static GreetingsBlockingStub newBlockingStub(
public static GreeterBlockingStub newBlockingStub(
com.google.net.stubby.Channel channel) {
return new GreetingsBlockingStub(channel, CONFIG);
return new GreeterBlockingStub(channel, CONFIG);
}
public static GreetingsFutureStub newFutureStub(
public static GreeterFutureStub newFutureStub(
com.google.net.stubby.Channel channel) {
return new GreetingsFutureStub(channel, CONFIG);
return new GreeterFutureStub(channel, CONFIG);
}
public static final GreetingsServiceDescriptor CONFIG =
new GreetingsServiceDescriptor();
public static final GreeterServiceDescriptor CONFIG =
new GreeterServiceDescriptor();
@javax.annotation.concurrent.Immutable
public static class GreetingsServiceDescriptor extends
com.google.net.stubby.stub.AbstractServiceDescriptor<GreetingsServiceDescriptor> {
public static class GreeterServiceDescriptor extends
com.google.net.stubby.stub.AbstractServiceDescriptor<GreeterServiceDescriptor> {
public final com.google.net.stubby.MethodDescriptor<ex.grpc.Helloworld.HelloRequest,
ex.grpc.Helloworld.HelloReply> hello;
ex.grpc.Helloworld.HelloReply> sayHello;
private GreetingsServiceDescriptor() {
hello = createMethodDescriptor(
"helloworld.Greetings", METHOD_HELLO);
private GreeterServiceDescriptor() {
sayHello = createMethodDescriptor(
"helloworld.Greeter", METHOD_SAY_HELLO);
}
private GreetingsServiceDescriptor(
private GreeterServiceDescriptor(
java.util.Map<java.lang.String, com.google.net.stubby.MethodDescriptor<?, ?>> methodMap) {
hello = (com.google.net.stubby.MethodDescriptor<ex.grpc.Helloworld.HelloRequest,
sayHello = (com.google.net.stubby.MethodDescriptor<ex.grpc.Helloworld.HelloRequest,
ex.grpc.Helloworld.HelloReply>) methodMap.get(
CONFIG.hello.getName());
CONFIG.sayHello.getName());
}
@java.lang.Override
protected GreetingsServiceDescriptor build(
protected GreeterServiceDescriptor build(
java.util.Map<java.lang.String, com.google.net.stubby.MethodDescriptor<?, ?>> methodMap) {
return new GreetingsServiceDescriptor(methodMap);
return new GreeterServiceDescriptor(methodMap);
}
@java.lang.Override
public com.google.common.collect.ImmutableList<com.google.net.stubby.MethodDescriptor<?, ?>> methods() {
return com.google.common.collect.ImmutableList.<com.google.net.stubby.MethodDescriptor<?, ?>>of(
hello);
sayHello);
}
}
public static interface Greetings {
public static interface Greeter {
public void hello(ex.grpc.Helloworld.HelloRequest request,
public void sayHello(ex.grpc.Helloworld.HelloRequest request,
com.google.net.stubby.stub.StreamObserver<ex.grpc.Helloworld.HelloReply> responseObserver);
}
public static interface GreetingsBlockingClient {
public static interface GreeterBlockingClient {
public ex.grpc.Helloworld.HelloReply hello(ex.grpc.Helloworld.HelloRequest request);
public ex.grpc.Helloworld.HelloReply sayHello(ex.grpc.Helloworld.HelloRequest request);
}
public static interface GreetingsFutureClient {
public static interface GreeterFutureClient {
public com.google.common.util.concurrent.ListenableFuture<ex.grpc.Helloworld.HelloReply> hello(
public com.google.common.util.concurrent.ListenableFuture<ex.grpc.Helloworld.HelloReply> sayHello(
ex.grpc.Helloworld.HelloRequest request);
}
public static class GreetingsStub extends
com.google.net.stubby.stub.AbstractStub<GreetingsStub, GreetingsServiceDescriptor>
implements Greetings {
private GreetingsStub(com.google.net.stubby.Channel channel,
GreetingsServiceDescriptor config) {
public static class GreeterStub extends
com.google.net.stubby.stub.AbstractStub<GreeterStub, GreeterServiceDescriptor>
implements Greeter {
private GreeterStub(com.google.net.stubby.Channel channel,
GreeterServiceDescriptor config) {
super(channel, config);
}
@java.lang.Override
protected GreetingsStub build(com.google.net.stubby.Channel channel,
GreetingsServiceDescriptor config) {
return new GreetingsStub(channel, config);
protected GreeterStub build(com.google.net.stubby.Channel channel,
GreeterServiceDescriptor config) {
return new GreeterStub(channel, config);
}
@java.lang.Override
public void hello(ex.grpc.Helloworld.HelloRequest request,
public void sayHello(ex.grpc.Helloworld.HelloRequest request,
com.google.net.stubby.stub.StreamObserver<ex.grpc.Helloworld.HelloReply> responseObserver) {
asyncUnaryCall(
channel.newCall(config.hello), request, responseObserver);
channel.newCall(config.sayHello), request, responseObserver);
}
}
public static class GreetingsBlockingStub extends
com.google.net.stubby.stub.AbstractStub<GreetingsBlockingStub, GreetingsServiceDescriptor>
implements GreetingsBlockingClient {
private GreetingsBlockingStub(com.google.net.stubby.Channel channel,
GreetingsServiceDescriptor config) {
public static class GreeterBlockingStub extends
com.google.net.stubby.stub.AbstractStub<GreeterBlockingStub, GreeterServiceDescriptor>
implements GreeterBlockingClient {
private GreeterBlockingStub(com.google.net.stubby.Channel channel,
GreeterServiceDescriptor config) {
super(channel, config);
}
@java.lang.Override
protected GreetingsBlockingStub build(com.google.net.stubby.Channel channel,
GreetingsServiceDescriptor config) {
return new GreetingsBlockingStub(channel, config);
protected GreeterBlockingStub build(com.google.net.stubby.Channel channel,
GreeterServiceDescriptor config) {
return new GreeterBlockingStub(channel, config);
}
@java.lang.Override
public ex.grpc.Helloworld.HelloReply hello(ex.grpc.Helloworld.HelloRequest request) {
public ex.grpc.Helloworld.HelloReply sayHello(ex.grpc.Helloworld.HelloRequest request) {
return blockingUnaryCall(
channel.newCall(config.hello), request);
channel.newCall(config.sayHello), request);
}
}
public static class GreetingsFutureStub extends
com.google.net.stubby.stub.AbstractStub<GreetingsFutureStub, GreetingsServiceDescriptor>
implements GreetingsFutureClient {
private GreetingsFutureStub(com.google.net.stubby.Channel channel,
GreetingsServiceDescriptor config) {
public static class GreeterFutureStub extends
com.google.net.stubby.stub.AbstractStub<GreeterFutureStub, GreeterServiceDescriptor>
implements GreeterFutureClient {
private GreeterFutureStub(com.google.net.stubby.Channel channel,
GreeterServiceDescriptor config) {
super(channel, config);
}
@java.lang.Override
protected GreetingsFutureStub build(com.google.net.stubby.Channel channel,
GreetingsServiceDescriptor config) {
return new GreetingsFutureStub(channel, config);
protected GreeterFutureStub build(com.google.net.stubby.Channel channel,
GreeterServiceDescriptor config) {
return new GreeterFutureStub(channel, config);
}
@java.lang.Override
public com.google.common.util.concurrent.ListenableFuture<ex.grpc.Helloworld.HelloReply> hello(
public com.google.common.util.concurrent.ListenableFuture<ex.grpc.Helloworld.HelloReply> sayHello(
ex.grpc.Helloworld.HelloRequest request) {
return unaryFutureCall(
channel.newCall(config.hello), request);
channel.newCall(config.sayHello), request);
}
}
public static com.google.net.stubby.ServerServiceDefinition bindService(
final Greetings serviceImpl) {
return com.google.net.stubby.ServerServiceDefinition.builder("helloworld.Greetings")
final Greeter serviceImpl) {
return com.google.net.stubby.ServerServiceDefinition.builder("helloworld.Greeter")
.addMethod(createMethodDefinition(
METHOD_HELLO,
METHOD_SAY_HELLO,
asyncUnaryRequestCall(
new com.google.net.stubby.stub.ServerCalls.UnaryRequestMethod<
ex.grpc.Helloworld.HelloRequest,
@ -165,7 +165,7 @@ public class GreetingsGrpc {
public void invoke(
ex.grpc.Helloworld.HelloRequest request,
com.google.net.stubby.stub.StreamObserver<ex.grpc.Helloworld.HelloReply> responseObserver) {
serviceImpl.hello(request, responseObserver);
serviceImpl.sayHello(request, responseObserver);
}
}))).build();
}

View File

@ -2,10 +2,10 @@ package ex.grpc;
import com.google.net.stubby.stub.StreamObserver;
public class GreetingsImpl implements GreetingsGrpc.Greetings {
public class GreeterImpl implements GreeterGrpc.Greeter {
@Override
public void hello(Helloworld.HelloRequest req,
public void sayHello(Helloworld.HelloRequest req,
StreamObserver<Helloworld.HelloReply> responseObserver) {
Helloworld.HelloReply reply = Helloworld.HelloReply.newBuilder().setMessage(
"Hello " + req.getName()).build();

View File

@ -13,13 +13,13 @@ public class GreetingsClient {
private final Logger logger = Logger.getLogger(
GreetingsClient.class.getName());
private final ChannelImpl channel;
private final GreetingsGrpc.GreetingsBlockingStub blockingStub;
private final GreeterGrpc.GreeterBlockingStub blockingStub;
public GreetingsClient(String host, int port) {
channel = NettyChannelBuilder.forAddress(host, port)
.negotiationType(NegotiationType.PLAINTEXT)
.build();
blockingStub = GreetingsGrpc.newBlockingStub(channel);
blockingStub = GreeterGrpc.newBlockingStub(channel);
}
public void shutdown() throws InterruptedException {
@ -31,7 +31,7 @@ public class GreetingsClient {
logger.fine("Will try to greet " + name + " ...");
Helloworld.HelloRequest req =
Helloworld.HelloRequest.newBuilder().setName(name).build();
Helloworld.HelloReply reply = blockingStub.hello(req);
Helloworld.HelloReply reply = blockingStub.sayHello(req);
logger.info("Greeting: " + reply.getMessage());
} catch (RuntimeException e) {
logger.log(Level.WARNING, "RPC failed", e);

View File

@ -16,7 +16,7 @@ public class GreetingsServer {
private void start() throws Exception {
server = NettyServerBuilder.forPort(port)
.addService(GreetingsGrpc.bindService(new GreetingsImpl()))
.addService(GreeterGrpc.bindService(new GreeterImpl()))
.build();
server.startAsync();
server.awaitRunning(5, TimeUnit.SECONDS);

View File

@ -1,5 +1,5 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: src/main/proto/helloworld.proto
// source: helloworld.proto
package ex.grpc;
@ -915,11 +915,11 @@ public final class Helloworld {
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\037src/main/proto/helloworld.proto\022\nhello" +
"world\"\034\n\014HelloRequest\022\014\n\004name\030\001 \001(\t\"\035\n\nH" +
"elloReply\022\017\n\007message\030\001 \001(\t2H\n\tGreetings\022" +
";\n\005hello\022\030.helloworld.HelloRequest\032\026.hel" +
"loworld.HelloReply\"\000B\t\n\007ex.grpcb\006proto3"
"\n\020helloworld.proto\022\nhelloworld\"\034\n\014HelloR" +
"equest\022\014\n\004name\030\001 \001(\t\"\035\n\nHelloReply\022\017\n\007me" +
"ssage\030\001 \001(\t2I\n\007Greeter\022>\n\010sayHello\022\030.hel" +
"loworld.HelloRequest\032\026.helloworld.HelloR" +
"eply\"\000B\t\n\007ex.grpcb\006proto3"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {