Class: Valkyrie::MetadataAdapter
- Inherits:
-
Object
- Object
- Valkyrie::MetadataAdapter
- Defined in:
- lib/valkyrie/metadata_adapter.rb
Overview
MetadataAdapter is the primary DataMapper object for metadata persistence.
Used to register and locate adapters, persisters, and query services for individual
metadata storage backends (such as fedora, postgres, etc)
Class Method Summary collapse
-
.find(short_name) ⇒ #persister, #query_service
Find an adapter by its short name.
-
.find_persister_for(short_name) ⇒ Object
Find the persister registered under the given short-name.
-
.find_query_service_for(short_name) ⇒ Object
Find the query service registered under the given short-name.
-
.register(adapter, short_name) ⇒ Object
Register an adapter by a short name.
Class Method Details
.find(short_name) ⇒ #persister, #query_service
Find an adapter by its short name.
22 23 24 25 26 |
# File 'lib/valkyrie/metadata_adapter.rb', line 22 def find(short_name) symbolized_key = short_name.to_sym return adapters[symbolized_key] if adapters.key?(symbolized_key) raise "Unable to find unregistered adapter `#{short_name}'" end |
.find_persister_for(short_name) ⇒ Object
Find the persister registered under the given short-name
35 36 37 |
# File 'lib/valkyrie/metadata_adapter.rb', line 35 def find_persister_for(short_name) find(short_name).persister end |
.find_query_service_for(short_name) ⇒ Object
Find the query service registered under the given short-name
46 47 48 |
# File 'lib/valkyrie/metadata_adapter.rb', line 46 def find_query_service_for(short_name) find(short_name).query_service end |
.register(adapter, short_name) ⇒ Object
Register an adapter by a short name. Registering an adapter by a short name makes the adapter easier to find and reference.
14 15 16 |
# File 'lib/valkyrie/metadata_adapter.rb', line 14 def register(adapter, short_name) adapters[short_name.to_sym] = adapter end |