kyotocabinet-java 0.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/.document +5 -0
  2. data/Gemfile +15 -0
  3. data/LICENSE.txt +20 -0
  4. data/README.rdoc +19 -0
  5. data/Rakefile +62 -0
  6. data/VERSION +1 -0
  7. data/ext/kyotocabinet-java/.gitignore +2 -0
  8. data/ext/kyotocabinet-java/COPYING +674 -0
  9. data/ext/kyotocabinet-java/Cursor.java +268 -0
  10. data/ext/kyotocabinet-java/DB.java +650 -0
  11. data/ext/kyotocabinet-java/Error.java +257 -0
  12. data/ext/kyotocabinet-java/FileProcessor.java +42 -0
  13. data/ext/kyotocabinet-java/Loader.java +60 -0
  14. data/ext/kyotocabinet-java/Makefile.in +246 -0
  15. data/ext/kyotocabinet-java/MapReduce.java +127 -0
  16. data/ext/kyotocabinet-java/README +26 -0
  17. data/ext/kyotocabinet-java/Test.java +1494 -0
  18. data/ext/kyotocabinet-java/Utility.java +131 -0
  19. data/ext/kyotocabinet-java/VCmakefile +150 -0
  20. data/ext/kyotocabinet-java/ValueIterator.java +49 -0
  21. data/ext/kyotocabinet-java/Visitor.java +56 -0
  22. data/ext/kyotocabinet-java/configure.in +310 -0
  23. data/ext/kyotocabinet-java/doc/allclasses-frame.html +26 -0
  24. data/ext/kyotocabinet-java/doc/allclasses-noframe.html +26 -0
  25. data/ext/kyotocabinet-java/doc/constant-values.html +344 -0
  26. data/ext/kyotocabinet-java/doc/index-all.html +848 -0
  27. data/ext/kyotocabinet-java/doc/index.html +30 -0
  28. data/ext/kyotocabinet-java/doc/kyotocabinet/Cursor.html +711 -0
  29. data/ext/kyotocabinet-java/doc/kyotocabinet/DB.html +1674 -0
  30. data/ext/kyotocabinet-java/doc/kyotocabinet/Error.html +604 -0
  31. data/ext/kyotocabinet-java/doc/kyotocabinet/FileProcessor.html +210 -0
  32. data/ext/kyotocabinet-java/doc/kyotocabinet/MapReduce.html +461 -0
  33. data/ext/kyotocabinet-java/doc/kyotocabinet/Test.html +220 -0
  34. data/ext/kyotocabinet-java/doc/kyotocabinet/Utility.html +413 -0
  35. data/ext/kyotocabinet-java/doc/kyotocabinet/ValueIterator.html +221 -0
  36. data/ext/kyotocabinet-java/doc/kyotocabinet/Visitor.html +283 -0
  37. data/ext/kyotocabinet-java/doc/kyotocabinet/package-frame.html +33 -0
  38. data/ext/kyotocabinet-java/doc/kyotocabinet/package-summary.html +199 -0
  39. data/ext/kyotocabinet-java/doc/kyotocabinet/package-tree.html +141 -0
  40. data/ext/kyotocabinet-java/doc/overview-summary.html +285 -0
  41. data/ext/kyotocabinet-java/doc/overview-tree.html +145 -0
  42. data/ext/kyotocabinet-java/doc/package-list +1 -0
  43. data/ext/kyotocabinet-java/doc/resources/background.gif +0 -0
  44. data/ext/kyotocabinet-java/doc/resources/tab.gif +0 -0
  45. data/ext/kyotocabinet-java/doc/resources/titlebar.gif +0 -0
  46. data/ext/kyotocabinet-java/doc/resources/titlebar_end.gif +0 -0
  47. data/ext/kyotocabinet-java/doc/serialized-form.html +141 -0
  48. data/ext/kyotocabinet-java/doc/stylesheet.css +474 -0
  49. data/ext/kyotocabinet-java/example/KCDBEX1.java +44 -0
  50. data/ext/kyotocabinet-java/example/KCDBEX2.java +44 -0
  51. data/ext/kyotocabinet-java/example/Makefile +59 -0
  52. data/ext/kyotocabinet-java/kyotocabinet.cc +2187 -0
  53. data/ext/kyotocabinet-java/kyotocabinet_Cursor.h +157 -0
  54. data/ext/kyotocabinet-java/kyotocabinet_DB.h +353 -0
  55. data/ext/kyotocabinet-java/kyotocabinet_Error.h +49 -0
  56. data/ext/kyotocabinet-java/kyotocabinet_Error_XBROKEN.h +41 -0
  57. data/ext/kyotocabinet-java/kyotocabinet_Error_XDUPREC.h +41 -0
  58. data/ext/kyotocabinet-java/kyotocabinet_Error_XINVALID.h +41 -0
  59. data/ext/kyotocabinet-java/kyotocabinet_Error_XLOGIC.h +41 -0
  60. data/ext/kyotocabinet-java/kyotocabinet_Error_XMISC.h +41 -0
  61. data/ext/kyotocabinet-java/kyotocabinet_Error_XNOIMPL.h +41 -0
  62. data/ext/kyotocabinet-java/kyotocabinet_Error_XNOPERM.h +41 -0
  63. data/ext/kyotocabinet-java/kyotocabinet_Error_XNOREC.h +41 -0
  64. data/ext/kyotocabinet-java/kyotocabinet_Error_XNOREPOS.h +41 -0
  65. data/ext/kyotocabinet-java/kyotocabinet_Error_XSUCCESS.h +41 -0
  66. data/ext/kyotocabinet-java/kyotocabinet_Error_XSYSTEM.h +41 -0
  67. data/ext/kyotocabinet-java/kyotocabinet_MapReduce.h +33 -0
  68. data/ext/kyotocabinet-java/kyotocabinet_Utility.h +101 -0
  69. data/ext/kyotocabinet-java/kyotocabinet_ValueIterator.h +21 -0
  70. data/ext/kyotocabinet-java/overview.html +177 -0
  71. data/kyotocabinet-java.gemspec +129 -0
  72. data/lib/kyotocabinet-java.rb +141 -0
  73. data/lib/kyotocabinet-java/version.rb +5 -0
  74. metadata +222 -0
