Class: GeoserverDeliveryJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/geoserver_delivery_job.rb

Overview

Delivers derivatives to external services, like GeoServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#file_setObject (readonly)

Returns the value of attribute file_set.



9
10
11
# File 'app/jobs/geoserver_delivery_job.rb', line 9

def file_set
  @file_set
end

Instance Method Details

#content_urlObject



22
23
24
25
26
27
28
29
30
31
# File 'app/jobs/geoserver_delivery_job.rb', line 22

def content_url
  case file_set.geo_mime_type
  when *GeoWorks::RasterFormatService.select_options.map(&:last)
    return derivatives_service.send(:derivative_url, 'display_raster')
  when *GeoWorks::VectorFormatService.select_options.map(&:last)
    return derivatives_service.send(:derivative_url, 'display_vector')
  else
    return ''
  end
end

#derivatives_serviceObject



33
34
35
# File 'app/jobs/geoserver_delivery_job.rb', line 33

def derivatives_service
  GeoWorks::FileSetDerivativesService.new(file_set)
end

#perform(message) ⇒ Object

Precondition is that all derivatives are created and saved.

Parameters:

  • file_set (FileSet)
  • content_url (String)

    contains the display copy to deliver



15
16
17
18
19
20
# File 'app/jobs/geoserver_delivery_job.rb', line 15

def perform(message)
  @file_set = ActiveFedora::Base.find(message['id'])
  uri = URI.parse(content_url)
  return if uri.path == ''
  GeoWorks::DeliveryService.new(file_set, uri.path).publish
end