OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // http://code.google.com/p/protobuf/ | 3 // http://code.google.com/p/protobuf/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 10 matching lines...) Expand all Loading... |
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | 30 |
31 // Author: kenton@google.com (Kenton Varda) | 31 package com.google.protobuf; |
32 | 32 |
33 #include <google/protobuf/compiler/command_line_interface.h> | 33 /** |
34 #include <google/protobuf/compiler/cpp/cpp_generator.h> | 34 * Blocking equivalent to {@link Service}. |
35 #include <google/protobuf/compiler/python/python_generator.h> | 35 * |
36 #include <google/protobuf/compiler/java/java_generator.h> | 36 * @author kenton@google.com Kenton Varda |
| 37 * @author cpovirk@google.com Chris Povirk |
| 38 */ |
| 39 public interface BlockingService { |
| 40 /** |
| 41 * Equivalent to {@link Service#getDescriptorForType}. |
| 42 */ |
| 43 Descriptors.ServiceDescriptor getDescriptorForType(); |
37 | 44 |
| 45 /** |
| 46 * Equivalent to {@link Service#callMethod}, except that |
| 47 * {@code callBlockingMethod()} returns the result of the RPC or throws a |
| 48 * {@link ServiceException} if there is a failure, rather than passing the |
| 49 * information to a callback. |
| 50 */ |
| 51 Message callBlockingMethod(Descriptors.MethodDescriptor method, |
| 52 RpcController controller, |
| 53 Message request) throws ServiceException; |
38 | 54 |
39 int main(int argc, char* argv[]) { | 55 /** |
| 56 * Equivalent to {@link Service#getRequestPrototype}. |
| 57 */ |
| 58 Message getRequestPrototype(Descriptors.MethodDescriptor method); |
40 | 59 |
41 google::protobuf::compiler::CommandLineInterface cli; | 60 /** |
42 cli.AllowPlugins("protoc-"); | 61 * Equivalent to {@link Service#getResponsePrototype}. |
43 | 62 */ |
44 // Proto2 C++ | 63 Message getResponsePrototype(Descriptors.MethodDescriptor method); |
45 google::protobuf::compiler::cpp::CppGenerator cpp_generator; | |
46 cli.RegisterGenerator("--cpp_out", &cpp_generator, | |
47 "Generate C++ header and source."); | |
48 | |
49 // Proto2 Java | |
50 google::protobuf::compiler::java::JavaGenerator java_generator; | |
51 cli.RegisterGenerator("--java_out", &java_generator, | |
52 "Generate Java source file."); | |
53 | |
54 | |
55 // Proto2 Python | |
56 google::protobuf::compiler::python::Generator py_generator; | |
57 cli.RegisterGenerator("--python_out", &py_generator, | |
58 "Generate Python source file."); | |
59 | |
60 return cli.Run(argc, argv); | |
61 } | 64 } |
OLD | NEW |