Class: Riiif::AkubraSystemFileResolver

Inherits:
AbstractFileSystemResolver show all
Defined in:
app/resolvers/riiif/akubra_system_file_resolver.rb

Instance Attribute Summary collapse

Attributes inherited from AbstractFileSystemResolver

#base_path

Instance Method Summary collapse

Methods inherited from AbstractFileSystemResolver

#find, #path

Constructor Details

#initialize(pr = '/yourfedora/data/datastreamStore/', ir = 'jp2', ac = [[0, 2], [2, 2], [4, 1]]) ⇒ AkubraSystemFileResolver

Returns a new instance of AkubraSystemFileResolver.



7
8
9
10
11
12
# File 'app/resolvers/riiif/akubra_system_file_resolver.rb', line 7

def initialize(pr = '/yourfedora/data/datastreamStore/', ir = 'jp2', ac = [[0, 2], [2, 2], [4, 1]])
  super()
  @pathroot = pr
  @imagetype = ir
  @akubraconfig = ac
end

Instance Attribute Details

#akubraconfigObject

Returns the value of attribute akubraconfig.



5
6
7
# File 'app/resolvers/riiif/akubra_system_file_resolver.rb', line 5

def akubraconfig
  @akubraconfig
end

#imagetypeObject

Returns the value of attribute imagetype.



5
6
7
# File 'app/resolvers/riiif/akubra_system_file_resolver.rb', line 5

def imagetype
  @imagetype
end

#pathrootObject

Returns the value of attribute pathroot.



5
6
7
# File 'app/resolvers/riiif/akubra_system_file_resolver.rb', line 5

def pathroot
  @pathroot
end

Instance Method Details

#pattern(id) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'app/resolvers/riiif/akubra_system_file_resolver.rb', line 14

def pattern(id)
  fullpid = "info:fedora/#{id}/#{@imagetype}/#{@imagetype}.0"
  md5 = Digest::MD5.new
  md5.update fullpid
  digest = md5.hexdigest
  directorystr = ''
  @akubraconfig.each { |a| directorystr << digest[a[0], a[1]] << '/' }
  filename = CGI.escape(fullpid)
  @pathroot + directorystr + filename
end