Class: Akubra::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/akubra/store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(bean) ⇒ Store

Returns a new instance of Store.



5
6
7
# File 'lib/akubra/store.rb', line 5

def initialize bean
  @bean = bean
end

Instance Attribute Details

#beanObject (readonly)

Returns the value of attribute bean.



3
4
5
# File 'lib/akubra/store.rb', line 3

def bean
  @bean
end

Instance Method Details

#baseDirObject



27
28
29
30
31
32
33
# File 'lib/akubra/store.rb', line 27

def baseDir
  @baseDir ||= begin
  fl = store.java_class.declared_field('baseDir')
  fl.accessible = true
  fl.value(store).to_s
               end
end

#each(&block) ⇒ Object



14
15
16
17
# File 'lib/akubra/store.rb', line 14

def each &block
  return to_enum(:each).to_a unless block_given?
  bean.open_connection(nil, nil).listBlobIds(nil).each { |x| block.call(x.schemeSpecificPart) }
end

#each_file(&block) ⇒ Object



9
10
11
12
# File 'lib/akubra/store.rb', line 9

def each_file &block
  return to_enum(:each_file).to_a unless block_given?
  store.listBlobIds(nil).each { |x| block.call(File.join(baseDir, x.schemeSpecificPart)) }
end

#mapperObject



35
36
37
38
39
40
41
# File 'lib/akubra/store.rb', line 35

def mapper
  @mapper ||= begin
  fl = bean.java_class.declared_field('mapper')
  fl.accessible = true
  fl.value(bean)
              end
end

#storeObject



19
20
21
22
23
24
25
# File 'lib/akubra/store.rb', line 19

def store
  @store ||= begin
               fl = bean.java_class.declared_field('store')
  fl.accessible = true
  fl.value(bean).open_connection(nil, nil)
             end
end