gemfire-jruby 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -2,7 +2,7 @@
2
2
  <!DOCTYPE cache PUBLIC '-//GemStone Systems, Inc.//GemFire Declarative Cache 6.0//EN' 'http://www.gemstone.com/dtd/cache6_0.dtd'>
3
3
  <cache>
4
4
  <region name='default'>
5
- <region-attributes>
5
+ <region-attributes data-policy="replicate">
6
6
  </region-attributes>
7
7
  </region>
8
8
  </cache>
@@ -0,0 +1,2 @@
1
+ locators=
2
+ mcast-port=10339
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gemfire-jruby}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
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"]
12
- s.date = %q{2010-01-27}
12
+ s.date = %q{2010-01-28}
13
13
  s.description = %q{"Uses Memcached API"}
14
14
  s.email = %q{alan.mckean@gemstone.com}
15
15
  s.extra_rdoc_files = [
@@ -45,7 +45,6 @@ Gem::Specification.new do |s|
45
45
  "doc/fr_method_index.html",
46
46
  "doc/index.html",
47
47
  "doc/rdoc-style.css",
48
- "gemfire-jruby-0.0.1.gem",
49
48
  "gemfire-jruby-demo/README",
50
49
  "gemfire-jruby-demo/Rakefile",
51
50
  "gemfire-jruby-demo/app/controllers/application_controller.rb",
@@ -66,10 +65,10 @@ Gem::Specification.new do |s|
66
65
  "gemfire-jruby-demo/config/routes.rb",
67
66
  "gemfire-jruby-demo/db/seeds.rb",
68
67
  "gemfire-jruby-demo/doc/README_FOR_APP",
69
- "gemfire-jruby-demo/log/development.log",
70
68
  "gemfire-jruby-demo/log/production.log",
71
69
  "gemfire-jruby-demo/log/server.log",
72
70
  "gemfire-jruby-demo/log/test.log",
71
+ "gemfire-jruby-demo/my.properties",
73
72
  "gemfire-jruby-demo/public/404.html",
74
73
  "gemfire-jruby-demo/public/422.html",
75
74
  "gemfire-jruby-demo/public/500.html",
data/lib/gemfire-jruby.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'activesupport'
1
+ require 'active_support'
2
2
 
3
3
  import java.lang.System
4
4
  import java.util.Properties
@@ -23,8 +23,8 @@ module ActiveSupport
23
23
  # For example, GemFire.getInstance('locators' => 'localhost[10355]', 'mcast-port' => '0')
24
24
  # Since it is a Singleton, successive calls to GemFire.getInstance() will return the single
25
25
  # instance that was instantiated by the first call.
26
- def GemFire.getInstance(hashOfGemFireProperties)
27
- self.instance ||= new(hashOfGemFireProperties={})
26
+ def GemFire.getInstance(hashOfGemFireProperties={})
27
+ self.instance ||= new(hashOfGemFireProperties)
28
28
  end
29
29
 
30
30
  def initialize(hashOfGemFireProperties)
@@ -37,7 +37,6 @@ module ActiveSupport
37
37
  @region = cache.getRegion(System.getProperty("cachingRegionName") || "default")
38
38
  rescue CacheException => e
39
39
  logger.error("GemfireCache Creation Error (#{e}): #{e.message}")
40
- false
41
40
  end
42
41
 
43
42
  # Read a value from the GemFire cache. _key_ can be any JRuby object. Returns the value stored at _key_.
@@ -46,17 +45,14 @@ module ActiveSupport
46
45
  @region.get(key)
47
46
  rescue CacheException => e
48
47
  logger.error("GemfireCache Error (#{e}): #{e.message}")
49
- false
50
48
  end
51
49
 
52
50
  # Write a value to the GemFire cache. _key_ is used to read the value from the cache and can be any JRuby object. Returns the value that was stored at _key_.
53
51
  def write(key, value)
54
52
  super
55
53
  @region.put(key, value)
56
- true
57
54
  rescue CacheException => e
58
55
  logger.error("GemfireCache Error (#{e}): #{e.message}")
59
- false
60
56
  end
61
57
 
62
58
  # Delete the entry stored in the GemFire cache at _key_. _key_ can be any JRuby object. Returns the value that was deleted.
@@ -65,7 +61,6 @@ module ActiveSupport
65
61
  @region.destroy(key)
66
62
  rescue CacheException => e
67
63
  logger.error("GemfireCache Error (#{e}): #{e.message}")
68
- false
69
64
  end
70
65
 
71
66
  # Fetch all of the keys currently in the GemFire cache. Returns a JRuby Array of JRuby objects.
@@ -75,18 +70,18 @@ module ActiveSupport
75
70
 
76
71
  # Check if there is an entry accessible by _key_ in the GemFire cache. Returns a boolean.
77
72
  def exist?(key)
78
- super
79
- @region.containsKeyOnServer(key)
73
+ if @region.getAttributes.getPoolName then
74
+ @region.containsKey(key)
75
+ else
76
+ @region.containsKeyOnServer(key)
77
+ end
80
78
  end
81
79
 
82
80
  # Delete all entries (key=>value pairs) from the GemFire cache. Returns a JRuby Hash.
83
81
  def clear
84
- super
85
82
  @region.clear
86
- true
87
83
  rescue CacheException => e
88
84
  logger.error("GemfireCache Error (#{e}): #{e.message}")
89
- false
90
85
  end
91
86
 
92
87
  # Not implemented by GemFire. Raises an exception when called.
@@ -103,6 +98,32 @@ module ActiveSupport
103
98
  def delete_matched(matcher)
104
99
  raise "Not supported by Gemfire"
105
100
  end
101
+
102
+ def toList(selectResults)
103
+ results = []
104
+ iterator = selectResults.iterator
105
+ while(iterator.hasNext) {
106
+ results << iterator.next
107
+ end
108
+ results
109
+ end
110
+
111
+ def selectResults?(javaObject)
112
+ found = false
113
+ javaObject.getClass.getInterfaces.each { |i|
114
+ if (i.to_s == 'interface com.gemstone.gemfire.cache.query.SelectResults') then
115
+ found = true
116
+ end
117
+ }
118
+ found
119
+ end
120
+
121
+ def query(queryString)
122
+ queryService = @region.getAttributes.getPoolName ? pool.getQueryService : cache.getQueryService
123
+ query = queryService.newQuery(queryString)
124
+ result = query.execute
125
+ selectResults?(result) ? toList(result) : result
126
+ end
106
127
  end
107
128
  end
108
129
  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.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alan McKean
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-27 00:00:00 -08:00
12
+ date: 2010-01-28 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -60,7 +60,6 @@ files:
60
60
  - doc/fr_method_index.html
61
61
  - doc/index.html
62
62
  - doc/rdoc-style.css
63
- - gemfire-jruby-0.0.1.gem
64
63
  - gemfire-jruby-demo/README
65
64
  - gemfire-jruby-demo/Rakefile
66
65
  - gemfire-jruby-demo/app/controllers/application_controller.rb
@@ -81,10 +80,10 @@ files:
81
80
  - gemfire-jruby-demo/config/routes.rb
82
81
  - gemfire-jruby-demo/db/seeds.rb
83
82
  - gemfire-jruby-demo/doc/README_FOR_APP
84
- - gemfire-jruby-demo/log/development.log
85
83
  - gemfire-jruby-demo/log/production.log
86
84
  - gemfire-jruby-demo/log/server.log
87
85
  - gemfire-jruby-demo/log/test.log
86
+ - gemfire-jruby-demo/my.properties
88
87
  - gemfire-jruby-demo/public/404.html
89
88
  - gemfire-jruby-demo/public/422.html
90
89
  - gemfire-jruby-demo/public/500.html
@@ -1,24 +0,0 @@
1
- Cache write: 1
2
- Cache read: 1
3
- Cache write: 1
4
- Cache read: 1
5
- DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead.. (called from /Developer/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/activesupport.rb:2)
6
- DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead.. (called from /Developer/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/activesupport.rb:2)
7
- DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead.. (called from /Developer/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/activesupport.rb:2)
8
- Cache write: 1
9
- Cache read: 1
10
- DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead.. (called from /Developer/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/activesupport.rb:2)
11
- DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead.. (called from /Developer/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/activesupport.rb:2)
12
- DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead.. (called from /Developer/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/activesupport.rb:2)
13
- Cache write: 1
14
- Cache write: 1
15
- Cache delete: 1
16
- Cache exist?: 1
17
- Cache write: 1
18
- Cache exist?: 1
19
- Cache write: 1
20
- Cache incrementing: 1 (1)
21
- Cache read: 1
22
- DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead.. (called from /Developer/Applications/jruby-1.4.0/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/activesupport.rb:2)
23
- Cache write: 1
24
- Cache write: 1