auser-poolparty 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (353) hide show
  1. data/VERSION.yml +1 -1
  2. data/examples/monitored_cloud.rb +1 -1
  3. data/examples/thrift/thrift_example.rb +1 -1
  4. data/lib/proto/command_interface_handler.rb +1 -1
  5. data/vendor/gems/thrift/CHANGES +35 -0
  6. data/vendor/gems/thrift/CONTRIBUTORS +77 -0
  7. data/vendor/gems/thrift/DISCLAIMER +6 -0
  8. data/vendor/gems/thrift/LICENSE +202 -0
  9. data/vendor/gems/thrift/Makefile.am +28 -0
  10. data/vendor/gems/thrift/NEWS +79 -0
  11. data/vendor/gems/thrift/NOTICE +26 -0
  12. data/vendor/gems/thrift/README +137 -0
  13. data/vendor/gems/thrift/aclocal/ax_boost_base.m4 +198 -0
  14. data/vendor/gems/thrift/aclocal/ax_javac_and_java.m4 +107 -0
  15. data/vendor/gems/thrift/aclocal/ax_lib_event.m4 +194 -0
  16. data/vendor/gems/thrift/aclocal/ax_lib_zlib.m4 +173 -0
  17. data/vendor/gems/thrift/aclocal/ax_signed_right_shift.m4 +127 -0
  18. data/vendor/gems/thrift/aclocal/ax_thrift_internal.m4 +39 -0
  19. data/vendor/gems/thrift/bootstrap.sh +35 -0
  20. data/vendor/gems/thrift/cleanup.sh +58 -0
  21. data/vendor/gems/thrift/compiler/cpp/Makefile.am +136 -0
  22. data/vendor/gems/thrift/compiler/cpp/README +39 -0
  23. data/vendor/gems/thrift/compiler/cpp/src/generate/t_cocoa_generator.cc +2331 -0
  24. data/vendor/gems/thrift/compiler/cpp/src/generate/t_cpp_generator.cc +3003 -0
  25. data/vendor/gems/thrift/compiler/cpp/src/generate/t_csharp_generator.cc +1700 -0
  26. data/vendor/gems/thrift/compiler/cpp/src/generate/t_erl_generator.cc +932 -0
  27. data/vendor/gems/thrift/compiler/cpp/src/generate/t_generator.cc +173 -0
  28. data/vendor/gems/thrift/compiler/cpp/src/generate/t_generator.h +321 -0
  29. data/vendor/gems/thrift/compiler/cpp/src/generate/t_hs_generator.cc +1445 -0
  30. data/vendor/gems/thrift/compiler/cpp/src/generate/t_html_generator.cc +637 -0
  31. data/vendor/gems/thrift/compiler/cpp/src/generate/t_java_generator.cc +3069 -0
  32. data/vendor/gems/thrift/compiler/cpp/src/generate/t_ocaml_generator.cc +1673 -0
  33. data/vendor/gems/thrift/compiler/cpp/src/generate/t_oop_generator.h +77 -0
  34. data/vendor/gems/thrift/compiler/cpp/src/generate/t_perl_generator.cc +1812 -0
  35. data/vendor/gems/thrift/compiler/cpp/src/generate/t_php_generator.cc +2281 -0
  36. data/vendor/gems/thrift/compiler/cpp/src/generate/t_py_generator.cc +2310 -0
  37. data/vendor/gems/thrift/compiler/cpp/src/generate/t_rb_generator.cc +1114 -0
  38. data/vendor/gems/thrift/compiler/cpp/src/generate/t_st_generator.cc +1071 -0
  39. data/vendor/gems/thrift/compiler/cpp/src/generate/t_xsd_generator.cc +354 -0
  40. data/vendor/gems/thrift/compiler/cpp/src/globals.h +117 -0
  41. data/vendor/gems/thrift/compiler/cpp/src/main.cc +1207 -0
  42. data/vendor/gems/thrift/compiler/cpp/src/main.h +103 -0
  43. data/vendor/gems/thrift/compiler/cpp/src/md5.c +381 -0
  44. data/vendor/gems/thrift/compiler/cpp/src/md5.h +91 -0
  45. data/vendor/gems/thrift/compiler/cpp/src/parse/t_base_type.h +137 -0
  46. data/vendor/gems/thrift/compiler/cpp/src/parse/t_const.h +59 -0
  47. data/vendor/gems/thrift/compiler/cpp/src/parse/t_const_value.h +121 -0
  48. data/vendor/gems/thrift/compiler/cpp/src/parse/t_container.h +56 -0
  49. data/vendor/gems/thrift/compiler/cpp/src/parse/t_doc.h +51 -0
  50. data/vendor/gems/thrift/compiler/cpp/src/parse/t_enum.h +59 -0
  51. data/vendor/gems/thrift/compiler/cpp/src/parse/t_enum_value.h +64 -0
  52. data/vendor/gems/thrift/compiler/cpp/src/parse/t_field.h +150 -0
  53. data/vendor/gems/thrift/compiler/cpp/src/parse/t_function.h +93 -0
  54. data/vendor/gems/thrift/compiler/cpp/src/parse/t_list.h +56 -0
  55. data/vendor/gems/thrift/compiler/cpp/src/parse/t_map.h +64 -0
  56. data/vendor/gems/thrift/compiler/cpp/src/parse/t_program.h +223 -0
  57. data/vendor/gems/thrift/compiler/cpp/src/parse/t_scope.h +86 -0
  58. data/vendor/gems/thrift/compiler/cpp/src/parse/t_service.h +68 -0
  59. data/vendor/gems/thrift/compiler/cpp/src/parse/t_set.h +55 -0
  60. data/vendor/gems/thrift/compiler/cpp/src/parse/t_struct.h +127 -0
  61. data/vendor/gems/thrift/compiler/cpp/src/parse/t_type.h +176 -0
  62. data/vendor/gems/thrift/compiler/cpp/src/parse/t_typedef.h +70 -0
  63. data/vendor/gems/thrift/compiler/cpp/src/platform.h +36 -0
  64. data/vendor/gems/thrift/compiler/cpp/src/thriftl.ll +303 -0
  65. data/vendor/gems/thrift/compiler/cpp/src/thrifty.yy +1140 -0
  66. data/vendor/gems/thrift/configure.ac +255 -0
  67. data/vendor/gems/thrift/contrib/fb303/LICENSE +16 -0
  68. data/vendor/gems/thrift/contrib/fb303/Makefile.am +31 -0
  69. data/vendor/gems/thrift/contrib/fb303/README +37 -0
  70. data/vendor/gems/thrift/contrib/fb303/acinclude.m4 +258 -0
  71. data/vendor/gems/thrift/contrib/fb303/aclocal/ax_boost_base.m4 +198 -0
  72. data/vendor/gems/thrift/contrib/fb303/bootstrap.sh +26 -0
  73. data/vendor/gems/thrift/contrib/fb303/configure.ac +115 -0
  74. data/vendor/gems/thrift/contrib/fb303/cpp/FacebookBase.cpp +124 -0
  75. data/vendor/gems/thrift/contrib/fb303/cpp/FacebookBase.h +103 -0
  76. data/vendor/gems/thrift/contrib/fb303/cpp/Makefile.am +84 -0
  77. data/vendor/gems/thrift/contrib/fb303/cpp/ServiceTracker.cpp +481 -0
  78. data/vendor/gems/thrift/contrib/fb303/cpp/ServiceTracker.h +215 -0
  79. data/vendor/gems/thrift/contrib/fb303/global_footer.mk +21 -0
  80. data/vendor/gems/thrift/contrib/fb303/global_header.mk +38 -0
  81. data/vendor/gems/thrift/contrib/fb303/if/fb303.thrift +112 -0
  82. data/vendor/gems/thrift/contrib/fb303/java/FacebookBase.java +103 -0
  83. data/vendor/gems/thrift/contrib/fb303/java/build.xml +84 -0
  84. data/vendor/gems/thrift/contrib/fb303/php/FacebookBase.php +89 -0
  85. data/vendor/gems/thrift/contrib/fb303/py/Makefile.am +44 -0
  86. data/vendor/gems/thrift/contrib/fb303/py/fb303/FacebookBase.py +82 -0
  87. data/vendor/gems/thrift/contrib/fb303/py/fb303_scripts/__init__.py +20 -0
  88. data/vendor/gems/thrift/contrib/fb303/py/fb303_scripts/fb303_simple_mgmt.py +195 -0
  89. data/vendor/gems/thrift/contrib/fb303/py/setup.py +27 -0
  90. data/vendor/gems/thrift/contrib/thrift.el +126 -0
  91. data/vendor/gems/thrift/contrib/thrift.spec +206 -0
  92. data/vendor/gems/thrift/contrib/thrift.vim +91 -0
  93. data/vendor/gems/thrift/contrib/thrift_dump.cpp +91 -0
  94. data/vendor/gems/thrift/doc/lgpl-2.1.txt +504 -0
  95. data/vendor/gems/thrift/doc/otp-base-license.txt +20 -0
  96. data/vendor/gems/thrift/doc/thrift.bnf +96 -0
  97. data/vendor/gems/thrift/doc/thrift.tex +1057 -0
  98. data/vendor/gems/thrift/lib/Makefile.am +55 -0
  99. data/vendor/gems/thrift/lib/cocoa/README +21 -0
  100. data/vendor/gems/thrift/lib/cocoa/src/TApplicationException.h +44 -0
  101. data/vendor/gems/thrift/lib/cocoa/src/TApplicationException.m +130 -0
  102. data/vendor/gems/thrift/lib/cocoa/src/TException.h +34 -0
  103. data/vendor/gems/thrift/lib/cocoa/src/TException.m +64 -0
  104. data/vendor/gems/thrift/lib/cocoa/src/TProcessor.h +29 -0
  105. data/vendor/gems/thrift/lib/cocoa/src/TProcessorFactory.h +27 -0
  106. data/vendor/gems/thrift/lib/cocoa/src/TSharedProcessorFactory.h +27 -0
  107. data/vendor/gems/thrift/lib/cocoa/src/TSharedProcessorFactory.m +51 -0
  108. data/vendor/gems/thrift/lib/cocoa/src/protocol/TBinaryProtocol.h +51 -0
  109. data/vendor/gems/thrift/lib/cocoa/src/protocol/TBinaryProtocol.m +477 -0
  110. data/vendor/gems/thrift/lib/cocoa/src/protocol/TProtocol.h +148 -0
  111. data/vendor/gems/thrift/lib/cocoa/src/protocol/TProtocolException.h +25 -0
  112. data/vendor/gems/thrift/lib/cocoa/src/protocol/TProtocolException.m +23 -0
  113. data/vendor/gems/thrift/lib/cocoa/src/protocol/TProtocolFactory.h +29 -0
  114. data/vendor/gems/thrift/lib/cocoa/src/protocol/TProtocolUtil.h +29 -0
  115. data/vendor/gems/thrift/lib/cocoa/src/protocol/TProtocolUtil.m +104 -0
  116. data/vendor/gems/thrift/lib/cocoa/src/server/TSocketServer.h +50 -0
  117. data/vendor/gems/thrift/lib/cocoa/src/server/TSocketServer.m +153 -0
  118. data/vendor/gems/thrift/lib/cocoa/src/transport/THTTPClient.h +42 -0
  119. data/vendor/gems/thrift/lib/cocoa/src/transport/THTTPClient.m +159 -0
  120. data/vendor/gems/thrift/lib/cocoa/src/transport/TNSFileHandleTransport.h +35 -0
  121. data/vendor/gems/thrift/lib/cocoa/src/transport/TNSFileHandleTransport.m +91 -0
  122. data/vendor/gems/thrift/lib/cocoa/src/transport/TNSStreamTransport.h +38 -0
  123. data/vendor/gems/thrift/lib/cocoa/src/transport/TNSStreamTransport.m +89 -0
  124. data/vendor/gems/thrift/lib/cocoa/src/transport/TSocketClient.h +32 -0
  125. data/vendor/gems/thrift/lib/cocoa/src/transport/TSocketClient.m +58 -0
  126. data/vendor/gems/thrift/lib/cocoa/src/transport/TTransport.h +36 -0
  127. data/vendor/gems/thrift/lib/cocoa/src/transport/TTransportException.h +30 -0
  128. data/vendor/gems/thrift/lib/cocoa/src/transport/TTransportException.m +43 -0
  129. data/vendor/gems/thrift/lib/cpp/Makefile.am +158 -0
  130. data/vendor/gems/thrift/lib/cpp/README +67 -0
  131. data/vendor/gems/thrift/lib/cpp/src/TLogging.h +163 -0
  132. data/vendor/gems/thrift/lib/cpp/src/TProcessor.h +53 -0
  133. data/vendor/gems/thrift/lib/cpp/src/TReflectionLocal.h +96 -0
  134. data/vendor/gems/thrift/lib/cpp/src/Thrift.cpp +148 -0
  135. data/vendor/gems/thrift/lib/cpp/src/Thrift.h +191 -0
  136. data/vendor/gems/thrift/lib/cpp/src/concurrency/Exception.h +60 -0
  137. data/vendor/gems/thrift/lib/cpp/src/concurrency/FunctionRunner.h +77 -0
  138. data/vendor/gems/thrift/lib/cpp/src/concurrency/Monitor.cpp +137 -0
  139. data/vendor/gems/thrift/lib/cpp/src/concurrency/Monitor.h +84 -0
  140. data/vendor/gems/thrift/lib/cpp/src/concurrency/Mutex.cpp +160 -0
  141. data/vendor/gems/thrift/lib/cpp/src/concurrency/Mutex.h +114 -0
  142. data/vendor/gems/thrift/lib/cpp/src/concurrency/PosixThreadFactory.cpp +314 -0
  143. data/vendor/gems/thrift/lib/cpp/src/concurrency/PosixThreadFactory.h +130 -0
  144. data/vendor/gems/thrift/lib/cpp/src/concurrency/Thread.h +125 -0
  145. data/vendor/gems/thrift/lib/cpp/src/concurrency/ThreadManager.cpp +493 -0
  146. data/vendor/gems/thrift/lib/cpp/src/concurrency/ThreadManager.h +169 -0
  147. data/vendor/gems/thrift/lib/cpp/src/concurrency/TimerManager.cpp +284 -0
  148. data/vendor/gems/thrift/lib/cpp/src/concurrency/TimerManager.h +122 -0
  149. data/vendor/gems/thrift/lib/cpp/src/concurrency/Util.cpp +55 -0
  150. data/vendor/gems/thrift/lib/cpp/src/concurrency/Util.h +100 -0
  151. data/vendor/gems/thrift/lib/cpp/src/concurrency/test/Tests.cpp +155 -0
  152. data/vendor/gems/thrift/lib/cpp/src/concurrency/test/ThreadFactoryTests.h +354 -0
  153. data/vendor/gems/thrift/lib/cpp/src/concurrency/test/ThreadManagerTests.h +379 -0
  154. data/vendor/gems/thrift/lib/cpp/src/concurrency/test/TimerManagerTests.h +155 -0
  155. data/vendor/gems/thrift/lib/cpp/src/processor/PeekProcessor.cpp +122 -0
  156. data/vendor/gems/thrift/lib/cpp/src/processor/PeekProcessor.h +77 -0
  157. data/vendor/gems/thrift/lib/cpp/src/processor/StatsProcessor.h +264 -0
  158. data/vendor/gems/thrift/lib/cpp/src/protocol/TBase64Utils.cpp +79 -0
  159. data/vendor/gems/thrift/lib/cpp/src/protocol/TBase64Utils.h +42 -0
  160. data/vendor/gems/thrift/lib/cpp/src/protocol/TBinaryProtocol.cpp +394 -0
  161. data/vendor/gems/thrift/lib/cpp/src/protocol/TBinaryProtocol.h +254 -0
  162. data/vendor/gems/thrift/lib/cpp/src/protocol/TCompactProtocol.cpp +736 -0
  163. data/vendor/gems/thrift/lib/cpp/src/protocol/TCompactProtocol.h +279 -0
  164. data/vendor/gems/thrift/lib/cpp/src/protocol/TDebugProtocol.cpp +346 -0
  165. data/vendor/gems/thrift/lib/cpp/src/protocol/TDebugProtocol.h +225 -0
  166. data/vendor/gems/thrift/lib/cpp/src/protocol/TDenseProtocol.cpp +762 -0
  167. data/vendor/gems/thrift/lib/cpp/src/protocol/TDenseProtocol.h +253 -0
  168. data/vendor/gems/thrift/lib/cpp/src/protocol/TJSONProtocol.cpp +998 -0
  169. data/vendor/gems/thrift/lib/cpp/src/protocol/TJSONProtocol.h +340 -0
  170. data/vendor/gems/thrift/lib/cpp/src/protocol/TOneWayProtocol.h +304 -0
  171. data/vendor/gems/thrift/lib/cpp/src/protocol/TProtocol.h +438 -0
  172. data/vendor/gems/thrift/lib/cpp/src/protocol/TProtocolException.h +104 -0
  173. data/vendor/gems/thrift/lib/cpp/src/protocol/TProtocolTap.h +187 -0
  174. data/vendor/gems/thrift/lib/cpp/src/server/TNonblockingServer.cpp +750 -0
  175. data/vendor/gems/thrift/lib/cpp/src/server/TNonblockingServer.h +435 -0
  176. data/vendor/gems/thrift/lib/cpp/src/server/TServer.cpp +38 -0
  177. data/vendor/gems/thrift/lib/cpp/src/server/TServer.h +213 -0
  178. data/vendor/gems/thrift/lib/cpp/src/server/TSimpleServer.cpp +118 -0
  179. data/vendor/gems/thrift/lib/cpp/src/server/TSimpleServer.h +70 -0
  180. data/vendor/gems/thrift/lib/cpp/src/server/TThreadPoolServer.cpp +217 -0
  181. data/vendor/gems/thrift/lib/cpp/src/server/TThreadPoolServer.h +79 -0
  182. data/vendor/gems/thrift/lib/cpp/src/server/TThreadedServer.cpp +243 -0
  183. data/vendor/gems/thrift/lib/cpp/src/server/TThreadedServer.h +74 -0
  184. data/vendor/gems/thrift/lib/cpp/src/transport/TBufferTransports.cpp +370 -0
  185. data/vendor/gems/thrift/lib/cpp/src/transport/TBufferTransports.h +667 -0
  186. data/vendor/gems/thrift/lib/cpp/src/transport/TFDTransport.cpp +77 -0
  187. data/vendor/gems/thrift/lib/cpp/src/transport/TFDTransport.h +73 -0
  188. data/vendor/gems/thrift/lib/cpp/src/transport/TFileTransport.cpp +953 -0
  189. data/vendor/gems/thrift/lib/cpp/src/transport/TFileTransport.h +442 -0
  190. data/vendor/gems/thrift/lib/cpp/src/transport/THttpClient.cpp +348 -0
  191. data/vendor/gems/thrift/lib/cpp/src/transport/THttpClient.h +111 -0
  192. data/vendor/gems/thrift/lib/cpp/src/transport/TServerSocket.cpp +368 -0
  193. data/vendor/gems/thrift/lib/cpp/src/transport/TServerSocket.h +76 -0
  194. data/vendor/gems/thrift/lib/cpp/src/transport/TServerTransport.h +92 -0
  195. data/vendor/gems/thrift/lib/cpp/src/transport/TShortReadTransport.h +96 -0
  196. data/vendor/gems/thrift/lib/cpp/src/transport/TSimpleFileTransport.cpp +54 -0
  197. data/vendor/gems/thrift/lib/cpp/src/transport/TSimpleFileTransport.h +41 -0
  198. data/vendor/gems/thrift/lib/cpp/src/transport/TSocket.cpp +591 -0
  199. data/vendor/gems/thrift/lib/cpp/src/transport/TSocket.h +242 -0
  200. data/vendor/gems/thrift/lib/cpp/src/transport/TSocketPool.cpp +235 -0
  201. data/vendor/gems/thrift/lib/cpp/src/transport/TSocketPool.h +191 -0
  202. data/vendor/gems/thrift/lib/cpp/src/transport/TTransport.h +224 -0
  203. data/vendor/gems/thrift/lib/cpp/src/transport/TTransportException.cpp +31 -0
  204. data/vendor/gems/thrift/lib/cpp/src/transport/TTransportException.h +117 -0
  205. data/vendor/gems/thrift/lib/cpp/src/transport/TTransportUtils.cpp +178 -0
  206. data/vendor/gems/thrift/lib/cpp/src/transport/TTransportUtils.h +287 -0
  207. data/vendor/gems/thrift/lib/cpp/src/transport/TZlibTransport.cpp +299 -0
  208. data/vendor/gems/thrift/lib/cpp/src/transport/TZlibTransport.h +219 -0
  209. data/vendor/gems/thrift/lib/cpp/thrift-nb.pc.in +30 -0
  210. data/vendor/gems/thrift/lib/cpp/thrift-z.pc.in +30 -0
  211. data/vendor/gems/thrift/lib/cpp/thrift.pc.in +29 -0
  212. data/vendor/gems/thrift/lib/csharp/Makefile.am +70 -0
  213. data/vendor/gems/thrift/lib/csharp/README +26 -0
  214. data/vendor/gems/thrift/lib/csharp/ThriftMSBuildTask/Properties/AssemblyInfo.cs +55 -0
  215. data/vendor/gems/thrift/lib/csharp/ThriftMSBuildTask/ThriftBuild.cs +242 -0
  216. data/vendor/gems/thrift/lib/csharp/ThriftMSBuildTask/ThriftMSBuildTask.csproj +62 -0
  217. data/vendor/gems/thrift/lib/csharp/src/Collections/THashSet.cs +142 -0
  218. data/vendor/gems/thrift/lib/csharp/src/Protocol/TBase.cs +34 -0
  219. data/vendor/gems/thrift/lib/csharp/src/Protocol/TBinaryProtocol.cs +392 -0
  220. data/vendor/gems/thrift/lib/csharp/src/Protocol/TField.cs +58 -0
  221. data/vendor/gems/thrift/lib/csharp/src/Protocol/TList.cs +50 -0
  222. data/vendor/gems/thrift/lib/csharp/src/Protocol/TMap.cs +58 -0
  223. data/vendor/gems/thrift/lib/csharp/src/Protocol/TMessage.cs +58 -0
  224. data/vendor/gems/thrift/lib/csharp/src/Protocol/TMessageType.cs +31 -0
  225. data/vendor/gems/thrift/lib/csharp/src/Protocol/TProtocol.cs +87 -0
  226. data/vendor/gems/thrift/lib/csharp/src/Protocol/TProtocolException.cs +61 -0
  227. data/vendor/gems/thrift/lib/csharp/src/Protocol/TProtocolFactory.cs +29 -0
  228. data/vendor/gems/thrift/lib/csharp/src/Protocol/TProtocolUtil.cs +94 -0
  229. data/vendor/gems/thrift/lib/csharp/src/Protocol/TSet.cs +50 -0
  230. data/vendor/gems/thrift/lib/csharp/src/Protocol/TStruct.cs +42 -0
  231. data/vendor/gems/thrift/lib/csharp/src/Protocol/TType.cs +40 -0
  232. data/vendor/gems/thrift/lib/csharp/src/Server/TServer.cs +135 -0
  233. data/vendor/gems/thrift/lib/csharp/src/Server/TSimpleServer.cs +148 -0
  234. data/vendor/gems/thrift/lib/csharp/src/Server/TThreadPoolServer.cs +186 -0
  235. data/vendor/gems/thrift/lib/csharp/src/Server/TThreadedServer.cs +234 -0
  236. data/vendor/gems/thrift/lib/csharp/src/TApplicationException.cs +131 -0
  237. data/vendor/gems/thrift/lib/csharp/src/TProcessor.cs +29 -0
  238. data/vendor/gems/thrift/lib/csharp/src/Thrift.csproj +73 -0
  239. data/vendor/gems/thrift/lib/csharp/src/Thrift.sln +35 -0
  240. data/vendor/gems/thrift/lib/csharp/src/Transport/TBufferedTransport.cs +100 -0
  241. data/vendor/gems/thrift/lib/csharp/src/Transport/TServerSocket.cs +157 -0
  242. data/vendor/gems/thrift/lib/csharp/src/Transport/TServerTransport.cs +39 -0
  243. data/vendor/gems/thrift/lib/csharp/src/Transport/TSocket.cs +144 -0
  244. data/vendor/gems/thrift/lib/csharp/src/Transport/TStreamTransport.cs +103 -0
  245. data/vendor/gems/thrift/lib/csharp/src/Transport/TTransport.cs +66 -0
  246. data/vendor/gems/thrift/lib/csharp/src/Transport/TTransportException.cs +64 -0
  247. data/vendor/gems/thrift/lib/csharp/src/Transport/TTransportFactory.cs +38 -0
  248. data/vendor/gems/thrift/lib/erl/Makefile +37 -0
  249. data/vendor/gems/thrift/lib/erl/README +56 -0
  250. data/vendor/gems/thrift/lib/erl/build/beamver +59 -0
  251. data/vendor/gems/thrift/lib/erl/build/buildtargets.mk +15 -0
  252. data/vendor/gems/thrift/lib/erl/build/colors.mk +24 -0
  253. data/vendor/gems/thrift/lib/erl/build/docs.mk +12 -0
  254. data/vendor/gems/thrift/lib/erl/build/mime.types +98 -0
  255. data/vendor/gems/thrift/lib/erl/build/otp.mk +146 -0
  256. data/vendor/gems/thrift/lib/erl/build/otp_subdir.mk +85 -0
  257. data/vendor/gems/thrift/lib/erl/build/raw_test.mk +29 -0
  258. data/vendor/gems/thrift/lib/erl/include/thrift_constants.hrl +54 -0
  259. data/vendor/gems/thrift/lib/erl/include/thrift_protocol.hrl +31 -0
  260. data/vendor/gems/thrift/lib/erl/src/Makefile +116 -0
  261. data/vendor/gems/thrift/lib/erl/src/test_handler.erl +26 -0
  262. data/vendor/gems/thrift/lib/erl/src/test_service.erl +29 -0
  263. data/vendor/gems/thrift/lib/erl/src/thrift.app.src +44 -0
  264. data/vendor/gems/thrift/lib/erl/src/thrift.appup.src +1 -0
  265. data/vendor/gems/thrift/lib/erl/src/thrift_base64_transport.erl +64 -0
  266. data/vendor/gems/thrift/lib/erl/src/thrift_binary_protocol.erl +325 -0
  267. data/vendor/gems/thrift/lib/erl/src/thrift_buffered_transport.erl +180 -0
  268. data/vendor/gems/thrift/lib/erl/src/thrift_client.erl +384 -0
  269. data/vendor/gems/thrift/lib/erl/src/thrift_disk_log_transport.erl +118 -0
  270. data/vendor/gems/thrift/lib/erl/src/thrift_file_transport.erl +87 -0
  271. data/vendor/gems/thrift/lib/erl/src/thrift_framed_transport.erl +208 -0
  272. data/vendor/gems/thrift/lib/erl/src/thrift_http_transport.erl +199 -0
  273. data/vendor/gems/thrift/lib/erl/src/thrift_memory_buffer.erl +164 -0
  274. data/vendor/gems/thrift/lib/erl/src/thrift_processor.erl +188 -0
  275. data/vendor/gems/thrift/lib/erl/src/thrift_protocol.erl +356 -0
  276. data/vendor/gems/thrift/lib/erl/src/thrift_server.erl +183 -0
  277. data/vendor/gems/thrift/lib/erl/src/thrift_service.erl +25 -0
  278. data/vendor/gems/thrift/lib/erl/src/thrift_socket_server.erl +249 -0
  279. data/vendor/gems/thrift/lib/erl/src/thrift_socket_transport.erl +119 -0
  280. data/vendor/gems/thrift/lib/erl/src/thrift_transport.erl +57 -0
  281. data/vendor/gems/thrift/lib/erl/vsn.mk +1 -0
  282. data/vendor/gems/thrift/lib/hs/README +82 -0
  283. data/vendor/gems/thrift/lib/hs/Setup.lhs +23 -0
  284. data/vendor/gems/thrift/lib/hs/TODO +2 -0
  285. data/vendor/gems/thrift/lib/hs/Thrift.cabal +20 -0
  286. data/vendor/gems/thrift/lib/hs/src/Thrift.hs +111 -0
  287. data/vendor/gems/thrift/lib/hs/src/Thrift/Protocol.hs +191 -0
  288. data/vendor/gems/thrift/lib/hs/src/Thrift/Protocol/Binary.hs +147 -0
  289. data/vendor/gems/thrift/lib/hs/src/Thrift/Server.hs +65 -0
  290. data/vendor/gems/thrift/lib/hs/src/Thrift/Transport.hs +60 -0
  291. data/vendor/gems/thrift/lib/hs/src/Thrift/Transport/Handle.hs +58 -0
  292. data/vendor/gems/thrift/lib/java/Makefile.am +38 -0
  293. data/vendor/gems/thrift/lib/java/README +43 -0
  294. data/vendor/gems/thrift/lib/java/build.xml +195 -0
  295. data/vendor/gems/thrift/lib/java/ivy.xml +8 -0
  296. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/IntRangeSet.java +171 -0
  297. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TApplicationException.java +123 -0
  298. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TBase.java +66 -0
  299. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TBaseHelper.java +102 -0
  300. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TByteArrayOutputStream.java +46 -0
  301. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TDeserializer.java +94 -0
  302. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TException.java +45 -0
  303. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TFieldRequirementType.java +30 -0
  304. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TProcessor.java +32 -0
  305. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TProcessorFactory.java +39 -0
  306. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/TSerializer.java +110 -0
  307. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/meta_data/FieldMetaData.java +69 -0
  308. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/meta_data/FieldValueMetaData.java +42 -0
  309. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/meta_data/ListMetaData.java +29 -0
  310. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/meta_data/MapMetaData.java +31 -0
  311. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/meta_data/SetMetaData.java +29 -0
  312. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/meta_data/StructMetaData.java +31 -0
  313. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TBase64Utils.java +128 -0
  314. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java +331 -0
  315. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java +741 -0
  316. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TField.java +48 -0
  317. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TJSONProtocol.java +927 -0
  318. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TList.java +38 -0
  319. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TMap.java +40 -0
  320. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TMessage.java +48 -0
  321. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TMessageType.java +31 -0
  322. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TProtocol.java +146 -0
  323. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TProtocolException.java +81 -0
  324. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TProtocolFactory.java +30 -0
  325. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TProtocolUtil.java +158 -0
  326. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TSet.java +42 -0
  327. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TSimpleJSONProtocol.java +384 -0
  328. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TStruct.java +36 -0
  329. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/protocol/TType.java +40 -0
  330. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/server/THsHaServer.java +304 -0
  331. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/server/TNonblockingServer.java +772 -0
  332. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/server/TServer.java +126 -0
  333. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/server/TSimpleServer.java +145 -0
  334. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/server/TThreadPoolServer.java +271 -0
  335. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/TFramedTransport.java +126 -0
  336. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/THttpClient.java +157 -0
  337. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java +159 -0
  338. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/TMemoryBuffer.java +98 -0
  339. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java +160 -0
  340. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/TNonblockingServerTransport.java +31 -0
  341. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/TNonblockingSocket.java +213 -0
  342. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/TNonblockingTransport.java +31 -0
  343. data/vendor/gems/thrift/lib/java/src/org/apache/thrift/transport/TServerSocket.java +145 -0
  344. metadata +348 -37
  345. data/vendor/gems/trollop/FAQ.txt +0 -35
  346. data/vendor/gems/trollop/History.txt +0 -84
  347. data/vendor/gems/trollop/Manifest.txt +0 -7
  348. data/vendor/gems/trollop/README.txt +0 -38
  349. data/vendor/gems/trollop/Rakefile +0 -36
  350. data/vendor/gems/trollop/lib/trollop.rb +0 -695
  351. data/vendor/gems/trollop/release-script.txt +0 -13
  352. data/vendor/gems/trollop/test/test_trollop.rb +0 -957
  353. data/vendor/gems/trollop/www/index.html +0 -167
