Module: ActiveFedora

Extended by:
ActiveSupport::Autoload
Defined in:
lib/active_fedora.rb,
lib/active_fedora/rdf.rb,
lib/active_fedora/base.rb,
lib/active_fedora/core.rb,
lib/active_fedora/model.rb,
lib/active_fedora/config.rb,
lib/active_fedora/version.rb,
lib/active_fedora/railtie.rb,
lib/active_fedora/scoping.rb,
lib/active_fedora/property.rb,
lib/active_fedora/indexing.rb,
lib/active_fedora/sharding.rb,
lib/active_fedora/querying.rb,
lib/active_fedora/relation.rb,
lib/active_fedora/callbacks.rb,
lib/active_fedora/auditable.rb,
lib/active_fedora/datastream.rb,
lib/active_fedora/attributes.rb,
lib/active_fedora/reflection.rb,
lib/active_fedora/predicates.rb,
lib/active_fedora/validations.rb,
lib/active_fedora/datastreams.rb,
lib/active_fedora/persistence.rb,
lib/active_fedora/rdf/indexing.rb,
lib/active_fedora/solr_service.rb,
lib/active_fedora/associations.rb,
lib/active_fedora/test_support.rb,
lib/active_fedora/content_model.rb,
lib/active_fedora/semantic_node.rb,
lib/active_fedora/om_datastream.rb,
lib/active_fedora/serialization.rb,
lib/active_fedora/null_relation.rb,
lib/active_fedora/scoping/named.rb,
lib/active_fedora/digital_object.rb,
lib/active_fedora/reload_on_save.rb,
lib/active_fedora/rspec_matchers.rb,
lib/active_fedora/nom_datastream.rb,
lib/active_fedora/fixture_loader.rb,
lib/active_fedora/rdf_xml_writer.rb,
lib/active_fedora/scoping/default.rb,
lib/active_fedora/relation/merger.rb,
lib/active_fedora/datastream_hash.rb,
lib/active_fedora/fixture_exporter.rb,
lib/active_fedora/file_configurator.rb,
lib/active_fedora/nested_attributes.rb,
lib/active_fedora/simple_datastream.rb,
lib/active_fedora/fedora_attributes.rb,
lib/active_fedora/rdf/rdf_datastream.rb,
lib/active_fedora/relationship_graph.rb,
lib/active_fedora/solr_digital_object.rb,
lib/active_fedora/relation/delegation.rb,
lib/active_fedora/service_definitions.rb,
lib/active_fedora/rubydora_connection.rb,
lib/active_fedora/rels_ext_datastream.rb,
lib/active_fedora/association_relation.rb,
lib/active_fedora/autosave_association.rb,
lib/active_fedora/solr_instance_loader.rb,
lib/active_fedora/datastream_attribute.rb,
lib/active_fedora/relation/calculations.rb,
lib/active_fedora/unsaved_digital_object.rb,
lib/active_fedora/relation/spawn_methods.rb,
lib/active_fedora/relation/query_methods.rb,
lib/active_fedora/datastream_collections.rb,
lib/active_fedora/attributes/serializers.rb,
lib/active_fedora/relation/finder_methods.rb,
lib/active_fedora/associations/association.rb,
lib/active_fedora/rdf/rdfxml_rdf_datastream.rb,
lib/active_fedora/rdf/ntriples_rdf_datastream.rb,
lib/active_fedora/associations/collection_proxy.rb,
lib/active_fedora/associations/association_scope.rb,
lib/active_fedora/qualified_dublin_core_datastream.rb,
lib/active_fedora/datastreams/nokogiri_datastreams.rb,
lib/generators/active_fedora/model/model_generator.rb,
lib/active_fedora/associations/has_many_association.rb,
lib/active_fedora/associations/singular_association.rb,
lib/generators/active_fedora/config/config_generator.rb,
lib/active_fedora/associations/collection_association.rb,
lib/active_fedora/associations/belongs_to_association.rb,
lib/generators/active_fedora/config/solr/solr_generator.rb,
lib/generators/active_fedora/config/fedora/fedora_generator.rb,
lib/active_fedora/associations/has_and_belongs_to_many_association.rb

Overview

:nodoc:

Defined Under Namespace

Modules: Associations, Attributes, Auditable, AutosaveAssociation, Calculations, Callbacks, ContentModel, Core, DatastreamCollections, Datastreams, Delegation, FedoraAttributes, FinderMethods, FixtureExporter, Indexing, Model, NestedAttributes, NullRelation, Persistence, Predicates, QueryMethods, Querying, Rdf, Reflection, ReloadOnSave, RspecMatchers, Scoping, SemanticNode, Serialization, ServiceDefinitions, Sharding, SpawnMethods, TestSupport, Validations Classes: AssociationRelation, AssociationTypeMismatch, Base, Config, ConfigGenerator, ConfigurationError, Datastream, DatastreamAttribute, DatastreamConcurrencyException, DatastreamHash, DigitalObject, FedoraSolrMismatchError, FileConfigurator, FixtureLoader, IllegalOperation, ModelGenerator, NomDatastream, NtriplesRDFDatastream, ObjectNotFoundError, OmDatastream, PredicateMappingsNotFoundError, Property, QualifiedDublinCoreDatastream, RDFDatastream, RDFXMLWriter, Railtie, RdfxmlRDFDatastream, RecordInvalid, RecordNotSaved, Relation, RelationshipGraph, RelsExtDatastream, Rollback, RubydoraConnection, SimpleDatastream, SolrDigitalObject, SolrInstanceLoader, SolrNotInitialized, SolrService, UnknownAttributeError, UnregisteredPredicateError, UnsavedDigitalObject