@@ -0,0 +1,141 @@
1
+ ##
2
+ ## JRuby adaptation layer for Kyoto Cabinet Java interface.
3
+ ##
4
+ ## This requires the kyotocabinet-java library to be installed. This
5
+ ## library builds a jar file, which should be on the Ruby $LOAD_PATH,
6
+ ## the Java CLASSPATH, or in /usr/local/lib/ where it is placed by the
7
+ ## default 'make install' target in kyotocabinet-java.
8
+ ##
9
+ ## kyotocabinet-java also builds a necessary JNI library,
10
+ ## libjkyotocabinet.{jnilib,dylib}. This cannot be added to
11
+ ## java.library.path at runtime, so either its installation path must
12
+ ## be added to java.library.path with a JVM option like
13
+ ## -Djava.library.path=/some/dir, or it must be copied to somewhere
14
+ ## already on java.library.path.
15
+ ##
16
+
17
+ unless RUBY_PLATFORM == 'java'
18
+ raise "This library requires JRuby!"
19
+ end
20
+
21
+ require 'java'
22
+
23
+ unless Java.const_defined? :Kyotocabinet
24
+ # need to require kyotocabinet.jar
25
+ soname = java.lang.System.mapLibraryName("jkyotocabinet")
26
+ jdir = $LOAD_PATH.find { |d| File.exist? "#{d}/kyotocabinet.jar" }
27
+ raise "Could not find kyotocabinet.jar on $LOAD_PATH!" unless jdir
28
+ sopath = "#{jdir}/#{soname}"
29
+ unless File.exist? sopath
30
+ raise "JNI library #{soname} not installed in #{jdir}!"
31
+ end
32
+ java.lang.System.setProperty("kyotocabinet.lib", sopath)
33
+ require 'kyotocabinet.jar'
34
+ begin
35
+ Java::Kyotocabinet::Loader.load
36
+ rescue NameError
37
+ raise "Kyoto Cabinet classes could not be loaded!"
38
+ end
39
+ end
40
+
41
+ module KyotoCabinet
42
+ module Adaptation
43
+ BYTE_ARRAY = [1].to_java(:byte).java_class
44
+
45
+ def self.included(mod)
46
+ super(mod)
47
+ mod.class_eval do
48
+ def self.with_method_handle(mname, *args)
49
+ $stderr.puts "in #{self}.with_method_handle(#{mname.inspect}, #{args.inspect})"
50
+ mh = self.java_method(mname, args)
51
+ $stderr.puts "got method handle #{mh}"
52
+ yield mh
53
+ end
54
+ end
55
+ end
56
+
57
+ end
58
+ end
59
+
60
+ module Java::Kyotocabinet
61
+ class Cursor
62
+ include KyotoCabinet::Adaptation
63
+
64
+ alias_method :_get, :get
65
+ def get(step=false)
66
+ r = self._get(step)
67
+ if r
68
+ return [String.from_java_bytes(r[0]),
69
+ String.from_java_bytes(r[1])]
70
+ else
71
+ return nil
72
+ end
73
+ end
74
+
75
+ alias_method :_get_key, :get_key
76
+ def get_key(step=false)
77
+ r = self._get_key(step)
78
+ if r
79
+ return String.from_java_bytes(r)
80
+ else
81
+ return nil
82
+ end
83
+ end
84
+
85
+ alias_method :_jump, :jump
86
+ def jump(key)
87
+ self._jump(key.to_java_bytes)
88
+ end
89
+ end # class Cursor
90
+
91
+ class DB
92
+ include KyotoCabinet::Adaptation
93
+
94
+ alias_method :_match_prefix, :match_prefix
95
+ def match_prefix(prefix, limit=-1)
96
+ self._match_prefix(prefix, limit)
97
+ end
98
+
99
+ alias_method :_get, :get
100
+ def get(key)
101
+ String.from_java_bytes(self._get(key.to_java_bytes))
102
+ end
103
+ alias_method :[], :get
104
+
105
+ alias_method :_set, :set
106
+ def set(k, v)
107
+ self._set(k.to_java_bytes, v.to_s.to_java_bytes)
108
+ end
109
+ alias_method :[]=, :set
110
+
111
+ alias_method :_set_bulk, :set_bulk
112
+ def set_bulk(rec_h, atomic)
113
+ ba = Java::byte[rec_h.size * 2, 0].new
114
+ i = 0
115
+ rec_h.each_pair do |k, v|
116
+ ba[i] = k.to_java_bytes
117
+ ba[i+1] = v.to_java_bytes
118
+ i += 2
119
+ end
120
+ self._set_bulk(ba, atomic)
121
+ end
122
+
123
+ alias_method :_synchronize, :synchronize
124
+ def synchronize(hard=false, proc=nil)
125
+ self._synchronize(hard, proc)
126
+ end
127
+
128
+ def cursor_process
129
+ cur = self.cursor()
130
+ begin
131
+ yield cur
132
+ ensure
133
+ cur.disable()
134
+ end
135
+ end
136
+ end # class DB
137
+ end
138
+
139
+ module KyotoCabinet
140
+ import Java::Kyotocabinet
141
+ end
@@ -0,0 +1,5 @@
1
+ module KyotoCabinet
2
+ module Java
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,222 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kyotocabinet-java
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: java
7
+ authors:
8
+ - Clayton Wheeler
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: shoulda
16
+ version_requirements: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ! '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ none: false
22
+ requirement: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ none: false
28
+ prerelease: false
29
+ type: :development
30
+ - !ruby/object:Gem::Dependency
31
+ name: rdoc
32
+ version_requirements: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ~>
35
+ - !ruby/object:Gem::Version
36
+ version: '3.12'
37
+ none: false
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ~>
41
+ - !ruby/object:Gem::Version
42
+ version: '3.12'
43
+ none: false
44
+ prerelease: false
45
+ type: :development
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ~>
51
+ - !ruby/object:Gem::Version
52
+ version: 1.1.3
53
+ none: false
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ~>
57
+ - !ruby/object:Gem::Version
58
+ version: 1.1.3
59
+ none: false
60
+ prerelease: false
61
+ type: :development
62
+ - !ruby/object:Gem::Dependency
63
+ name: jeweler
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 1.8.4
69
+ none: false
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ~>
73
+ - !ruby/object:Gem::Version
74
+ version: 1.8.4
75
+ none: false
76
+ prerelease: false
77
+ type: :development
78
+ - !ruby/object:Gem::Dependency
79
+ name: simplecov
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ! '>='
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ none: false
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ none: false
92
+ prerelease: false
93
+ type: :development
94
+ - !ruby/object:Gem::Dependency
95
+ name: jruby-openssl
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ none: false
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ none: false
108
+ prerelease: false
109
+ type: :development
110
+ description: Wrapper for Kyoto Cabinet's Java library for use with JRuby, to provide the same interface as the native kyotocabinet-ruby gem for MRI.
111
+ email: cswh@umich.edu
112
+ executables: []
113
+ extensions:
114
+ - ext/kyotocabinet-java/configure
115
+ extra_rdoc_files:
116
+ - LICENSE.txt
117
+ - README.rdoc
118
+ files:
119
+ - .document
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.rdoc
123
+ - Rakefile
124
+ - VERSION
125
+ - ext/kyotocabinet-java/.gitignore
126
+ - ext/kyotocabinet-java/COPYING
127
+ - ext/kyotocabinet-java/Cursor.java
128
+ - ext/kyotocabinet-java/DB.java
129
+ - ext/kyotocabinet-java/Error.java
130
+ - ext/kyotocabinet-java/FileProcessor.java
131
+ - ext/kyotocabinet-java/Loader.java
132
+ - ext/kyotocabinet-java/Makefile.in
133
+ - ext/kyotocabinet-java/MapReduce.java
134
+ - ext/kyotocabinet-java/README
135
+ - ext/kyotocabinet-java/Test.java
136
+ - ext/kyotocabinet-java/Utility.java
137
+ - ext/kyotocabinet-java/VCmakefile
138
+ - ext/kyotocabinet-java/ValueIterator.java
139
+ - ext/kyotocabinet-java/Visitor.java
140
+ - ext/kyotocabinet-java/configure.in
141
+ - ext/kyotocabinet-java/doc/allclasses-frame.html
142
+ - ext/kyotocabinet-java/doc/allclasses-noframe.html
143
+ - ext/kyotocabinet-java/doc/constant-values.html
144
+ - ext/kyotocabinet-java/doc/index-all.html
145
+ - ext/kyotocabinet-java/doc/index.html
146
+ - ext/kyotocabinet-java/doc/kyotocabinet/Cursor.html
147
+ - ext/kyotocabinet-java/doc/kyotocabinet/DB.html
148
+ - ext/kyotocabinet-java/doc/kyotocabinet/Error.html
149
+ - ext/kyotocabinet-java/doc/kyotocabinet/FileProcessor.html
150
+ - ext/kyotocabinet-java/doc/kyotocabinet/MapReduce.html
151
+ - ext/kyotocabinet-java/doc/kyotocabinet/Test.html
152
+ - ext/kyotocabinet-java/doc/kyotocabinet/Utility.html
153
+ - ext/kyotocabinet-java/doc/kyotocabinet/ValueIterator.html
154
+ - ext/kyotocabinet-java/doc/kyotocabinet/Visitor.html
155
+ - ext/kyotocabinet-java/doc/kyotocabinet/package-frame.html
156
+ - ext/kyotocabinet-java/doc/kyotocabinet/package-summary.html
157
+ - ext/kyotocabinet-java/doc/kyotocabinet/package-tree.html
158
+ - ext/kyotocabinet-java/doc/overview-summary.html
159
+ - ext/kyotocabinet-java/doc/overview-tree.html
160
+ - ext/kyotocabinet-java/doc/package-list
161
+ - ext/kyotocabinet-java/doc/resources/background.gif
162
+ - ext/kyotocabinet-java/doc/resources/tab.gif
163
+ - ext/kyotocabinet-java/doc/resources/titlebar.gif
164
+ - ext/kyotocabinet-java/doc/resources/titlebar_end.gif
165
+ - ext/kyotocabinet-java/doc/serialized-form.html
166
+ - ext/kyotocabinet-java/doc/stylesheet.css
167
+ - ext/kyotocabinet-java/example/KCDBEX1.java
168
+ - ext/kyotocabinet-java/example/KCDBEX2.java
169
+ - ext/kyotocabinet-java/example/Makefile
170
+ - ext/kyotocabinet-java/kyotocabinet.cc
171
+ - ext/kyotocabinet-java/kyotocabinet_Cursor.h
172
+ - ext/kyotocabinet-java/kyotocabinet_DB.h
173
+ - ext/kyotocabinet-java/kyotocabinet_Error.h
174
+ - ext/kyotocabinet-java/kyotocabinet_Error_XBROKEN.h
175
+ - ext/kyotocabinet-java/kyotocabinet_Error_XDUPREC.h
176
+ - ext/kyotocabinet-java/kyotocabinet_Error_XINVALID.h
177
+ - ext/kyotocabinet-java/kyotocabinet_Error_XLOGIC.h
178
+ - ext/kyotocabinet-java/kyotocabinet_Error_XMISC.h
179
+ - ext/kyotocabinet-java/kyotocabinet_Error_XNOIMPL.h
180
+ - ext/kyotocabinet-java/kyotocabinet_Error_XNOPERM.h
181
+ - ext/kyotocabinet-java/kyotocabinet_Error_XNOREC.h
182
+ - ext/kyotocabinet-java/kyotocabinet_Error_XNOREPOS.h
183
+ - ext/kyotocabinet-java/kyotocabinet_Error_XSUCCESS.h
184
+ - ext/kyotocabinet-java/kyotocabinet_Error_XSYSTEM.h
185
+ - ext/kyotocabinet-java/kyotocabinet_MapReduce.h
186
+ - ext/kyotocabinet-java/kyotocabinet_Utility.h
187
+ - ext/kyotocabinet-java/kyotocabinet_ValueIterator.h
188
+ - ext/kyotocabinet-java/overview.html
189
+ - kyotocabinet-java.gemspec
190
+ - lib/kyotocabinet-java.rb
191
+ - lib/kyotocabinet-java/version.rb
192
+ - ext/kyotocabinet-java/configure
193
+ homepage: http://github.com/csw/kyotocabinet-java
194
+ licenses:
195
+ - MIT
196
+ post_install_message:
197
+ rdoc_options: []
198
+ require_paths:
199
+ - lib
200
+ required_ruby_version: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - ! '>='
203
+ - !ruby/object:Gem::Version
204
+ segments:
205
+ - 0
206
+ hash: 2
207
+ version: '0'
208
+ none: false
209
+ required_rubygems_version: !ruby/object:Gem::Requirement
210
+ requirements:
211
+ - - ! '>='
212
+ - !ruby/object:Gem::Version
213
+ version: '0'
214
+ none: false
215
+ requirements: []
216
+ rubyforge_project:
217
+ rubygems_version: 1.8.24
218
+ signing_key:
219
+ specification_version: 3
220
+ summary: Kyoto Cabinet Java library for JRuby
221
+ test_files: []
222
+ ...