sdb_dal 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
module SdbDal
|
5
|
+
class BerkeleyRepository
|
6
|
+
def initialize(
|
7
|
+
sdb_domain= nil,
|
8
|
+
clob_bucket= nil,
|
9
|
+
aws_key_id= nil,
|
10
|
+
aws_secret_key= nil,
|
11
|
+
memcache_servers = nil ,
|
12
|
+
dummy=nil,
|
13
|
+
append_table_to_domain=nil,
|
14
|
+
options={}
|
15
|
+
)
|
16
|
+
|
17
|
+
end
|
18
|
+
def pause
|
19
|
+
end
|
20
|
+
|
21
|
+
def clear_session_cache
|
22
|
+
|
23
|
+
end
|
24
|
+
def save(table_name, primary_key, attributes,index_descriptions)
|
25
|
+
end
|
26
|
+
def save_into_index(table_name,record,index_name,index_value)
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def retrieve_from_index(table_name,index_name,index_value)
|
31
|
+
end
|
32
|
+
|
33
|
+
def query_ids(table_name,attribute_descriptions,options)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def query(table_name,attribute_descriptions,options)
|
38
|
+
end
|
39
|
+
def find_one(table_name, primary_key,attribute_descriptions)#, non_clob_attribute_names, clob_attribute_names)
|
40
|
+
end
|
41
|
+
def get_clob(table_name,primary_key,clob_name)
|
42
|
+
end
|
43
|
+
def destroy(table_name, primary_key)
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
@@ -3,10 +3,7 @@ require "openssl"
|
|
3
3
|
|
4
4
|
module SdbDal
|
5
5
|
class Configuration
|
6
|
-
|
7
|
-
|
8
|
-
include OpenSSL::Cipher
|
9
|
-
|
6
|
+
|
10
7
|
attr_reader :repository_class
|
11
8
|
attr_reader :domain_prefix
|
12
9
|
attr_reader :clob_bucket
|
@@ -57,24 +54,24 @@ module SdbDal
|
|
57
54
|
|
58
55
|
end
|
59
56
|
end
|
60
|
-
|
57
|
+
def crypto
|
58
|
+
return @crypto if @crypto
|
59
|
+
options={}
|
60
|
+
if cipher_key
|
61
|
+
options[:cipher_key=]= cipher_key
|
62
|
+
options[:cipher_iv ]= cipher_iv
|
63
|
+
@crypto=Crypto.new()
|
64
|
+
else
|
65
|
+
@crypto=Crypto.new
|
66
|
+
File.open(self.cipher_key_file,'w').write(@crypto.key)
|
67
|
+
File.open(self.cipher_iv_file,'w').write(@crypto.iv)
|
68
|
+
end
|
69
|
+
end
|
61
70
|
def cipher_key
|
62
|
-
unless @cipher_key
|
63
|
-
@cipher = Cipher.new("AES-256-CBC")
|
64
|
-
|
65
|
-
@cipher_key = @cipher.random_key()
|
66
|
-
File.open(self.cipher_key_file,'w').write(@cipher_key)
|
67
|
-
end
|
68
71
|
return @cipher_key
|
69
72
|
end
|
70
73
|
|
71
74
|
def cipher_iv
|
72
|
-
unless @cipher_iv
|
73
|
-
@cipher = Cipher.new("AES-256-CBC")
|
74
|
-
|
75
|
-
@cipher_iv = @cipher.random_iv()
|
76
|
-
File.open(self.cipher_iv_file,'w').write(@cipher_iv)
|
77
|
-
end
|
78
75
|
return @cipher_iv
|
79
76
|
end
|
80
77
|
|
data/lib/sdb_dal/crypto.rb
CHANGED
@@ -2,11 +2,11 @@ require "openssl"
|
|
2
2
|
|
3
3
|
module SdbDal
|
4
4
|
class Crypto
|
5
|
-
include OpenSSL
|
6
5
|
|
7
|
-
|
6
|
+
attr_reader :key
|
7
|
+
attr_reader :iv
|
8
8
|
def initialize(options={})
|
9
|
-
@cipher = Cipher.new("AES-256-CBC")
|
9
|
+
@cipher = OpenSSL::Cipher::Cipher.new("AES-256-CBC")
|
10
10
|
|
11
11
|
@key=options[:cipher_key] if options.has_key?(:cipher_key)
|
12
12
|
@iv=options[:cipher_iv] if options.has_key?(:cipher_iv)
|
@@ -11,10 +11,7 @@ class DomainAttributeDescription
|
|
11
11
|
attr_accessor :is_encrypted
|
12
12
|
|
13
13
|
def self.crypto
|
14
|
-
@@crypto||=
|
15
|
-
:cipher_key => Configuration.singleton.cipher_key,
|
16
|
-
:cipher_iv => Configuration.singleton.cipher_iv
|
17
|
-
)
|
14
|
+
@@crypto||= Configuration.singleton.crypto
|
18
15
|
@@crypto
|
19
16
|
end
|
20
17
|
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
module SdbDal
|
5
|
+
class BerkeleyRepository
|
6
|
+
def initialize(
|
7
|
+
sdb_domain= nil,
|
8
|
+
clob_bucket= nil,
|
9
|
+
aws_key_id= nil,
|
10
|
+
aws_secret_key= nil,
|
11
|
+
memcache_servers = nil ,
|
12
|
+
dummy=nil,
|
13
|
+
append_table_to_domain=nil,
|
14
|
+
options={}
|
15
|
+
)
|
16
|
+
|
17
|
+
end
|
18
|
+
def pause
|
19
|
+
end
|
20
|
+
|
21
|
+
def clear_session_cache
|
22
|
+
|
23
|
+
end
|
24
|
+
def save(table_name, primary_key, attributes,index_descriptions)
|
25
|
+
end
|
26
|
+
def save_into_index(table_name,record,index_name,index_value)
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def retrieve_from_index(table_name,index_name,index_value)
|
31
|
+
end
|
32
|
+
|
33
|
+
def query_ids(table_name,attribute_descriptions,options)
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
def query(table_name,attribute_descriptions,options)
|
38
|
+
end
|
39
|
+
def find_one(table_name, primary_key,attribute_descriptions)#, non_clob_attribute_names, clob_attribute_names)
|
40
|
+
end
|
41
|
+
def get_clob(table_name,primary_key,clob_name)
|
42
|
+
end
|
43
|
+
def destroy(table_name, primary_key)
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sdb_dal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Knight
|
@@ -9,7 +9,7 @@ autorequire: sdb_dal
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-14 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -26,6 +26,7 @@ files:
|
|
26
26
|
- ./lib/sdb_dal/acts_as_sdb_application.rb
|
27
27
|
- ./lib/sdb_dal/and_condition.rb
|
28
28
|
- ./lib/sdb_dal/attribute_range.rb
|
29
|
+
- ./lib/sdb_dal/berkeley_repository.rb
|
29
30
|
- ./lib/sdb_dal/configuration.rb
|
30
31
|
- ./lib/sdb_dal/crypto.rb
|
31
32
|
- ./lib/sdb_dal/domain_attribute_description.rb
|
@@ -44,6 +45,7 @@ files:
|
|
44
45
|
- ./lib/sdb_dal/reference.rb
|
45
46
|
- ./lib/sdb_dal/repository.rb
|
46
47
|
- ./lib/sdb_dal/repository_factory.rb
|
48
|
+
- ./lib/sdb_dal/repository_interface.rb
|
47
49
|
- ./lib/sdb_dal/s3.rb
|
48
50
|
- ./lib/sdb_dal/sdb_formatter.rb
|
49
51
|
- ./lib/sdb_dal/sdb_monkey_patch.rb
|