Constant Summary

VERSION =
"7.1.1"

Class Attribute Summary (collapse)

Class Method Summary (collapse)

Class Attribute Details

+ (Object) config_options (readonly)

Returns the value of attribute config_options



103
104
105
# File 'lib/active_fedora.rb', line 103

def config_options
  @config_options
end

+ (Object) configurator

Returns the value of attribute configurator



104
105
106
# File 'lib/active_fedora.rb', line 104

def configurator
  @configurator
end

+ (Object) fedora_config (readonly)

Returns the value of attribute fedora_config



103
104
105
# File 'lib/active_fedora.rb', line 103

def fedora_config
  @fedora_config
end

+ (Object) solr_config (readonly)

Returns the value of attribute solr_config



103
104
105
# File 'lib/active_fedora.rb', line 103

def solr_config
  @solr_config
end

Class Method Details

+ (Object) class_from_string(class_name, container_class = Kernel)

Convenience method for getting class constant based on a string

Examples:

ActiveFedora.class_from_string("Om")
=> Om
ActiveFedora.class_from_string("ActiveFedora::RdfNode::TermProxy")
=> ActiveFedora::RdfNode::TermProxy

Search within ActiveFedora::RdfNode for a class called “TermProxy”

ActiveFedora.class_from_string("TermProxy", ActiveFedora::RdfNode)
=> ActiveFedora::RdfNode::TermProxy  


182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/active_fedora.rb', line 182

def self.class_from_string(class_name, container_class=Kernel)
  container_class = container_class.name if container_class.is_a? Module
  container_parts = container_class.split('::')
  (container_parts + class_name.split('::')).flatten.inject(Kernel) do |mod, class_name|
    if mod == Kernel
      Object.const_get(class_name)
    elsif mod.const_defined? class_name.to_sym
      mod.const_get(class_name)
    else
      container_parts.pop
      class_from_string(class_name, container_parts.join('::'))
    end
  end
end

+ (Object) config



129
130
131
# File 'lib/active_fedora.rb', line 129

def self.config
  self.fedora_config
end

+ (Boolean) config_loaded?



113
# File 'lib/active_fedora.rb', line 113

def self.config_loaded?; self.configurator.config_loaded?; end

+ (String) environment

Determine what environment we're running in. Order of preference is:

  1. config_options

  2. Rails.env

  3. ENV

  4. ENV

  5. development

Examples:

ActiveFedora.init(:environment=>"test")
ActiveFedora.environment => "test"


143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/active_fedora.rb', line 143

def self.environment
  if config_options.fetch(:environment,nil)
    return config_options[:environment]
  elsif defined?(Rails.env) and !Rails.env.nil?
    return Rails.env.to_s
  elsif defined?(ENV['environment']) and !(ENV['environment'].nil?)
    return ENV['environment']
  elsif defined?(ENV['RAILS_ENV']) and !(ENV['RAILS_ENV'].nil?)
    raise RuntimeError, "You're depending on RAILS_ENV for setting your environment. Please use ENV['environment'] for non-rails environment setting: 'rake foo:bar environment=test'"
  else
    ENV['environment'] = 'development' 
  end
end

+ (Object) init(options = {})



115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/active_fedora.rb', line 115

def self.init( options={} )
  # Make config_options into a Hash if nil is passed in as the value
  options = {} if options.nil?
  # For backwards compatibility, handle cases where config_path (a String) is passed in as the argument rather than a config_options hash
  # In all other cases, set config_path to config_options[:config_path], which is ok if it's nil
  if options.is_a? String
    raise ArgumentError, "Calling ActiveFedora.init with a path as an argument has been removed.  Use ActiveFedora.init(:fedora_config_path=>#{options})"
  end
  @fedora_config = nil
  SolrService.reset!
  Predicates.predicate_config = nil
  self.configurator.init(options)
end

+ (Object) predicate_config



161
162
163
# File 'lib/active_fedora.rb', line 161

def self.predicate_config
  configurator.predicate_config
end

+ (Object) root



165
166
167
# File 'lib/active_fedora.rb', line 165

def self.root
  File.expand_path('../..', __FILE__)
end

+ (Object) solr



157
158
159
# File 'lib/active_fedora.rb', line 157

def self.solr
  ActiveFedora::SolrService.instance
end

+ (Object) version



169
170
171
# File 'lib/active_fedora.rb', line 169

def self.version
  ActiveFedora::VERSION
end