Module: ActiveFedora
- Defined in:
- lib/active_fedora.rb,
lib/active_fedora.rb,
lib/active_fedora/base.rb,
lib/active_fedora/model.rb,
lib/active_fedora/railtie.rb,
lib/active_fedora/version.rb,
lib/active_fedora/property.rb,
lib/active_fedora/datastream.rb,
lib/active_fedora/relationship.rb,
lib/active_fedora/solr_service.rb,
lib/active_fedora/content_model.rb,
lib/active_fedora/fedora_object.rb,
lib/active_fedora/semantic_node.rb,
lib/active_fedora/metadata_datastream.rb,
lib/active_fedora/rels_ext_datastream.rb,
lib/active_fedora/qualified_dublin_core_datastream.rb
Overview
if ![].respond_to?(:count)
class Array
puts "active_fedora is Adding count method to Array"
def count(&action)
count = 0
self.each { |v| count = count + 1}
# self.each { |v| count = count + 1 if action.call(v) }
return count
end
end
end
Defined Under Namespace
Modules: FedoraObject, MetadataDatastreamHelper, Model, SemanticNode Classes: Base, ContentModel, Datastream, DatastreamConcurrencyException, MetadataDatastream, NokogiriDatastream, ObjectNotFoundError, PredicateMappingsNotFoundError, Property, QualifiedDublinCoreDatastream, Railtie, Relationship, RelsExtDatastream, ServerError, SolrNotInitialized, SolrService, UnregisteredPredicateError
Constant Summary collapse
- VERSION =
"2.3.0"
Class Attribute Summary collapse
-
.fedora_config ⇒ Object
Returns the value of attribute fedora_config.
-
.solr_config ⇒ Object
Returns the value of attribute solr_config.
Class Method Summary collapse
- .fedora ⇒ Object
-
.init(config_path = nil) ⇒ Object
Initializes ActiveFedora’s connection to Fedora and Solr based on the info in fedora.yml If RAILS_ENV is set, it will use that environment.
- .logger ⇒ Object
- .predicate_config ⇒ Object
- .solr ⇒ Object
- .version ⇒ Object
Class Attribute Details
.fedora_config ⇒ Object
Returns the value of attribute fedora_config.
34 35 36 |
# File 'lib/active_fedora.rb', line 34 def fedora_config @fedora_config end |
.solr_config ⇒ Object
Returns the value of attribute solr_config.
34 35 36 |
# File 'lib/active_fedora.rb', line 34 def solr_config @solr_config end |
Class Method Details
.fedora ⇒ Object
89 90 91 |
# File 'lib/active_fedora.rb', line 89 def self.fedora Fedora::Repository.instance end |
.init(config_path = nil) ⇒ Object
Initializes ActiveFedora’s connection to Fedora and Solr based on the info in fedora.yml If RAILS_ENV is set, it will use that environment. Defaults to “development”.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/active_fedora.rb', line 45 def self.init( config_path=nil ) config_env = defined?(RAILS_ENV) ? RAILS_ENV : "development" if config_path.nil? if defined?(Rails.root) config_path = "#{Rails.root}/config/fedora.yml" else config_path = File.join("config","fedora.yml") end end unless File.exist?(config_path) config_path = File.join(File.dirname(__FILE__), "..", "config", "fedora.yml") logger.info "Using the default fedora.yml that comes with active-fedora. If you want to override this, pass the path to fedora.yml as an argument to ActiveFedora.init or set Rails.root and put fedora.yml into \#{Rails.root}/config." end logger.info("FEDORA: loading ActiveFedora config from #{File.(config_path)}") fedora_config = YAML::load(File.open(config_path)) raise "The #{config_env} environment settings were not found in the fedora.yml config. If you already have a fedora.yml file defined, make sure it defines settings for the #{config_env} environment" unless fedora_config[config_env] ActiveFedora.solr_config[:url] = fedora_config[config_env]['solr']['url'] # Register Solr logger.info("FEDORA: initializing ActiveFedora::SolrService with solr_config: #{ActiveFedora.solr_config.inspect}") ActiveFedora::SolrService.register(ActiveFedora.solr_config[:url]) logger.info("FEDORA: initialized Solr with ActiveFedora.solr_config: #{ActiveFedora::SolrService.instance.inspect}") ActiveFedora.fedora_config[:url] = fedora_config[config_env]['fedora']['url'] logger.info("FEDORA: initializing Fedora with fedora_config: #{ActiveFedora.fedora_config.inspect}") Fedora::Repository.register(ActiveFedora.fedora_config[:url]) logger.info("FEDORA: initialized Fedora as: #{Fedora::Repository.instance.inspect}") # Retrieve the valid path for the predicate mappings config file @predicate_config_path = build_predicate_config_path(File.dirname(config_path)) end |
.logger ⇒ Object
93 94 95 |
# File 'lib/active_fedora.rb', line 93 def self.logger @logger ||= defined?(RAILS_DEFAULT_LOGGER) ? RAILS_DEFAULT_LOGGER : Logger.new(STDOUT) end |
.predicate_config ⇒ Object
97 98 99 |
# File 'lib/active_fedora.rb', line 97 def self.predicate_config @predicate_config_path ||= build_predicate_config_path end |
.solr ⇒ Object
85 86 87 |
# File 'lib/active_fedora.rb', line 85 def self.solr ActiveFedora::SolrService.instance end |
.version ⇒ Object
101 102 103 |
# File 'lib/active_fedora.rb', line 101 def self.version ActiveFedora::VERSION end |