@@ -0,0 +1,741 @@
1
+ /*
2
+ * Licensed to the Apache Software Foundation (ASF) under one
3
+ * or more contributor license agreements. See the NOTICE file
4
+ * distributed with this work for additional information
5
+ * regarding copyright ownership. The ASF licenses this file
6
+ * to you under the Apache License, Version 2.0 (the
7
+ * "License"); you may not use this file except in compliance
8
+ * with the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+
21
+ package org.apache.thrift.protocol;
22
+
23
+ import java.util.Stack;
24
+ import java.io.UnsupportedEncodingException;
25
+
26
+ import org.apache.thrift.transport.TTransport;
27
+ import org.apache.thrift.TException;
28
+
29
+ /**
30
+ * TCompactProtocol2 is the Java implementation of the compact protocol specified
31
+ * in THRIFT-110. The fundamental approach to reducing the overhead of
32
+ * structures is a) use variable-length integers all over the place and b) make
33
+ * use of unused bits wherever possible. Your savings will obviously vary
34
+ * based on the specific makeup of your structs, but in general, the more
35
+ * fields, nested structures, short strings and collections, and low-value i32
36
+ * and i64 fields you have, the more benefit you'll see.
37
+ */
38
+ public final class TCompactProtocol extends TProtocol {
39
+
40
+ private final static TStruct ANONYMOUS_STRUCT = new TStruct("");
41
+ private final static TField TSTOP = new TField("", TType.STOP, (short)0);
42
+
43
+ private final static byte[] ttypeToCompactType = new byte[16];
44
+
45
+ static {
46
+ ttypeToCompactType[TType.STOP] = TType.STOP;
47
+ ttypeToCompactType[TType.BOOL] = Types.BOOLEAN_TRUE;
48
+ ttypeToCompactType[TType.BYTE] = Types.BYTE;
49
+ ttypeToCompactType[TType.I16] = Types.I16;
50
+ ttypeToCompactType[TType.I32] = Types.I32;
51
+ ttypeToCompactType[TType.I64] = Types.I64;
52
+ ttypeToCompactType[TType.DOUBLE] = Types.DOUBLE;
53
+ ttypeToCompactType[TType.STRING] = Types.BINARY;
54
+ ttypeToCompactType[TType.LIST] = Types.LIST;
55
+ ttypeToCompactType[TType.SET] = Types.SET;
56
+ ttypeToCompactType[TType.MAP] = Types.MAP;
57
+ ttypeToCompactType[TType.STRUCT] = Types.STRUCT;
58
+ }
59
+
60
+ /**
61
+ * TProtocolFactory that produces TCompactProtocols.
62
+ */
63
+ public static class Factory implements TProtocolFactory {
64
+ public Factory() {}
65
+
66
+ public TProtocol getProtocol(TTransport trans) {
67
+ return new TCompactProtocol(trans);
68
+ }
69
+ }
70
+
71
+ private static final byte PROTOCOL_ID = (byte)0x82;
72
+ private static final byte VERSION = 1;
73
+ private static final byte VERSION_MASK = 0x1f; // 0001 1111
74
+ private static final byte TYPE_MASK = (byte)0xE0; // 1110 0000
75
+ private static final int TYPE_SHIFT_AMOUNT = 5;
76
+
77
+ /**
78
+ * All of the on-wire type codes.
79
+ */
80
+ private static class Types {
81
+ public static final byte BOOLEAN_TRUE = 0x01;
82
+ public static final byte BOOLEAN_FALSE = 0x02;
83
+ public static final byte BYTE = 0x03;
84
+ public static final byte I16 = 0x04;
85
+ public static final byte I32 = 0x05;
86
+ public static final byte I64 = 0x06;
87
+ public static final byte DOUBLE = 0x07;
88
+ public static final byte BINARY = 0x08;
89
+ public static final byte LIST = 0x09;
90
+ public static final byte SET = 0x0A;
91
+ public static final byte MAP = 0x0B;
92
+ public static final byte STRUCT = 0x0C;
93
+ }
94
+
95
+ /**
96
+ * Used to keep track of the last field for the current and previous structs,
97
+ * so we can do the delta stuff.
98
+ */
99
+ private Stack<Short> lastField_ = new Stack<Short>();
100
+
101
+ private short lastFieldId_ = 0;
102
+
103
+ /**
104
+ * If we encounter a boolean field begin, save the TField here so it can
105
+ * have the value incorporated.
106
+ */
107
+ private TField booleanField_ = null;
108
+
109
+ /**
110
+ * If we read a field header, and it's a boolean field, save the boolean
111
+ * value here so that readBool can use it.
112
+ */
113
+ private Boolean boolValue_ = null;
114
+
115
+ /**
116
+ * Create a TCompactProtocol.
117
+ *
118
+ * @param transport the TTransport object to read from or write to.
119
+ */
120
+ public TCompactProtocol(TTransport transport) {
121
+ super(transport);
122
+ }
123
+
124
+
125
+ //
126
+ // Public Writing methods.
127
+ //
128
+
129
+ /**
130
+ * Write a message header to the wire. Compact Protocol messages contain the
131
+ * protocol version so we can migrate forwards in the future if need be.
132
+ */
133
+ public void writeMessageBegin(TMessage message) throws TException {
134
+ writeByteDirect(PROTOCOL_ID);
135
+ writeByteDirect((VERSION & VERSION_MASK) | ((message.type << TYPE_SHIFT_AMOUNT) & TYPE_MASK));
136
+ writeVarint32(message.seqid);
137
+ writeString(message.name);
138
+ }
139
+
140
+ /**
141
+ * Write a struct begin. This doesn't actually put anything on the wire. We
142
+ * use it as an opportunity to put special placeholder markers on the field
143
+ * stack so we can get the field id deltas correct.
144
+ */
145
+ public void writeStructBegin(TStruct struct) throws TException {
146
+ lastField_.push(lastFieldId_);
147
+ lastFieldId_ = 0;
148
+ }
149
+
150
+ /**
151
+ * Write a struct end. This doesn't actually put anything on the wire. We use
152
+ * this as an opportunity to pop the last field from the current struct off
153
+ * of the field stack.
154
+ */
155
+ public void writeStructEnd() throws TException {
156
+ lastFieldId_ = lastField_.pop();
157
+ }
158
+
159
+ /**
160
+ * Write a field header containing the field id and field type. If the
161
+ * difference between the current field id and the last one is small (< 15),
162
+ * then the field id will be encoded in the 4 MSB as a delta. Otherwise, the
163
+ * field id will follow the type header as a zigzag varint.
164
+ */
165
+ public void writeFieldBegin(TField field) throws TException {
166
+ if (field.type == TType.BOOL) {
167
+ // we want to possibly include the value, so we'll wait.
168
+ booleanField_ = field;
169
+ } else {
170
+ writeFieldBeginInternal(field, (byte)-1);
171
+ }
172
+ }
173
+
174
+ /**
175
+ * The workhorse of writeFieldBegin. It has the option of doing a
176
+ * 'type override' of the type header. This is used specifically in the
177
+ * boolean field case.
178
+ */
179
+ private void writeFieldBeginInternal(TField field, byte typeOverride) throws TException {
180
+ // short lastField = lastField_.pop();
181
+
182
+ // if there's a type override, use that.
183
+ byte typeToWrite = typeOverride == -1 ? getCompactType(field.type) : typeOverride;
184
+
185
+ // check if we can use delta encoding for the field id
186
+ if (field.id > lastFieldId_ && field.id - lastFieldId_ <= 15) {
187
+ // write them together
188
+ writeByteDirect((field.id - lastFieldId_) << 4 | typeToWrite);
189
+ } else {
190
+ // write them separate
191
+ writeByteDirect(typeToWrite);
192
+ writeI16(field.id);
193
+ }
194
+
195
+ lastFieldId_ = field.id;
196
+ // lastField_.push(field.id);
197
+ }
198
+
199
+ /**
200
+ * Write the STOP symbol so we know there are no more fields in this struct.
201
+ */
202
+ public void writeFieldStop() throws TException {
203
+ writeByteDirect(TType.STOP);
204
+ }
205
+
206
+ /**
207
+ * Write a map header. If the map is empty, omit the key and value type
208
+ * headers, as we don't need any additional information to skip it.
209
+ */
210
+ public void writeMapBegin(TMap map) throws TException {
211
+ if (map.size == 0) {
212
+ writeByteDirect(0);
213
+ } else {
214
+ writeVarint32(map.size);
215
+ writeByteDirect(getCompactType(map.keyType) << 4 | getCompactType(map.valueType));
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Write a list header.
221
+ */
222
+ public void writeListBegin(TList list) throws TException {
223
+ writeCollectionBegin(list.elemType, list.size);
224
+ }
225
+
226
+ /**
227
+ * Write a set header.
228
+ */
229
+ public void writeSetBegin(TSet set) throws TException {
230
+ writeCollectionBegin(set.elemType, set.size);
231
+ }
232
+
233
+ /**
234
+ * Write a boolean value. Potentially, this could be a boolean field, in
235
+ * which case the field header info isn't written yet. If so, decide what the
236
+ * right type header is for the value and then write the field header.
237
+ * Otherwise, write a single byte.
238
+ */
239
+ public void writeBool(boolean b) throws TException {
240
+ if (booleanField_ != null) {
241
+ // we haven't written the field header yet
242
+ writeFieldBeginInternal(booleanField_, b ? Types.BOOLEAN_TRUE : Types.BOOLEAN_FALSE);
243
+ booleanField_ = null;
244
+ } else {
245
+ // we're not part of a field, so just write the value.
246
+ writeByteDirect(b ? Types.BOOLEAN_TRUE : Types.BOOLEAN_FALSE);
247
+ }
248
+ }
249
+
250
+ /**
251
+ * Write a byte. Nothing to see here!
252
+ */
253
+ public void writeByte(byte b) throws TException {
254
+ writeByteDirect(b);
255
+ }
256
+
257
+ /**
258
+ * Write an I16 as a zigzag varint.
259
+ */
260
+ public void writeI16(short i16) throws TException {
261
+ writeVarint32(intToZigZag(i16));
262
+ }
263
+
264
+ /**
265
+ * Write an i32 as a zigzag varint.
266
+ */
267
+ public void writeI32(int i32) throws TException {
268
+ writeVarint32(intToZigZag(i32));
269
+ }
270
+
271
+ /**
272
+ * Write an i64 as a zigzag varint.
273
+ */
274
+ public void writeI64(long i64) throws TException {
275
+ writeVarint64(longToZigzag(i64));
276
+ }
277
+
278
+ /**
279
+ * Write a double to the wire as 8 bytes.
280
+ */
281
+ public void writeDouble(double dub) throws TException {
282
+ byte[] data = new byte[]{0, 0, 0, 0, 0, 0, 0, 0};
283
+ fixedLongToBytes(Double.doubleToLongBits(dub), data, 0);
284
+ trans_.write(data);
285
+ }
286
+
287
+ /**
288
+ * Write a string to the wire with a varint size preceeding.
289
+ */
290
+ public void writeString(String str) throws TException {
291
+ try {
292
+ writeBinary(str.getBytes("UTF-8"));
293
+ } catch (UnsupportedEncodingException e) {
294
+ throw new TException("UTF-8 not supported!");
295
+ }
296
+ }
297
+
298
+ /**
299
+ * Write a byte array, using a varint for the size.
300
+ */
301
+ public void writeBinary(byte[] bin) throws TException {
302
+ writeVarint32(bin.length);
303
+ trans_.write(bin);
304
+ }
305
+
306
+ //
307
+ // These methods are called by structs, but don't actually have any wire
308
+ // output or purpose.
309
+ //
310
+
311
+ public void writeMessageEnd() throws TException {}
312
+ public void writeMapEnd() throws TException {}
313
+ public void writeListEnd() throws TException {}
314
+ public void writeSetEnd() throws TException {}
315
+ public void writeFieldEnd() throws TException {}
316
+
317
+ //
318
+ // Internal writing methods
319
+ //
320
+
321
+ /**
322
+ * Abstract method for writing the start of lists and sets. List and sets on
323
+ * the wire differ only by the type indicator.
324
+ */
325
+ protected void writeCollectionBegin(byte elemType, int size) throws TException {
326
+ if (size <= 14) {
327
+ writeByteDirect(size << 4 | getCompactType(elemType));
328
+ } else {
329
+ writeByteDirect(0xf0 | getCompactType(elemType));
330
+ writeVarint32(size);
331
+ }
332
+ }
333
+
334
+ /**
335
+ * Write an i32 as a varint. Results in 1-5 bytes on the wire.
336
+ * TODO: make a permanent buffer like writeVarint64?
337
+ */
338
+ byte[] i32buf = new byte[5];
339
+ private void writeVarint32(int n) throws TException {
340
+ int idx = 0;
341
+ while (true) {
342
+ if ((n & ~0x7F) == 0) {
343
+ i32buf[idx++] = (byte)n;
344
+ // writeByteDirect((byte)n);
345
+ break;
346
+ // return;
347
+ } else {
348
+ i32buf[idx++] = (byte)((n & 0x7F) | 0x80);
349
+ // writeByteDirect((byte)((n & 0x7F) | 0x80));
350
+ n >>>= 7;
351
+ }
352
+ }
353
+ trans_.write(i32buf, 0, idx);
354
+ }
355
+
356
+ /**
357
+ * Write an i64 as a varint. Results in 1-10 bytes on the wire.
358
+ */
359
+ byte[] varint64out = new byte[10];
360
+ private void writeVarint64(long n) throws TException {
361
+ int idx = 0;
362
+ while (true) {
363
+ if ((n & ~0x7FL) == 0) {
364
+ varint64out[idx++] = (byte)n;
365
+ break;
366
+ } else {
367
+ varint64out[idx++] = ((byte)((n & 0x7F) | 0x80));
368
+ n >>>= 7;
369
+ }
370
+ }
371
+ trans_.write(varint64out, 0, idx);
372
+ }
373
+
374
+ /**
375
+ * Convert l into a zigzag long. This allows negative numbers to be
376
+ * represented compactly as a varint.
377
+ */
378
+ private long longToZigzag(long l) {
379
+ return (l << 1) ^ (l >> 63);
380
+ }
381
+
382
+ /**
383
+ * Convert n into a zigzag int. This allows negative numbers to be
384
+ * represented compactly as a varint.
385
+ */
386
+ private int intToZigZag(int n) {
387
+ return (n << 1) ^ (n >> 31);
388
+ }
389
+
390
+ /**
391
+ * Convert a long into little-endian bytes in buf starting at off and going
392
+ * until off+7.
393
+ */
394
+ private void fixedLongToBytes(long n, byte[] buf, int off) {
395
+ buf[off+0] = (byte)( n & 0xff);
396
+ buf[off+1] = (byte)((n >> 8 ) & 0xff);
397
+ buf[off+2] = (byte)((n >> 16) & 0xff);
398
+ buf[off+3] = (byte)((n >> 24) & 0xff);
399
+ buf[off+4] = (byte)((n >> 32) & 0xff);
400
+ buf[off+5] = (byte)((n >> 40) & 0xff);
401
+ buf[off+6] = (byte)((n >> 48) & 0xff);
402
+ buf[off+7] = (byte)((n >> 56) & 0xff);
403
+ }
404
+
405
+ /**
406
+ * Writes a byte without any possiblity of all that field header nonsense.
407
+ * Used internally by other writing methods that know they need to write a byte.
408
+ */
409
+ private byte[] byteDirectBuffer = new byte[1];
410
+ private void writeByteDirect(byte b) throws TException {
411
+ byteDirectBuffer[0] = b;
412
+ trans_.write(byteDirectBuffer);
413
+ }
414
+
415
+ /**
416
+ * Writes a byte without any possiblity of all that field header nonsense.
417
+ */
418
+ private void writeByteDirect(int n) throws TException {
419
+ writeByteDirect((byte)n);
420
+ }
421
+
422
+
423
+ //
424
+ // Reading methods.
425
+ //
426
+
427
+ /**
428
+ * Read a message header.
429
+ */
430
+ public TMessage readMessageBegin() throws TException {
431
+ byte protocolId = readByte();
432
+ if (protocolId != PROTOCOL_ID) {
433
+ throw new TProtocolException("Expected protocol id " + Integer.toHexString(PROTOCOL_ID) + " but got " + Integer.toHexString(protocolId));
434
+ }
435
+ byte versionAndType = readByte();
436
+ byte version = (byte)(versionAndType & VERSION_MASK);
437
+ if (version != VERSION) {
438
+ throw new TProtocolException("Expected version " + VERSION + " but got " + version);
439
+ }
440
+ byte type = (byte)((versionAndType >> TYPE_SHIFT_AMOUNT) & 0x03);
441
+ int seqid = readVarint32();
442
+ String messageName = readString();
443
+ return new TMessage(messageName, type, seqid);
444
+ }
445
+
446
+ /**
447
+ * Read a struct begin. There's nothing on the wire for this, but it is our
448
+ * opportunity to push a new struct begin marker onto the field stack.
449
+ */
450
+ public TStruct readStructBegin() throws TException {
451
+ lastField_.push(lastFieldId_);
452
+ lastFieldId_ = 0;
453
+ return ANONYMOUS_STRUCT;
454
+ }
455
+
456
+ /**
457
+ * Doesn't actually consume any wire data, just removes the last field for
458
+ * this struct from the field stack.
459
+ */
460
+ public void readStructEnd() throws TException {
461
+ // consume the last field we read off the wire.
462
+ lastFieldId_ = lastField_.pop();
463
+ }
464
+
465
+ /**
466
+ * Read a field header off the wire.
467
+ */
468
+ public TField readFieldBegin() throws TException {
469
+ byte type = readByte();
470
+
471
+ // if it's a stop, then we can return immediately, as the struct is over.
472
+ if ((type & 0x0f) == TType.STOP) {
473
+ return TSTOP;
474
+ }
475
+
476
+ short fieldId;
477
+
478
+ // mask off the 4 MSB of the type header. it could contain a field id delta.
479
+ short modifier = (short)((type & 0xf0) >> 4);
480
+ if (modifier == 0) {
481
+ // not a delta. look ahead for the zigzag varint field id.
482
+ fieldId = readI16();
483
+ } else {
484
+ // has a delta. add the delta to the last read field id.
485
+ fieldId = (short)(lastFieldId_ + modifier);
486
+ }
487
+
488
+ TField field = new TField("", getTType((byte)(type & 0x0f)), fieldId);
489
+
490
+ // if this happens to be a boolean field, the value is encoded in the type
491
+ if (isBoolType(type)) {
492
+ // save the boolean value in a special instance variable.
493
+ boolValue_ = (byte)(type & 0x0f) == Types.BOOLEAN_TRUE ? Boolean.TRUE : Boolean.FALSE;
494
+ }
495
+
496
+ // push the new field onto the field stack so we can keep the deltas going.
497
+ lastFieldId_ = field.id;
498
+ return field;
499
+ }
500
+
501
+ /**
502
+ * Read a map header off the wire. If the size is zero, skip reading the key
503
+ * and value type. This means that 0-length maps will yield TMaps without the
504
+ * "correct" types.
505
+ */
506
+ public TMap readMapBegin() throws TException {
507
+ int size = readVarint32();
508
+ byte keyAndValueType = size == 0 ? 0 : readByte();
509
+ return new TMap(getTType((byte)(keyAndValueType >> 4)), getTType((byte)(keyAndValueType & 0xf)), size);
510
+ }
511
+
512
+ /**
513
+ * Read a list header off the wire. If the list size is 0-14, the size will
514
+ * be packed into the element type header. If it's a longer list, the 4 MSB
515
+ * of the element type header will be 0xF, and a varint will follow with the
516
+ * true size.
517
+ */
518
+ public TList readListBegin() throws TException {
519
+ byte size_and_type = readByte();
520
+ int size = (size_and_type >> 4) & 0x0f;
521
+ if (size == 15) {
522
+ size = readVarint32();
523
+ }
524
+ byte type = getTType(size_and_type);
525
+ return new TList(type, size);
526
+ }
527
+
528
+ /**
529
+ * Read a set header off the wire. If the set size is 0-14, the size will
530
+ * be packed into the element type header. If it's a longer set, the 4 MSB
531
+ * of the element type header will be 0xF, and a varint will follow with the
532
+ * true size.
533
+ */
534
+ public TSet readSetBegin() throws TException {
535
+ return new TSet(readListBegin());
536
+ }
537
+
538
+ /**
539
+ * Read a boolean off the wire. If this is a boolean field, the value should
540
+ * already have been read during readFieldBegin, so we'll just consume the
541
+ * pre-stored value. Otherwise, read a byte.
542
+ */
543
+ public boolean readBool() throws TException {
544
+ if (boolValue_ != null) {
545
+ boolean result = boolValue_.booleanValue();
546
+ boolValue_ = null;
547
+ return result;
548
+ }
549
+ return readByte() == Types.BOOLEAN_TRUE;
550
+ }
551
+
552
+ byte[] byteRawBuf = new byte[1];
553
+ /**
554
+ * Read a single byte off the wire. Nothing interesting here.
555
+ */
556
+ public byte readByte() throws TException {
557
+ trans_.read(byteRawBuf, 0, 1);
558
+ return byteRawBuf[0];
559
+ }
560
+
561
+ /**
562
+ * Read an i16 from the wire as a zigzag varint.
563
+ */
564
+ public short readI16() throws TException {
565
+ return (short)zigzagToInt(readVarint32());
566
+ }
567
+
568
+ /**
569
+ * Read an i32 from the wire as a zigzag varint.
570
+ */
571
+ public int readI32() throws TException {
572
+ return zigzagToInt(readVarint32());
573
+ }
574
+
575
+ /**
576
+ * Read an i64 from the wire as a zigzag varint.
577
+ */
578
+ public long readI64() throws TException {
579
+ return zigzagToLong(readVarint64());
580
+ }
581
+
582
+ /**
583
+ * No magic here - just read a double off the wire.
584
+ */
585
+ public double readDouble() throws TException {
586
+ byte[] longBits = new byte[8];
587
+ trans_.read(longBits, 0, 8);
588
+ return Double.longBitsToDouble(bytesToLong(longBits));
589
+ }
590
+
591
+ /**
592
+ * Reads a byte[] (via readBinary), and then UTF-8 decodes it.
593
+ */
594
+ public String readString() throws TException {
595
+ try {
596
+ return new String(readBinary(), "UTF-8");
597
+ } catch (UnsupportedEncodingException e) {
598
+ throw new TException("UTF-8 not supported!");
599
+ }
600
+ }
601
+
602
+ /**
603
+ * Read a byte[] from the wire.
604
+ */
605
+ public byte[] readBinary() throws TException {
606
+ int length = readVarint32();
607
+ if (length == 0) return new byte[0];
608
+
609
+ byte[] buf = new byte[length];
610
+ trans_.read(buf, 0, length);
611
+ return buf;
612
+ }
613
+
614
+
615
+ //
616
+ // These methods are here for the struct to call, but don't have any wire
617
+ // encoding.
618
+ //
619
+ public void readMessageEnd() throws TException {}
620
+ public void readFieldEnd() throws TException {}
621
+ public void readMapEnd() throws TException {}
622
+ public void readListEnd() throws TException {}
623
+ public void readSetEnd() throws TException {}
624
+
625
+ //
626
+ // Internal reading methods
627
+ //
628
+
629
+ /**
630
+ * Read an i32 from the wire as a varint. The MSB of each byte is set
631
+ * if there is another byte to follow. This can read up to 5 bytes.
632
+ */
633
+ private int readVarint32() throws TException {
634
+ // if the wire contains the right stuff, this will just truncate the i64 we
635
+ // read and get us the right sign.
636
+ return (int)readVarint64();
637
+ }
638
+
639
+ /**
640
+ * Read an i64 from the wire as a proper varint. The MSB of each byte is set
641
+ * if there is another byte to follow. This can read up to 10 bytes.
642
+ */
643
+ private long readVarint64() throws TException {
644
+ int shift = 0;
645
+ long result = 0;
646
+ while (true) {
647
+ byte b = readByte();
648
+ result |= (long) (b & 0x7f) << shift;
649
+ if ((b & 0x80) != 0x80) break;
650
+ shift +=7;
651
+ }
652
+ return result;
653
+ }
654
+
655
+ //
656
+ // encoding helpers
657
+ //
658
+
659
+ /**
660
+ * Convert from zigzag int to int.
661
+ */
662
+ private int zigzagToInt(int n) {
663
+ return (n >>> 1) ^ -(n & 1);
664
+ }
665
+
666
+ /**
667
+ * Convert from zigzag long to long.
668
+ */
669
+ private long zigzagToLong(long n) {
670
+ return (n >>> 1) ^ -(n & 1);
671
+ }
672
+
673
+ /**
674
+ * Note that it's important that the mask bytes are long literals,
675
+ * otherwise they'll default to ints, and when you shift an int left 56 bits,
676
+ * you just get a messed up int.
677
+ */
678
+ private long bytesToLong(byte[] bytes) {
679
+ return
680
+ ((bytes[7] & 0xffL) << 56) |
681
+ ((bytes[6] & 0xffL) << 48) |
682
+ ((bytes[5] & 0xffL) << 40) |
683
+ ((bytes[4] & 0xffL) << 32) |
684
+ ((bytes[3] & 0xffL) << 24) |
685
+ ((bytes[2] & 0xffL) << 16) |
686
+ ((bytes[1] & 0xffL) << 8) |
687
+ ((bytes[0] & 0xffL));
688
+ }
689
+
690
+ //
691
+ // type testing and converting
692
+ //
693
+
694
+ private boolean isBoolType(byte b) {
695
+ return (b & 0x0f) == Types.BOOLEAN_TRUE || (b & 0x0f) == Types.BOOLEAN_FALSE;
696
+ }
697
+
698
+ /**
699
+ * Given a TCompactProtocol.Types constant, convert it to its corresponding
700
+ * TType value.
701
+ */
702
+ private byte getTType(byte type) {
703
+ switch ((byte)(type & 0x0f)) {
704
+ case TType.STOP:
705
+ return TType.STOP;
706
+ case Types.BOOLEAN_FALSE:
707
+ case Types.BOOLEAN_TRUE:
708
+ return TType.BOOL;
709
+ case Types.BYTE:
710
+ return TType.BYTE;
711
+ case Types.I16:
712
+ return TType.I16;
713
+ case Types.I32:
714
+ return TType.I32;
715
+ case Types.I64:
716
+ return TType.I64;
717
+ case Types.DOUBLE:
718
+ return TType.DOUBLE;
719
+ case Types.BINARY:
720
+ return TType.STRING;
721
+ case Types.LIST:
722
+ return TType.LIST;
723
+ case Types.SET:
724
+ return TType.SET;
725
+ case Types.MAP:
726
+ return TType.MAP;
727
+ case Types.STRUCT:
728
+ return TType.STRUCT;
729
+ default:
730
+ throw new RuntimeException("don't know what type: " + (byte)(type & 0x0f));
731
+ }
732
+ }
733
+
734
+ /**
735
+ * Given a TType value, find the appropriate TCompactProtocol.Types constant.
736
+ */
737
+ private byte getCompactType(byte ttype) {
738
+ return ttypeToCompactType[ttype];
739
+ }
740
+
741
+ }