gemfire-jruby 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +36 -0
- data/README +2 -2
- data/VERSION +1 -1
- data/gemfire-jruby.gemspec +3 -1
- data/lib/gemfire-jruby.rb +7 -15
- metadata +3 -2
data/INSTALL
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
INSTALLING RUBY
|
2
|
+
|
3
|
+
1) Installing JRuby ... skip this if you already have JRuby instaled
|
4
|
+
I will assume that you have a JDK and GemFire already installed (1.5 or later). Rather than duplicate information that is already written up on the web, follow these instructions:
|
5
|
+
http://jruby.org/getting-started
|
6
|
+
|
7
|
+
When you are running the JRuby installer, check the box for setting up your PATH. Then you will be able to run JRuby scripts from other places on your command line. Test it by running 'jirb' (that's the JRuby shell from somewhere other than the JRuby bin directory. To exit the shell, type 'exit'
|
8
|
+
|
9
|
+
INSTALLING RUBY ON RAILS
|
10
|
+
|
11
|
+
1) Since we have installed JRuby, installing Rails is dead simple:
|
12
|
+
C:\> jgem install rails
|
13
|
+
|
14
|
+
|
15
|
+
INSTALLING THE GEMFIRE-JRUBY GEM
|
16
|
+
|
17
|
+
1) Installing the gemfire-jruby gem ... Once JRuby is installed, you can use the 'jgem' program that comes with JRuby to get the gemfire-jruby gem that I published to the web (gemcutter.com ... the standard place to publish gems to). Run:
|
18
|
+
jgem install gemfire-jruby
|
19
|
+
|
20
|
+
That will download the gemfire-jruby gem and its documentation and install it among the other JRuby gems.
|
21
|
+
|
22
|
+
2) Check to see that it is installed:
|
23
|
+
C:\> jgem list
|
24
|
+
|
25
|
+
You should see the gemfire-jruby gem in the list of installed gems
|
26
|
+
|
27
|
+
3) To test the installation, run the JRuby shell (jirb):
|
28
|
+
C:\:> jirb
|
29
|
+
|
30
|
+
4) When the shell opens, use Ruby syntax to load the require files into the shell:
|
31
|
+
|
32
|
+
irb(main):001:0> require 'rubygems'
|
33
|
+
=> true
|
34
|
+
irb(main):002:0> require 'gemfire-jruby'
|
35
|
+
DEPRECATION WARNING ... blah, blah, blah
|
36
|
+
=> true
|
data/README
CHANGED
@@ -21,9 +21,9 @@ Server Options
|
|
21
21
|
Example of Creating a Server
|
22
22
|
require 'rubygems'
|
23
23
|
require 'lib/gemfire-jruby'
|
24
|
-
|
24
|
+
server = ActiveSupport::Cache::GemFire.getInstance('server', {'locators'=>'localhost:10355', 'region-name'=>'data', 'cacheserver-port'=>40404})
|
25
25
|
|
26
26
|
require 'rubygems'
|
27
27
|
require 'lib/gemfire-jruby'
|
28
|
-
|
28
|
+
client = ActiveSupport::Cache::GemFire.getInstance('client', {'locators'=>'localhost:10355', 'region-name'=>'data'})
|
29
29
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/gemfire-jruby.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{gemfire-jruby}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alan McKean"]
|
@@ -20,7 +20,9 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
22
|
".gitignore",
|
23
|
+
"INSTALL",
|
23
24
|
"LICENSE",
|
25
|
+
"README",
|
24
26
|
"README.rdoc",
|
25
27
|
"Rakefile",
|
26
28
|
"VERSION",
|
data/lib/gemfire-jruby.rb
CHANGED
@@ -47,7 +47,7 @@ module ActiveSupport
|
|
47
47
|
# it's a server
|
48
48
|
cacheServer = @cache.addCacheServer
|
49
49
|
cacheServer.setPort(options['cacheserver-port'])
|
50
|
-
cacheServer.start
|
50
|
+
# cacheServer.start
|
51
51
|
regionAttributes = get_server_attributes(options)
|
52
52
|
end
|
53
53
|
@region = @cache.createRegion(options['region-name'], regionAttributes)
|
@@ -74,22 +74,24 @@ module ActiveSupport
|
|
74
74
|
# Delete the entry stored in the GemFire cache at _key_. _key_ can be any JRuby object. Returns the value that was deleted.
|
75
75
|
def delete(key)
|
76
76
|
super
|
77
|
-
@region.destroy(key)
|
77
|
+
@region.destroy(Marshal.dump(key))
|
78
78
|
rescue CacheException => e
|
79
79
|
logger.error("GemfireCache Error (#{e}): #{e.message}")
|
80
80
|
end
|
81
81
|
|
82
82
|
# Fetch all of the keys currently in the GemFire cache. Returns a JRuby Array of JRuby objects.
|
83
83
|
def keys
|
84
|
-
|
84
|
+
result = []
|
85
|
+
@region.keys.each do |k| result << Marshal.load(k) end
|
86
|
+
result
|
85
87
|
end
|
86
88
|
|
87
89
|
# Check if there is an entry accessible by _key_ in the GemFire cache. Returns a boolean.
|
88
90
|
def exist?(key)
|
89
91
|
if @region.getAttributes.getPoolName then
|
90
|
-
@region.containsKey(key)
|
92
|
+
@region.containsKey(Marshal.dump(key))
|
91
93
|
else
|
92
|
-
@region.containsKeyOnServer(key)
|
94
|
+
@region.containsKeyOnServer(Marshal.dump(key))
|
93
95
|
end
|
94
96
|
end
|
95
97
|
|
@@ -184,7 +186,6 @@ module ActiveSupport
|
|
184
186
|
regionAttributes = attributesFactory.create
|
185
187
|
end
|
186
188
|
|
187
|
-
public
|
188
189
|
def toList(selectResults)
|
189
190
|
results = []
|
190
191
|
iterator = selectResults.iterator
|
@@ -203,15 +204,6 @@ module ActiveSupport
|
|
203
204
|
}
|
204
205
|
found
|
205
206
|
end
|
206
|
-
|
207
|
-
public
|
208
|
-
# Query the cache. Optional serverData arg allows querying local client cache
|
209
|
-
def query(queryString, serverData=true)
|
210
|
-
queryService = @region.getAttributes.getPoolName && serverData ? PoolManager.find(@region).getQueryService : @cache.getQueryService
|
211
|
-
query = queryService.newQuery(queryString)
|
212
|
-
result = query.execute
|
213
|
-
selectResults?(result) ? toList(result) : result
|
214
|
-
end
|
215
207
|
end
|
216
208
|
end
|
217
209
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gemfire-jruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan McKean
|
@@ -35,7 +35,9 @@ extra_rdoc_files:
|
|
35
35
|
files:
|
36
36
|
- .document
|
37
37
|
- .gitignore
|
38
|
+
- INSTALL
|
38
39
|
- LICENSE
|
40
|
+
- README
|
39
41
|
- README.rdoc
|
40
42
|
- Rakefile
|
41
43
|
- VERSION
|
@@ -65,7 +67,6 @@ files:
|
|
65
67
|
- lib/gemfire-jruby.rb
|
66
68
|
- test/helper.rb
|
67
69
|
- test/test_gemfire-jruby.rb
|
68
|
-
- README
|
69
70
|
has_rdoc: true
|
70
71
|
homepage: http://github.com/amckean/gemfire-jruby
|
71
72
|
licenses: []
|