hazelcast-client 0.0.1-jruby → 0.0.2-jruby
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -1
- data/VERSION +1 -1
- data/lib/hazelcast-client.rb +25 -15
- metadata +3 -3
data/Rakefile
CHANGED
@@ -21,7 +21,8 @@ begin
|
|
21
21
|
|
22
22
|
gem.files = FileList['bin/*', 'lib/**/*.rb', 'jars/**/*', 'test/**/*.rb', '[A-Z]*'].to_a
|
23
23
|
gem.test_files = Dir["test/test*.rb"]
|
24
|
-
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
24
|
+
# gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
25
|
+
gem.executables = FileList['bin/*'].map { |f| File.basename(f) }
|
25
26
|
gem.require_paths = ["lib"]
|
26
27
|
|
27
28
|
gem.add_dependency "hazelcast-jars", "1.9.1"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/hazelcast-client.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
raise "
|
1
|
+
raise "hazelcast-client only runs on JRuby. Sorry!" unless (RUBY_PLATFORM =~ /java/)
|
2
2
|
require 'java'
|
3
3
|
require 'rubygems'
|
4
4
|
require 'hazelcast-jars'
|
@@ -18,43 +18,49 @@ module Hazelcast
|
|
18
18
|
@username = username || "dev"
|
19
19
|
@password = password || "dev-pass"
|
20
20
|
@host = host || "localhost"
|
21
|
-
@
|
21
|
+
@conn_id = self.class.connection_id @username, @password, @host
|
22
|
+
self.class.connect @username, @password, @host
|
23
|
+
client
|
24
|
+
end
|
25
|
+
|
26
|
+
def client
|
27
|
+
self.class.connections[@conn_id]
|
22
28
|
end
|
23
29
|
|
24
30
|
def cluster(name)
|
25
|
-
|
31
|
+
client.getCluster name.to_s
|
26
32
|
end
|
27
33
|
|
28
34
|
def list(name)
|
29
|
-
|
35
|
+
client.getList name.to_s
|
30
36
|
end
|
31
37
|
|
32
38
|
def lock(name)
|
33
|
-
|
39
|
+
client.getLock name.to_s
|
34
40
|
end
|
35
41
|
|
36
42
|
def map(name)
|
37
|
-
|
43
|
+
client.getMap name.to_s
|
38
44
|
end
|
39
45
|
|
40
46
|
def multi_map(name)
|
41
|
-
|
47
|
+
client.getMultiMap name.to_s
|
42
48
|
end
|
43
49
|
|
44
50
|
def queue(name)
|
45
|
-
|
51
|
+
client.getQueue name.to_s
|
46
52
|
end
|
47
53
|
|
48
54
|
def set(name)
|
49
|
-
|
55
|
+
client.getSet name.to_s
|
50
56
|
end
|
51
57
|
|
52
58
|
def topic(name)
|
53
|
-
|
59
|
+
client.getTopic name.to_s
|
54
60
|
end
|
55
61
|
|
56
62
|
def transaction
|
57
|
-
txn =
|
63
|
+
txn = client.getTransaction
|
58
64
|
txn.begin
|
59
65
|
begin
|
60
66
|
yield
|
@@ -67,12 +73,12 @@ module Hazelcast
|
|
67
73
|
end
|
68
74
|
|
69
75
|
def respond_to?(meth)
|
70
|
-
super ||
|
76
|
+
super || client.respond_to?(meth)
|
71
77
|
end
|
72
78
|
|
73
79
|
def method_missing(meth, *args, &blk)
|
74
|
-
if
|
75
|
-
|
80
|
+
if client.respond_to? meth
|
81
|
+
client.send meth, *args, &blk
|
76
82
|
else
|
77
83
|
super
|
78
84
|
end
|
@@ -82,8 +88,12 @@ module Hazelcast
|
|
82
88
|
@connections ||= {}
|
83
89
|
end
|
84
90
|
|
91
|
+
def self.connection_id(username, password, host)
|
92
|
+
"#{username}:#{password}:#{host}"
|
93
|
+
end
|
94
|
+
|
85
95
|
def self.connect(username, password, host)
|
86
|
-
conn_id =
|
96
|
+
conn_id = connection_id(username, password, host)
|
87
97
|
if connections.key? conn_id
|
88
98
|
connections[conn_id]
|
89
99
|
else
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: jruby
|
11
11
|
authors:
|
12
12
|
- Adrian Madrid
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-08 00:00:00 -07:00
|
18
18
|
default_executable: hazelcast-client-console
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|