umlaut 3.0.5 → 3.1.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +48 -5
- data/app/assets/images/umlaut_icons.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-book-go.png +0 -0
- data/app/assets/images/{famfamfam/book_open.png → umlaut_icons/famfamfam-book-open.png} +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-book.png +0 -0
- data/app/assets/images/{famfamfam/cross.png → umlaut_icons/famfamfam-cross.png} +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-error.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-help.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-information.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-link.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-page-sound.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-page-text.png +0 -0
- data/app/assets/images/umlaut_icons/famfamfam-page-up.png +0 -0
- data/app/assets/images/{famfamfam/page_white.png → umlaut_icons/famfamfam-page-white.png} +0 -0
- data/app/assets/images/{famfamfam/readme.html → umlaut_icons/famfamfam-readme.html} +0 -0
- data/app/assets/images/{famfamfam/tiny_cross.png → umlaut_icons/famfamfam-tiny-cross.png} +0 -0
- data/app/assets/images/{list_closed.png → umlaut_icons/list-closed.png} +0 -0
- data/app/assets/images/{list_open.png → umlaut_icons/list-open.png} +0 -0
- data/app/assets/javascripts/umlaut.js +5 -4
- data/app/assets/javascripts/umlaut/ajax_windows.js +41 -23
- data/app/assets/javascripts/umlaut/expand_contract_toggle.js +21 -29
- data/app/assets/javascripts/umlaut/load_permalink.js +26 -0
- data/app/assets/javascripts/umlaut/search_autocomplete.js +103 -44
- data/app/assets/stylesheets/umlaut.css.scss +19 -0
- data/app/assets/stylesheets/umlaut/_admin.scss +14 -0
- data/app/assets/stylesheets/umlaut/_az.scss +29 -0
- data/app/assets/stylesheets/umlaut/_forms.scss +31 -0
- data/app/assets/stylesheets/umlaut/_icons.scss +64 -0
- data/app/assets/stylesheets/umlaut/_layout.scss +52 -0
- data/app/assets/stylesheets/umlaut/_misc.scss +59 -0
- data/app/assets/stylesheets/umlaut/_mixins.scss +65 -0
- data/app/assets/stylesheets/umlaut/_modal.scss +4 -0
- data/app/assets/stylesheets/umlaut/_resolve.scss +308 -0
- data/app/assets/stylesheets/umlaut/_results.scss +34 -0
- data/app/assets/stylesheets/umlaut/_search.scss +14 -0
- data/app/assets/stylesheets/umlaut/_spinner.scss +12 -0
- data/app/assets/stylesheets/umlaut/_variables.scss +72 -0
- data/app/controllers/export_email_controller.rb +22 -39
- data/app/controllers/journal_tocs_controller +90 -0
- data/app/controllers/js_helper_controller.rb +2 -3
- data/app/controllers/link_router_controller.rb +32 -43
- data/app/controllers/open_search_controller.rb +3 -4
- data/app/controllers/resolve_controller.rb +68 -107
- data/app/controllers/resource_controller.rb +14 -20
- data/app/controllers/search_controller.rb +75 -94
- data/app/controllers/search_methods/README.md +28 -0
- data/app/controllers/search_methods/sfx4.rb +50 -119
- data/app/controllers/search_methods/sfx4_solr/README.md +57 -0
- data/app/controllers/search_methods/sfx4_solr/local.rb +40 -0
- data/app/controllers/search_methods/sfx4_solr/searcher.rb +90 -0
- data/app/controllers/store_controller.rb +24 -30
- data/app/controllers/umlaut/controller_behavior.rb +45 -17
- data/app/controllers/umlaut/error_handling.rb +20 -25
- data/{lib → app/controllers}/umlaut_configurable.rb +35 -21
- data/app/controllers/umlaut_controller.rb +43 -46
- data/app/helpers/emailer_helper.rb +9 -16
- data/app/helpers/export_email_helper.rb +8 -8
- data/app/helpers/open_search_helper.rb +2 -3
- data/app/helpers/resolve_helper.rb +130 -100
- data/app/helpers/search_helper.rb +17 -5
- data/app/helpers/umlaut/footer_helper.rb +1 -1
- data/app/helpers/umlaut/helper.rb +34 -0
- data/app/helpers/umlaut/html_head_helper.rb +12 -21
- data/{lib → app/mixin_logic}/marc_helper.rb +1 -1
- data/{lib → app/mixin_logic}/metadata_helper.rb +6 -5
- data/{lib → app/mixin_logic}/umlaut_http.rb +0 -0
- data/{lib → app/mixin_logic}/xml_schema_helper.rb +0 -0
- data/app/models/collection.rb +97 -95
- data/{lib → app/models}/hip3/bib.rb +0 -0
- data/{lib → app/models}/hip3/bib_searcher.rb +0 -0
- data/{lib → app/models}/hip3/custom_field_lookup.rb +0 -0
- data/{lib → app/models}/hip3/holding.rb +0 -0
- data/{lib → app/models}/hip3/item.rb +0 -0
- data/{lib → app/models}/hip3/receipt.rb +0 -0
- data/{lib → app/models}/hip3/serial_copy.rb +0 -0
- data/app/models/permalink.rb +3 -8
- data/app/models/referent.rb +29 -21
- data/app/models/request.rb +19 -8
- data/app/models/service_response.rb +24 -3
- data/app/models/service_store.rb +108 -39
- data/app/models/service_store.rb-NEW +73 -0
- data/app/models/service_wave.rb +2 -0
- data/app/models/sfx4/abstract/README.md +68 -0
- data/app/models/sfx4/abstract/az_extra_info.rb +44 -0
- data/app/models/sfx4/abstract/az_letter_group.rb +24 -0
- data/app/models/sfx4/abstract/az_title.rb +96 -0
- data/app/models/sfx4/abstract/az_title_search.rb +24 -0
- data/app/models/sfx4/abstract/base.rb +77 -0
- data/app/models/sfx4/global/base.rb +24 -0
- data/app/models/sfx4/global/kb_objects.rb +34 -0
- data/app/models/sfx4/local/az_extra_info.rb +7 -0
- data/app/models/sfx4/local/az_letter_group.rb +7 -0
- data/app/models/sfx4/local/az_title.rb +7 -0
- data/app/models/sfx4/local/az_title_search.rb +7 -0
- data/app/models/sfx4/local/base.rb +26 -0
- data/{lib → app/presentation}/section_renderer.rb +0 -12
- data/app/referent_filters/dissertation_catch.rb +67 -0
- data/{lib → app/referent_filters}/referent_filter.rb +0 -0
- data/{lib → app}/service_adaptors/ajax_export.rb +0 -0
- data/{lib → app}/service_adaptors/amazon.rb +2 -0
- data/{lib → app}/service_adaptors/blacklight.rb +22 -10
- data/{lib → app}/service_adaptors/book_finder.rb +0 -0
- data/{lib → app}/service_adaptors/bx.rb +0 -0
- data/{lib → app}/service_adaptors/cover_thing.rb +0 -0
- data/{lib → app}/service_adaptors/dummy_service.rb +0 -0
- data/{lib → app}/service_adaptors/elsevier_cover.rb +0 -0
- data/{lib → app}/service_adaptors/email_export.rb +0 -0
- data/{lib → app}/service_adaptors/ezproxy.rb +0 -0
- data/{lib → app}/service_adaptors/google_book_search.rb +0 -0
- data/app/service_adaptors/google_scholar_link.rb +71 -0
- data/{lib → app}/service_adaptors/gpo.rb +0 -0
- data/{lib → app}/service_adaptors/hathi_trust.rb +0 -0
- data/{lib → app}/service_adaptors/hip3_service.rb +0 -0
- data/{lib → app}/service_adaptors/hip_holding_search.rb +0 -0
- data/{lib → app}/service_adaptors/internet_archive.rb +0 -0
- data/{lib → app}/service_adaptors/isbn_db.rb +0 -0
- data/{lib → app}/service_adaptors/isi.rb +22 -13
- data/{lib → app}/service_adaptors/jcr.rb +0 -0
- data/{lib → app}/service_adaptors/opac.rb +0 -0
- data/{lib → app}/service_adaptors/open_library.rb +0 -0
- data/{lib → app}/service_adaptors/open_library_cover.rb +0 -0
- data/{lib → app}/service_adaptors/pubmed.rb +0 -0
- data/{lib → app}/service_adaptors/request_to_fixture.rb +0 -0
- data/{lib → app}/service_adaptors/scopus.rb +0 -0
- data/{lib → app/service_adaptors}/service.rb +3 -3
- data/{lib → app}/service_adaptors/sfx.rb +154 -11
- data/{lib → app}/service_adaptors/sfx_backchannel_record.rb +0 -0
- data/app/service_adaptors/tr_link.rb +267 -0
- data/app/service_adaptors/tr_links.rb +278 -0
- data/{lib → app}/service_adaptors/txt_holding_export.rb +0 -0
- data/{lib → app}/service_adaptors/ulrichs_cover.rb +0 -0
- data/{lib → app}/service_adaptors/ulrichs_link.rb +0 -0
- data/{lib → app}/service_adaptors/worldcat.rb +0 -0
- data/{lib → app}/service_adaptors/worldcat_identities.rb +0 -0
- data/app/views/admin/service_errors/_dispatched_service.html.erb +13 -13
- data/app/views/admin/service_errors/index.html.erb +11 -21
- data/app/views/export_email/email.html.erb +17 -2
- data/app/views/export_email/send_email.html.erb +2 -1
- data/app/views/export_email/send_txt.html.erb +2 -1
- data/app/views/export_email/txt.html.erb +30 -2
- data/app/views/layouts/umlaut.html.erb +29 -49
- data/app/views/resolve/_background_progress.html.erb +43 -50
- data/app/views/resolve/_background_updater.html.erb +23 -36
- data/app/views/resolve/_citation.html.erb +63 -87
- data/app/views/resolve/_compact_citation.html.erb +15 -33
- data/app/views/resolve/_cover_image.html.erb +34 -43
- data/app/views/resolve/_fulltext.html.erb +29 -50
- data/app/views/resolve/_help.html.erb +17 -14
- data/app/views/resolve/_holding.html.erb +65 -82
- data/app/views/resolve/_manually_entered_warning.html.erb +7 -0
- data/app/views/resolve/_modal.html.erb +19 -0
- data/app/views/resolve/_related_items.html.erb +20 -35
- data/app/views/resolve/_search_inside.html.erb +34 -57
- data/app/views/resolve/_section_display.html.erb +34 -46
- data/app/views/resolve/_section_heading.html.erb +17 -0
- data/app/views/resolve/_service_errors.html.erb +27 -28
- data/app/views/resolve/_standard_response_item.html.erb +42 -72
- data/app/views/resolve/background_status.html.erb +19 -23
- data/app/views/resolve/get_permalink.html.erb +6 -0
- data/app/views/resolve/index.html.erb +47 -73
- data/app/views/search/_a_to_z.html.erb +9 -6
- data/app/views/search/_citation.html.erb +73 -94
- data/app/views/search/_pager.html.erb +6 -6
- data/app/views/search/books.html.erb +34 -102
- data/app/views/search/journal_search.html.erb +53 -90
- data/app/views/search/journals.html.erb +73 -167
- data/app/views/umlaut/_header.html.erb +9 -0
- data/app/views/umlaut/error.html.erb +44 -44
- data/config/locales/en.yml +5 -0
- data/lib/{CronTab.rb → cron_tab.rb} +0 -0
- data/lib/generators/templates/umlaut_services.yml +57 -43
- data/lib/generators/umlaut/install_generator.rb +12 -0
- data/lib/service_adaptors/README.md +0 -0
- data/lib/tasks/umlaut.rake +8 -24
- data/lib/umlaut.rb +1 -21
- data/lib/umlaut/version.rb +1 -1
- data/test/README.md +75 -0
- data/test/dummy/app/controllers/umlaut_controller.rb +3 -3
- data/test/dummy/config/application.rb +3 -0
- data/test/dummy/config/sunspot.yml +20 -0
- data/test/dummy/config/travis_database.yml +96 -0
- data/test/dummy/config/umlaut_services.yml +16 -23
- data/test/dummy/db/migrate/20120927163304_sfx4_global.rb +26 -0
- data/test/dummy/db/migrate/20120927164040_sfx4_local.rb +54 -0
- data/test/dummy/tmp/cache/assets/BBA/6A0/sprockets%2F2a335471966f33256b321f8324041981 +0 -0
- data/test/dummy/tmp/cache/assets/C2A/410/sprockets%2Fd654b74912b4773a2534616863fb6565 +0 -0
- data/test/dummy/tmp/cache/assets/C45/A30/sprockets%2F39494895e462697b478d3d0c79298a26 +0 -0
- data/test/dummy/tmp/cache/assets/C49/730/sprockets%2F212d35831188417b5131e3e693aa69a6 +0 -0
- data/test/dummy/tmp/cache/assets/C55/1D0/sprockets%2F5af2f2a3403040f736981863fd278529 +0 -0
- data/test/dummy/tmp/cache/assets/C5A/A80/sprockets%2F2328c7370b56b4151776981a5f6d394e +0 -0
- data/test/dummy/tmp/cache/assets/C5F/340/sprockets%2F99692920160b7a279b86a80415b79db7 +0 -0
- data/test/dummy/tmp/cache/assets/C70/4D0/sprockets%2F034ad2036e623081bd352800786dfe80 +0 -0
- data/test/dummy/tmp/cache/assets/C80/980/sprockets%2Fc94807409c1523d43e18d25f35d93c41 +0 -0
- data/test/dummy/tmp/cache/assets/C94/E20/sprockets%2F19579abc248373f419b1c3e287d74598 +0 -0
- data/test/dummy/tmp/cache/assets/C98/330/sprockets%2F0c81574ba94abc10657315d4190c201f +0 -0
- data/test/dummy/tmp/cache/assets/CA4/440/sprockets%2F0feb4425db6319d7d0582192a503671b +0 -0
- data/test/dummy/tmp/cache/assets/CA7/E80/sprockets%2F33310f455a870eaedd6d938e30620714 +0 -0
- data/test/dummy/tmp/cache/assets/CB8/3C0/sprockets%2F697cd846490fda9f0e20c558320610f8 +0 -0
- data/test/dummy/tmp/cache/assets/CBF/B60/sprockets%2F08ca89671549936265dcb673bf02e36f +0 -0
- data/test/dummy/tmp/cache/assets/CC7/F10/sprockets%2F939637f806eef3f0f21584659458ab2e +0 -0
- data/test/dummy/tmp/cache/assets/CC9/9F0/sprockets%2F306166316e2cafd13c15e62b51a2339d +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CF7/2B0/sprockets%2F25a7c73655bd3598173b39d9f98bcd46 +0 -0
- data/test/dummy/tmp/cache/assets/CF8/DA0/sprockets%2Ff5b8c8499d3da954d392fa57739503c5 +0 -0
- data/test/dummy/tmp/cache/assets/CF9/590/sprockets%2F096bcc45cd31b3796fa2121cd203215f +0 -0
- data/test/dummy/tmp/cache/assets/CFE/080/sprockets%2F37fe9f4255baddbd549a659914929398 +0 -0
- data/test/dummy/tmp/cache/assets/D04/CC0/sprockets%2Fe9c1b92f2e437e1bbbe020d718739220 +0 -0
- data/test/dummy/tmp/cache/assets/D0B/090/sprockets%2F58009091c95e3ac328c91c68fca30e0e +0 -0
- data/test/dummy/tmp/cache/assets/D1A/B50/sprockets%2F2db5892438129fe94da8429b8be114ec +0 -0
- data/test/dummy/tmp/cache/assets/D2D/1A0/sprockets%2F376426b4896a3cff7969ce6c7b387e0e +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D37/2B0/sprockets%2F40834fb07d7318c1fddd5003bd9e04f6 +0 -0
- data/test/dummy/tmp/cache/assets/D43/0D0/sprockets%2F682843a8d0795a5fbcfeb2f0c81727d0 +0 -0
- data/test/dummy/tmp/cache/assets/D46/F80/sprockets%2Fb15c08e749067d7aad9baf5e9388221c +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D6C/7D0/sprockets%2F8a05d6981ec0d38c51739bef0b3a9c2b +0 -0
- data/test/dummy/tmp/cache/assets/D6E/CF0/sprockets%2F5661c6e4f0cea86fe4523f27261aade5 +0 -0
- data/test/dummy/tmp/cache/assets/D94/FF0/sprockets%2F3b56a1aa77de0d570c38a4a9d5f4b1d6 +0 -0
- data/test/dummy/tmp/cache/assets/D97/6B0/sprockets%2Fb070e8c799d1a4ad5e62e0a1ae3b83e6 +0 -0
- data/test/dummy/tmp/cache/assets/D9A/2F0/sprockets%2Fbba0f4b972dc53c15ce6c8c1993b82a4 +0 -0
- data/test/dummy/tmp/cache/assets/D9C/860/sprockets%2Fec2d9f20b270d70e698ff33e53c21fca +0 -0
- data/test/dummy/tmp/cache/assets/DA6/A80/sprockets%2F92e26d8e58d5bcc8b8f6c25d1b05b9c1 +0 -0
- data/test/dummy/tmp/cache/assets/DA8/BB0/sprockets%2F0cf1c7e9f966dce425517c0e2a844efe +0 -0
- data/test/dummy/tmp/cache/assets/DA9/BC0/sprockets%2Fcb9062b73291befe5e5bf2a70978dec8 +0 -0
- data/test/dummy/tmp/cache/assets/DB6/ED0/sprockets%2Ff4482d9b9f76fb65eef16430bde2f8e6 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 +0 -0
- data/test/dummy/tmp/cache/assets/DF7/960/sprockets%2F99ac6db10b44a64fbba4ee847b35ba8b +0 -0
- data/test/dummy/tmp/cache/assets/DFD/300/sprockets%2Fabac9489cf7f1db8ef00d72a1571ee1e +0 -0
- data/test/dummy/tmp/cache/assets/E02/C10/sprockets%2F1463cadfce3fc70e61d482f9fcb75ac7 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E38/FE0/sprockets%2Fe1fc875efa817cbb94a5d8de25ea4e6b +0 -0
- data/test/dummy/tmp/cache/assets/E50/F00/sprockets%2Fec61afdbb1cc4df075e3dad46f0af571 +0 -0
- data/test/dummy/tmp/cache/assets/E5E/5F0/sprockets%2Feffaeb4d7f9bf4c0cc840ff320fde046 +0 -0
- data/test/dummy/tmp/cache/assets/E5F/960/sprockets%2Fdc007b6cad5c7ef08e33ec28cfff0ef6 +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_accordion.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_alerts.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_breadcrumbs.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_button-groups.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_buttons.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_carousel.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_close.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_code.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_component-animations.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_dropdowns.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_forms.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_grid.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_hero-unit.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_labels-badges.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_layouts.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_media.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_mixins.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_modals.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_navbar.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_navs.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_pager.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_pagination.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_popovers.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_progress-bars.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_reset.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-1200px-min.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-767px-max.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-768px-979px.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-navbar.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_responsive-utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_scaffolding.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_sprites.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_tables.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_thumbnails.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_tooltip.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_type.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_utilities.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_variables.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/_wells.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/bootstrap.scssc +0 -0
- data/test/dummy/tmp/cache/sass/310d901c169042855feb8cf3903e1e2821d27f13/responsive.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_admin.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_az.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_base.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_forms.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_icons.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_misc.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_mixins.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_modal.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_resolve.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_results.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_search.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_spinner.scssc +0 -0
- data/test/dummy/tmp/cache/sass/3af72421a0fbed39d3047687ca0ad6e6e5545041/_variables.scssc +0 -0
- data/test/dummy/tmp/cache/sass/93d65682d6bddb0b2e6788c1232f4849af20a35e/bootstrap-responsive.scssc +0 -0
- data/test/dummy/tmp/cache/sass/93d65682d6bddb0b2e6788c1232f4849af20a35e/bootstrap.scssc +0 -0
- data/test/dummy/tmp/cache/sass/fb58c04fd15fcc38a8c4d91b7070bcfeaf1c3799/umlaut.css.scssc +0 -0
- data/test/fixtures/dispatched_services.yml +0 -4
- data/test/fixtures/permalinks.yml +23 -4
- data/test/fixtures/referent_values.yml +226 -1493
- data/test/fixtures/referents.yml +14 -137
- data/test/fixtures/requests.yml +22 -260
- data/test/fixtures/service_responses.yml +169 -5
- data/test/fixtures/sfx4/global/KB_OBJECTS.yml +46 -0
- data/test/fixtures/sfx4/local/AZ_EXTRA_INFO.yml +4802 -0
- data/test/fixtures/sfx4/local/AZ_LETTER_GROUP.yml +105 -0
- data/test/fixtures/sfx4/local/AZ_TITLE.yml +165 -0
- data/test/fixtures/sfx4/local/AZ_TITLE_SEARCH.yml +341 -0
- data/test/fixtures/sfx_urls.yml +3 -0
- data/test/functional/export_email_controller_test.rb +43 -0
- data/test/functional/link_router_controller_test.rb +16 -0
- data/test/functional/resolve_controller_test.rb +102 -0
- data/test/functional/search_controller_test.rb +40 -0
- data/test/functional/store_controller_test.rb +29 -0
- data/test/helper/list_with_limit_test.rb +90 -0
- data/test/integration/permalinks_test.rb +14 -0
- data/test/support/search_methods/test_case.rb +0 -0
- data/test/support/service_adaptors/test_case.rb +0 -0
- data/test/support/test_with_cassette.rb +37 -0
- data/test/test_helper.rb +76 -30
- data/test/unit/aws_product_sign_test.rb +2 -0
- data/test/unit/determine_services_test.rb +163 -0
- data/test/unit/google_book_search_test.rb +8 -25
- data/test/unit/google_scholar_link_test.rb +81 -0
- data/test/unit/internet_archive_test.rb +33 -0
- data/test/unit/permalink_test.rb +15 -0
- data/test/unit/service_store_test.rb +47 -0
- data/test/unit/service_test.rb +28 -13
- data/test/unit/sfx/sfx_target_roll_up_test.rb +369 -0
- data/test/unit/sfx4_search_test.rb +102 -0
- data/test/unit/sfx4_solr_search_test.rb +77 -0
- data/test/unit/sfx_test.rb +38 -0
- data/test/unit/worldcat_test.rb +7 -0
- data/test/vcr_cassettes/google_book_search/frankenstein_by_OCLC_number.yml +107 -0
- data/test/vcr_cassettes/internet_archive/momo_by_title_author.yml +116 -0
- data/test/vcr_cassettes/resolve/fulltext_with_edition_warning.yml +44 -0
- data/test/vcr_cassettes/resolve/no_holdings.yml +649 -0
- data/test/vcr_cassettes/resolve/nytimes_by_issn.yml +224 -0
- data/test/vcr_cassettes/sfx/nytimes_by_issn.yml +1395 -0
- data/test/vcr_cassettes/sfx4_solr/find_by_group.yml +109 -0
- data/test/vcr_cassettes/sfx4_solr/find_by_title_begins_with.yml +33 -0
- data/test/vcr_cassettes/sfx4_solr/find_by_title_contains.yml +34 -0
- data/test/vcr_cassettes/sfx4_solr/find_by_title_exact.yml +32 -0
- data/test/view/holding_test.rb +30 -0
- metadata +435 -179
- data/app/assets/images/export_bg_bot.gif +0 -0
- data/app/assets/images/export_bg_mid.gif +0 -0
- data/app/assets/images/export_bg_top.gif +0 -0
- data/app/assets/images/famfamfam/page_sound.gif +0 -0
- data/app/assets/images/famfamfam/page_text.gif +0 -0
- data/app/assets/images/famfamfam/page_up.gif +0 -0
- data/app/assets/images/ico_go.gif +0 -0
- data/app/assets/images/more_info.gif +0 -0
- data/app/assets/images/rails.png +0 -0
- data/app/assets/images/request.gif +0 -0
- data/app/assets/javascripts/umlaut/simple_visible_toggle.js +0 -8
- data/app/assets/stylesheets/umlaut.css +0 -900
- data/app/assets/stylesheets/umlaut/_background_progress_spinner.scss +0 -21
- data/app/assets/stylesheets/umlaut/_expand_contract.scss +0 -28
- data/app/controllers/search_methods/sfx3.rb +0 -148
- data/app/models/sfx_db.rb +0 -10
- data/app/models/sfx_db/az_additional_title.rb +0 -11
- data/app/models/sfx_db/az_letter_group.rb +0 -11
- data/app/models/sfx_db/az_title.rb +0 -40
- data/app/models/sfx_db/az_title_v2.rb +0 -34
- data/app/models/sfx_db/isbn.rb +0 -12
- data/app/models/sfx_db/issn.rb +0 -12
- data/app/models/sfx_db/object.rb +0 -35
- data/app/models/sfx_db/object_portfolio.rb +0 -6
- data/app/models/sfx_db/publisher.rb +0 -10
- data/app/models/sfx_db/sfx_db_base.rb +0 -58
- data/app/models/sfx_db/target.rb +0 -10
- data/app/models/sfx_db/target_service.rb +0 -10
- data/app/models/sfx_db/title.rb +0 -10
- data/app/views/export_email/_email.html.erb +0 -25
- data/app/views/export_email/_send_email.html.erb +0 -3
- data/app/views/export_email/_send_txt.html.erb +0 -3
- data/app/views/export_email/_txt.html.erb +0 -62
- data/lib/holding.rb +0 -32
- data/lib/opensearch_feed.rb +0 -398
- data/lib/opensearch_query.rb +0 -98
- data/lib/referent_filters/dissertation_catch.rb +0 -45
- data/lib/service_adaptors/journal_tocs.progress +0 -68
- data/lib/service_adaptors/primo_service.rb +0 -452
- data/lib/service_adaptors/primo_source.rb +0 -82
- data/lib/umlaut/default_configuration.rb +0 -5
- data/test/dummy/config/primo.yml +0 -271
- data/test/unit/primo_service_test.rb +0 -947
@@ -15,7 +15,7 @@ module Umlaut::FooterHelper
|
|
15
15
|
content << umlaut_config.footer_credit + " | "
|
16
16
|
end
|
17
17
|
|
18
|
-
content << "Powered by ".html_safe + link_to("Umlaut", "
|
18
|
+
content << "Powered by ".html_safe + link_to("Umlaut", "https://github.com/team-umlaut/umlaut") + ". ".html_safe
|
19
19
|
|
20
20
|
credit_segments = []
|
21
21
|
|
@@ -58,5 +58,39 @@ module Umlaut::Helper
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
|
62
|
+
|
63
|
+
# Button for showing permalink, dynamically loaded
|
64
|
+
# with js if neccesary. works with load_permalink.js
|
65
|
+
def render_umlaut_permalink
|
66
|
+
if @user_request
|
67
|
+
content_tag("div", :class => "umlaut-permalink") do
|
68
|
+
render_umlaut_permalink_toggle +
|
69
|
+
render_umlaut_permalink_content
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def render_umlaut_permalink_toggle
|
75
|
+
|
76
|
+
link_to({:action => "get_permalink", :"umlaut.request_id" => @user_request.id},
|
77
|
+
:class => "umlaut-load-permalink btn btn-mini",
|
78
|
+
:data => {"umlaut-toggle-permalink"=>"true"}) do
|
79
|
+
content_tag("i") + " Short link"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Proper content area to be shown by umlaut_permalink_toggle,
|
84
|
+
# and loaded with content AJAXy.
|
85
|
+
def render_umlaut_permalink_content
|
86
|
+
content_tag("div",
|
87
|
+
:id => "umlaut-permalink-value",
|
88
|
+
:class=> "umlaut-permalink-value",
|
89
|
+
:style => "display: none;",
|
90
|
+
:'data-loaded' => current_permalink_url.present? ) do
|
91
|
+
link_to(current_permalink_url, current_permalink_url) if current_permalink_url
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
61
95
|
|
62
96
|
end
|
@@ -1,42 +1,33 @@
|
|
1
1
|
# Rails view helpers for outputting standard Umlaut content included
|
2
2
|
# in html <head>. Generally a layout will call #render_umlaut_head_content
|
3
|
-
# to render all standard Umlaut <head> content in a future-compatible way.
|
3
|
+
# to render all standard Umlaut <head> content in a future-compatible way.
|
4
4
|
module Umlaut::HtmlHeadHelper
|
5
|
-
|
5
|
+
|
6
6
|
# usually called in layout, render a link tag with opensearch auto-discovery
|
7
7
|
def render_opensearch_link
|
8
|
-
tag("link",
|
9
|
-
:rel => "search",
|
10
|
-
:type => "application/opensearchdescription+xml",
|
8
|
+
tag("link", :rel => "search", :type => "application/opensearchdescription+xml",
|
11
9
|
:title => umlaut_config.opensearch_short_name,
|
12
|
-
:href => url_for(:controller=>'open_search', :only_path=>false)
|
13
|
-
)
|
10
|
+
:href => url_for(:controller=>'open_search', :only_path=>false))
|
14
11
|
end
|
15
|
-
|
12
|
+
|
16
13
|
# used on non-js progress page, we need to refresh the page
|
17
|
-
# if requested by presence of @meta_refresh_self ivar.
|
18
|
-
# this method usually called in a layout.
|
14
|
+
# if requested by presence of @meta_refresh_self ivar.
|
15
|
+
# this method usually called in a layout.
|
19
16
|
def render_meta_refresh
|
20
|
-
|
21
|
-
tag(
|
22
|
-
"http-equiv" => "refresh",
|
23
|
-
"content" => @meta_refresh_self
|
24
|
-
)
|
25
|
-
else
|
26
|
-
""
|
27
|
-
end
|
17
|
+
(@meta_refresh_self) ?
|
18
|
+
tag("meta", "http-equiv" => "refresh", "content" => @meta_refresh_self) : ""
|
28
19
|
end
|
29
|
-
|
20
|
+
|
30
21
|
# standard umlaut head content, may later include more
|
31
22
|
# stuff, local/custom layouts should call this in HEAD
|
32
23
|
# to get forwards-compatible umlaut standard head content
|
33
24
|
def render_umlaut_head_content
|
34
25
|
render_opensearch_link + render_meta_refresh
|
35
26
|
end
|
36
|
-
|
27
|
+
|
37
28
|
# String meant for use in <title>
|
38
29
|
def umlaut_title_text
|
39
30
|
umlaut_config.app_name + (@page_title ? " | #{@page_title}" : "")
|
40
31
|
end
|
41
32
|
|
42
|
-
end
|
33
|
+
end
|
@@ -222,7 +222,7 @@ module MarcHelper
|
|
222
222
|
if options[:include_repro_info] && marc['533']
|
223
223
|
marc['533'].subfields.each do |s|
|
224
224
|
if ( s.code == 'a' )
|
225
|
-
parts.push(
|
225
|
+
parts.push(s.value.gsub(/[^\w\s]/, '') + ':' )
|
226
226
|
elsif (! options[:exclude_533_fields].include?( s.code ))
|
227
227
|
parts.push(s.value)
|
228
228
|
end
|
@@ -302,11 +302,12 @@ module MetadataHelper
|
|
302
302
|
end
|
303
303
|
|
304
304
|
# Look at weird bad OpenURLs, use heuristics to see if the 'title' probably
|
305
|
-
# represents a journal rather than a book.
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
rft.metadata['
|
305
|
+
# represents a journal rather than a book. A guess at best, based on the bad
|
306
|
+
# data we've seen, sigh.
|
307
|
+
def title_is_serial?(rft)
|
308
|
+
rft.format != "book" &&
|
309
|
+
( rft.metadata['jtitle'].present? || %w{journal article}.include?(rft.metadata["genre"]) ) &&
|
310
|
+
rft.metadata['btitle'].blank?
|
310
311
|
end
|
311
312
|
|
312
313
|
end
|
File without changes
|
File without changes
|
data/app/models/collection.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'cron_tab' # for understanding CronTab format for expiring responses.
|
2
2
|
|
3
3
|
# A Collection object encapsulates a given UmlautRequest, and a given
|
4
4
|
# list of Umlaut services that should be run off that request.
|
@@ -6,35 +6,37 @@ require 'CronTab' # for understanding CronTab format for expiring responses.
|
|
6
6
|
# That's exactly what it's initialized with: an umlaut request, and
|
7
7
|
# list of service definitions. Third parameter pass in an umlaut configuration
|
8
8
|
# object, to get various timeout values. If you don't pass one in, defaults
|
9
|
-
# will be used.
|
9
|
+
# will be used.
|
10
10
|
#
|
11
|
-
# The Collection holds and executes the logic for running those services,
|
11
|
+
# The Collection holds and executes the logic for running those services,
|
12
12
|
# foreground and background, making sure no service is run twice if it's
|
13
|
-
# already in progress, timing out expired services, etc.
|
13
|
+
# already in progress, timing out expired services, etc.
|
14
14
|
class Collection
|
15
|
-
|
15
|
+
|
16
16
|
attr_accessor :umlaut_request
|
17
17
|
attr_accessor :logger
|
18
18
|
# configs
|
19
19
|
attr_accessor :response_expire_interval, :response_expire_crontab_format, :background_service_timeout, :requeue_failedtemporary_services
|
20
|
+
|
21
|
+
|
20
22
|
|
21
23
|
# a_umlaut_request is an UmlautRequest, representing a request for services for a context
|
22
|
-
# object.
|
23
|
-
# service_hash is a hash of hashes with service definitions, as would
|
24
|
+
# object.
|
25
|
+
# service_hash is a hash of hashes with service definitions, as would
|
24
26
|
# be in services.yml
|
25
27
|
# config is a Confstruct::Configuration associated with the current controller,
|
26
28
|
# has a few config options in it relevant to collection service exec; but
|
27
|
-
# don't pass in, we'll use a blank one with default values, no prob.
|
28
|
-
def initialize(a_umlaut_request, service_hash, config = Confstruct::Configuration.new)
|
29
|
+
# don't pass in, we'll use a blank one with default values, no prob.
|
30
|
+
def initialize(a_umlaut_request, service_hash, config = Confstruct::Configuration.new)
|
29
31
|
self.umlaut_request = a_umlaut_request
|
30
|
-
|
32
|
+
|
31
33
|
self.logger = Rails.logger
|
32
|
-
|
34
|
+
|
33
35
|
self.response_expire_interval = config.lookup!("response_expire_interval", 1.day)
|
34
36
|
self.response_expire_crontab_format = config.lookup!("response_expire_crontab_format", nil)
|
35
37
|
self.background_service_timeout = config.lookup!("background_service_timeout", 30.seconds)
|
36
38
|
self.requeue_failedtemporary_services = config.lookup!("requeue_failedtemporary_services", 500.seconds)
|
37
|
-
|
39
|
+
|
38
40
|
# @service_definitions will be a two-level hash, pointing to an array.. Task is Standard, LinkOut, etc.
|
39
41
|
# { [task] => { [priority_level] => [config1, config2, config3],
|
40
42
|
# [priority_level_2] => [configa], }
|
@@ -43,7 +45,7 @@ class Collection
|
|
43
45
|
@service_definitions_flat = service_hash
|
44
46
|
@service_definitions = {}
|
45
47
|
|
46
|
-
# Arrange services by type and priority in @service_definitions
|
48
|
+
# Arrange services by type and priority in @service_definitions
|
47
49
|
gather_services
|
48
50
|
end
|
49
51
|
|
@@ -52,103 +54,103 @@ class Collection
|
|
52
54
|
# in progress.
|
53
55
|
#
|
54
56
|
# This method can be run on a request multiple times, it'll only re-execute
|
55
|
-
# services that are executable (not already running, or timed out).
|
57
|
+
# services that are executable (not already running, or timed out).
|
56
58
|
# That characteristic is used when this method is called on a page refresh
|
57
|
-
# or background update status check.
|
59
|
+
# or background update status check.
|
58
60
|
#
|
59
61
|
# Sets all services in collection to have a 'queued' status if appropriate.
|
60
|
-
# Then actually executes the services that are dispatchable (queued).
|
62
|
+
# Then actually executes the services that are dispatchable (queued).
|
61
63
|
def dispatch_services!
|
62
64
|
queued_service_ids = prepare_for_dispatch!
|
63
|
-
|
65
|
+
|
64
66
|
dispatch_foreground!(queued_service_ids)
|
65
|
-
|
66
|
-
dispatch_background!(queued_service_ids)
|
67
|
+
|
68
|
+
dispatch_background!(queued_service_ids)
|
67
69
|
end
|
68
|
-
|
70
|
+
|
69
71
|
# Call prepare_for_dispatch! first, the return value from that call
|
70
72
|
# is suitable as argument for this call: queued_service_ids, list of
|
71
73
|
# service id's already identified as suitable for running, and
|
72
|
-
# marked queued in the DispatchedService table.
|
74
|
+
# marked queued in the DispatchedService table.
|
73
75
|
#
|
74
76
|
# Will run such services in foreground priority waves. And then reload
|
75
77
|
# the UmlautRequest object in the current thread, to pick up any
|
76
|
-
# changes made in service threads.
|
78
|
+
# changes made in service threads.
|
77
79
|
def dispatch_foreground!(queued_service_ids)
|
78
80
|
# Foreground services
|
79
|
-
(0..9).each do | priority |
|
81
|
+
(0..9).each do | priority |
|
80
82
|
services_to_run = self.instantiate_services!(:level => priority, :ids => queued_service_ids)
|
81
|
-
next if services_to_run.empty?
|
83
|
+
next if services_to_run.empty?
|
82
84
|
ServiceWave.new(services_to_run , priority).handle(umlaut_request, umlaut_request.session_id)
|
83
85
|
end
|
84
|
-
|
86
|
+
|
85
87
|
# Need to reload the request from db, so it gets changes
|
86
88
|
# made by services in threads, so future code (such as view rendering)
|
87
|
-
# will see changes.
|
89
|
+
# will see changes.
|
88
90
|
umlaut_request.reload
|
89
91
|
end
|
90
|
-
|
92
|
+
|
91
93
|
# Call prepare_for_dispatch! first, the return value from that call
|
92
94
|
# is suitable as argument for this call: queued_service_ids, list of
|
93
95
|
# service id's already identified as suitable for running, and
|
94
96
|
# marked queued in the DispatchedService table.
|
95
97
|
#
|
96
|
-
# Will run such services in background priority waves.
|
98
|
+
# Will run such services in background priority waves.
|
97
99
|
def dispatch_background!(queued_service_ids)
|
98
100
|
# Now we do some crazy magic, start a Thread to run our background
|
99
101
|
# services. We are NOT going to wait for this thread to join,
|
100
102
|
# we're going to let it keep doing it's thing in the background after
|
101
103
|
# we return a response to the browser
|
102
104
|
backgroundThread = Thread.new(self, umlaut_request) do | t_collection, t_request|
|
103
|
-
|
105
|
+
|
104
106
|
# Tell our AR extension not to allow implicit checkouts
|
105
107
|
ActiveRecord::Base.forbid_implicit_checkout_for_thread! if ActiveRecord::Base.respond_to?("forbid_implicit_checkout_for_thread!")
|
106
|
-
|
108
|
+
|
107
109
|
begin
|
108
110
|
# Set priority to lower for background thread; may or may not
|
109
|
-
# actually have an effect in MRI, unclear, but can't hurt.
|
111
|
+
# actually have an effect in MRI, unclear, but can't hurt.
|
110
112
|
prior = Thread.current.priority
|
111
|
-
Thread.current.priority = prior - 1
|
112
|
-
|
113
|
+
Thread.current.priority = prior - 1
|
114
|
+
|
113
115
|
# Try to give the thread scheduler another hint, really, get
|
114
|
-
# other stuff done before this thread.
|
116
|
+
# other stuff done before this thread.
|
115
117
|
Thread.pass
|
116
|
-
|
117
|
-
|
118
|
+
|
119
|
+
|
118
120
|
('a'..'z').each do | priority |
|
119
121
|
services_to_run = self.instantiate_services!(:level => priority, :ids => queued_service_ids)
|
120
122
|
next if services_to_run.empty?
|
121
|
-
ServiceWave.new(services_to_run , priority).handle(umlaut_request, umlaut_request.session_id)
|
122
|
-
end
|
123
|
+
ServiceWave.new(services_to_run , priority).handle(umlaut_request, umlaut_request.session_id)
|
124
|
+
end
|
123
125
|
rescue Exception => e
|
124
126
|
# We are divorced from any HTTP request at this point, and may not
|
125
127
|
# have access to an ActiveRecord connection. Not much
|
126
|
-
# we can do except log it.
|
128
|
+
# we can do except log it.
|
127
129
|
# If we're catching an exception here, service processing was
|
128
130
|
# probably interrupted, which is bad. You should not intentionally
|
129
131
|
# raise exceptions to be caught here.
|
130
132
|
#
|
131
133
|
# Normally even unexpected exceptions were caught inside the ServiceWave,
|
132
134
|
# and logged to db as well as logfile if possible, only bugs in ServiceWave
|
133
|
-
# itself should wind up caught here.
|
135
|
+
# itself should wind up caught here.
|
134
136
|
Thread.current[:exception] = e
|
135
|
-
logger.error("Background Service execution exception: #{e}\n\n " + clean_backtrace(e).join("\n"))
|
137
|
+
logger.error("Background Service execution exception: #{e}\n\n " + clean_backtrace(e).join("\n"))
|
136
138
|
end
|
137
139
|
end
|
138
140
|
end
|
139
|
-
|
140
|
-
|
141
|
+
|
142
|
+
|
141
143
|
# Goes through all services and marks them with a DispatchedService
|
142
|
-
# record in 'queued' state.
|
144
|
+
# record in 'queued' state.
|
143
145
|
#
|
144
|
-
# Will time out any too-old services in a running state.
|
146
|
+
# Will time out any too-old services in a running state.
|
145
147
|
#
|
146
|
-
# Will remove DispatchedService status for
|
148
|
+
# Will remove DispatchedService status for
|
147
149
|
# any services marked failed that are old enough to re-run, or services
|
148
|
-
# that are too old to re-use. Such services are then queuable.
|
150
|
+
# that are too old to re-use. Such services are then queuable.
|
149
151
|
#
|
150
152
|
# Returns array of Service identifiers for services that are now
|
151
|
-
# queued and execable.
|
153
|
+
# queued and execable.
|
152
154
|
def prepare_for_dispatch!
|
153
155
|
# Go through currently dispatched services, looking for timed out
|
154
156
|
# services -- services still in progress that have taken too long,
|
@@ -160,50 +162,50 @@ class Collection
|
|
160
162
|
if ( (ds.status == DispatchedService::InProgress ||
|
161
163
|
ds.status == DispatchedService::Queued ) &&
|
162
164
|
(Time.now - ds.updated_at) > self.background_service_timeout)
|
163
|
-
|
165
|
+
|
164
166
|
ds.store_exception( Exception.new("background service timed out (took longer than #{self.background_service_timeout} to run); thread assumed dead.")) unless ds.exception_info
|
165
|
-
# Fail it temporary, it'll be run again.
|
167
|
+
# Fail it temporary, it'll be run again.
|
166
168
|
ds.status = DispatchedService::FailedTemporary
|
167
169
|
ds.save!
|
168
170
|
logger.warn("Background service timed out, thread assumed dead. #{umlaut_request.id} / #{ds.service_id}")
|
169
171
|
end
|
170
|
-
|
172
|
+
|
171
173
|
# go through dispatched_services and delete:
|
172
|
-
# 1) old completed dispatches, too old to use.
|
174
|
+
# 1) old completed dispatches, too old to use.
|
173
175
|
# 2) failedtemporary dispatches that are older than our resurrection time
|
174
|
-
# -> And all responses associated with those dispatches.
|
175
|
-
# After being deleted, they'll end up re-queued.
|
176
|
+
# -> And all responses associated with those dispatches.
|
177
|
+
# After being deleted, they'll end up re-queued.
|
176
178
|
if ( (ds.completed? && completed_dispatch_expired?(ds) ) ||
|
177
179
|
( ds.status == DispatchedService::FailedTemporary &&
|
178
|
-
(Time.now - ds.updated_at) > self.requeue_failedtemporary_services
|
180
|
+
(Time.now - ds.updated_at) > self.requeue_failedtemporary_services
|
179
181
|
)
|
180
182
|
)
|
181
|
-
|
183
|
+
|
182
184
|
# Need to expire. Delete all the service responses, and
|
183
185
|
# the DispatchedService record, and service will be automatically
|
184
186
|
# run again.
|
185
187
|
serv_id = ds.service_id
|
186
|
-
|
187
|
-
umlaut_request.service_responses.each do |response|
|
188
|
+
|
189
|
+
umlaut_request.service_responses.each do |response|
|
188
190
|
if response.service_id == serv_id
|
189
|
-
umlaut_request.service_responses.delete(response)
|
191
|
+
umlaut_request.service_responses.delete(response)
|
190
192
|
response.destroy
|
191
193
|
end
|
192
194
|
end
|
193
|
-
|
195
|
+
|
194
196
|
umlaut_request.dispatched_services.delete(ds)
|
195
197
|
ds.destroy
|
196
198
|
end
|
197
199
|
end
|
198
|
-
|
200
|
+
|
199
201
|
# Queue any services without a dispatch marker at all, keeping
|
200
|
-
# track of queued services, already existing or newly created.
|
201
|
-
|
202
|
+
# track of queued services, already existing or newly created.
|
203
|
+
|
202
204
|
# Just in case, we're going to refetch dispatched_services from the db,
|
203
205
|
# in case some other http request or background service updated things
|
204
|
-
# recently.
|
206
|
+
# recently.
|
205
207
|
umlaut_request.dispatched_services.reset
|
206
|
-
|
208
|
+
|
207
209
|
self.get_service_definitions.each do |service|
|
208
210
|
service_id = service['service_id']
|
209
211
|
# use in-memory #to_a search, don't go to db each time!
|
@@ -212,61 +214,61 @@ class Collection
|
|
212
214
|
else
|
213
215
|
umlaut_request.new_dispatch_object!(service_id, DispatchedService::Queued).save!
|
214
216
|
queued_service_ids.push(service_id)
|
215
|
-
end
|
217
|
+
end
|
216
218
|
end
|
217
219
|
end
|
218
|
-
|
220
|
+
|
219
221
|
return queued_service_ids
|
220
222
|
end
|
221
|
-
|
223
|
+
|
222
224
|
def completed_dispatch_expired?(ds)
|
223
225
|
interval = self.response_expire_interval
|
224
226
|
crontab = self.response_expire_crontab_format
|
225
227
|
now = Time.now
|
226
|
-
|
227
|
-
return nil unless interval || crontab
|
228
|
-
|
228
|
+
|
229
|
+
return nil unless interval || crontab
|
230
|
+
|
229
231
|
expired_interval = interval && (now - ds.created_at > interval)
|
230
232
|
expired_crontab = crontab && (now > CronTab.new(crontab).nexttime(ds.created_at))
|
231
|
-
|
233
|
+
|
232
234
|
return expired_interval || expired_crontab
|
233
235
|
end
|
234
|
-
|
235
|
-
|
236
|
-
|
236
|
+
|
237
|
+
|
238
|
+
|
237
239
|
|
238
240
|
# Instantiate new copies of services included in this collection, which
|
239
241
|
# services specified by options, can combine:
|
240
242
|
# :task => Service::StandardTask (default) or Service::LinkOutFilterTask
|
241
243
|
# :level => priority level, default to returning services from all.
|
242
|
-
# :ids => list of id's, only those.
|
244
|
+
# :ids => list of id's, only those.
|
243
245
|
def instantiate_services!(options ={})
|
244
246
|
get_service_definitions(options).collect do |svc_def|
|
245
247
|
ServiceStore.instantiate_service!(svc_def, umlaut_request)
|
246
248
|
end
|
247
249
|
end
|
248
|
-
|
250
|
+
|
249
251
|
|
250
252
|
# Deprecated, use #instantiate_services! with :task => Service::LinkOutFilter.
|
251
253
|
def link_out_service_level(level)
|
252
|
-
instantiate_services!(:task => Service::LinkOutFilterTask,
|
254
|
+
instantiate_services!(:task => Service::LinkOutFilterTask,
|
253
255
|
:level => level)
|
254
256
|
end
|
255
257
|
|
256
|
-
|
258
|
+
|
257
259
|
|
258
260
|
# Get service definition hashes for services in this institution.
|
259
|
-
# options, returned in an array.
|
261
|
+
# options, returned in an array.
|
260
262
|
# Does return a mutatable array that Collection mutates
|
261
|
-
# internally, but clients really ought not to mutate.
|
263
|
+
# internally, but clients really ought not to mutate.
|
262
264
|
# :task => Service::StandardTask (default) or Service::LinkOutFilterTask
|
263
|
-
# :level => priority level, default to returning services from all.
|
264
|
-
# :ids => list of service unique ids, return only these.
|
265
|
+
# :level => priority level, default to returning services from all.
|
266
|
+
# :ids => list of service unique ids, return only these.
|
265
267
|
def get_service_definitions(options = {})
|
266
268
|
options[:task] ||= Service::StandardTask
|
267
|
-
|
269
|
+
|
268
270
|
configs_for_task = @service_definitions[ options[:task] ] || {}
|
269
|
-
|
271
|
+
|
270
272
|
service_configs = case options[:level]
|
271
273
|
when nil
|
272
274
|
# All of of them for this task
|
@@ -277,29 +279,29 @@ class Collection
|
|
277
279
|
if options[:ids]
|
278
280
|
service_configs = service_configs.find_all {|s| options[:ids].include? s["service_id"] }
|
279
281
|
end
|
280
|
-
|
281
|
-
return service_configs
|
282
|
+
|
283
|
+
return service_configs
|
282
284
|
end
|
283
285
|
|
284
286
|
protected
|
285
|
-
|
286
|
-
# Arrange services in hash according to task type and priority.
|
287
|
+
|
288
|
+
# Arrange services in hash according to task type and priority.
|
287
289
|
def gather_services
|
288
290
|
@service_definitions_flat.each_pair do | unique_id, svc_def |
|
289
291
|
next if svc_def.nil?
|
290
|
-
|
292
|
+
|
291
293
|
svc_def['service_id'] = unique_id
|
292
294
|
task = svc_def['task'] || Service::StandardTask
|
293
295
|
level = svc_def['priority'] || 3
|
294
|
-
|
296
|
+
|
295
297
|
@service_definitions[task] ||= {}
|
296
298
|
@service_definitions[task][level] ||= []
|
297
|
-
@service_definitions[task][level] << svc_def
|
298
|
-
end
|
299
|
+
@service_definitions[task][level] << svc_def
|
300
|
+
end
|
299
301
|
end
|
300
302
|
|
301
|
-
|
302
|
-
|
303
|
+
|
304
|
+
|
303
305
|
|
304
306
|
|
305
307
|
end
|