Module: Dor

Extended by:
ActiveSupport::Autoload
Defined in:
lib/dor/rest_resource_factory.rb,
lib/dor/config.rb,
lib/dor/version.rb,
lib/dor-services.rb,
lib/dor/exceptions.rb,
lib/dor/models/set.rb,
lib/dor/models/item.rb,
lib/dor/models/abstract.rb,
lib/dor/models/agreement.rb,
lib/dor/services/ability.rb,
lib/dor/workflow/process.rb,
lib/dor/models/collection.rb,
lib/dor/services/ontology.rb,
lib/dor/workflow/document.rb,
lib/dor/services/tag_service.rb,
lib/dor/datastreams/events_ds.rb,
lib/dor/indexers/data_indexer.rb,
lib/dor/services/suri_service.rb,
lib/dor/models/workflow_object.rb,
lib/dor/services/merge_service.rb,
lib/dor/datastreams/workflow_ds.rb,
lib/dor/models/concerns/geoable.rb,
lib/dor/services/search_service.rb,
lib/dor/services/status_service.rb,
lib/dor/models/concerns/editable.rb,
lib/dor/services/cleanup_service.rb,
lib/dor/services/version_service.rb,
lib/dor/indexers/editable_indexer.rb,
lib/dor/models/concerns/eventable.rb,
lib/dor/models/concerns/shelvable.rb,
lib/dor/services/indexing_service.rb,
lib/dor/services/metadata_service.rb,
lib/dor/services/shelving_service.rb,
lib/dor/indexers/composite_indexer.rb,
lib/dor/models/admin_policy_object.rb,
lib/dor/models/concerns/governable.rb,
lib/dor/models/concerns/itemizable.rb,
lib/dor/models/concerns/rightsable.rb,
lib/dor/services/thumbnail_service.rb,
lib/dor/datastreams/geo_metadata_ds.rb,
lib/dor/indexers/releasable_indexer.rb,
lib/dor/models/concerns/contentable.rb,
lib/dor/models/concerns/describable.rb,
lib/dor/models/concerns/embargoable.rb,
lib/dor/models/concerns/preservable.rb,
lib/dor/models/concerns/processable.rb,
lib/dor/models/concerns/publishable.rb,
lib/dor/models/concerns/releaseable.rb,
lib/dor/models/concerns/versionable.rb,
lib/dor/services/datastream_builder.rb,
lib/dor/services/public_xml_service.rb,
lib/dor/services/sdr_ingest_service.rb,
lib/dor/datastreams/desc_metadata_ds.rb,
lib/dor/datastreams/role_metadata_ds.rb,
lib/dor/indexers/describable_indexer.rb,
lib/dor/indexers/processable_indexer.rb,
lib/dor/models/concerns/assembleable.rb,
lib/dor/models/concerns/identifiable.rb,
lib/dor/services/dublin_core_service.rb,
lib/dor/services/release_tag_service.rb,
lib/dor/indexers/identifiable_indexer.rb,
lib/dor/services/registration_service.rb,
lib/dor/datastreams/rights_metadata_ds.rb,
lib/dor/services/cleanup_reset_service.rb,
lib/dor/datastreams/content_metadata_ds.rb,
lib/dor/datastreams/embargo_metadata_ds.rb,
lib/dor/datastreams/version_metadata_ds.rb,
lib/dor/services/digital_stacks_service.rb,
lib/dor/datastreams/identity_metadata_ds.rb,
lib/dor/services/create_workflow_service.rb,
lib/dor/services/reset_workspace_service.rb,
lib/dor/datastreams/simple_dublin_core_ds.rb,
lib/dor/datastreams/technical_metadata_ds.rb,
lib/dor/services/publish_metadata_service.rb,
lib/dor/datastreams/provenance_metadata_ds.rb,
lib/dor/datastreams/workflow_definition_ds.rb,
lib/dor/services/open_data_license_service.rb,
lib/dor/services/technical_metadata_service.rb,
lib/dor/datastreams/default_object_rights_ds.rb,
lib/dor/services/file_metadata_merge_service.rb,
lib/dor/services/secondary_file_name_service.rb,
lib/dor/services/public_desc_metadata_service.rb,
lib/dor/datastreams/administrative_metadata_ds.rb,
lib/dor/services/creative_commons_license_service.rb,
lib/dor/certificate_authenticated_rest_resource_factory.rb

Overview

Creates RestClient::Resources with client ssl keys for various connections

Defined Under Namespace

Modules: Assembleable, Contentable, Describable, Editable, Embargoable, Eventable, Geoable, Governable, Identifiable, Itemizable, Preservable, Processable, Publishable, Releaseable, Rightsable, Shelvable, Versionable, Workflow Classes: Ability, Abstract, AdminPolicyObject, AdministrativeMetadataDS, Agreement, CertificateAuthenticatedRestResourceFactory, CleanupResetService, CleanupService, Collection, CompositeIndexer, Configuration, ContentMetadataDS, CreateWorkflowService, CreativeCommonsLicenseService, DataIndexer, DatastreamBuilder, DefaultObjectRightsDS, DescMetadataDS, DescribableIndexer, DigitalStacksService, DublinCoreService, DuplicateIdError, EditableIndexer, EmbargoMetadataDS, EventsDS, Exception, FileMetadataMergeService, GeoMetadataDS, IdentifiableIndexer, IdentityMetadataDS, IndexingService, Item, MergeService, MetadataError, MetadataService, Ontology, OpenDataLicenseService, ParameterError, ProcessableIndexer, ProvenanceMetadataDS, PublicDescMetadataService, PublicXmlService, PublishMetadataService, RegistrationService, ReleasableIndexer, ReleaseTagService, ResetWorkspaceService, RestResourceFactory, RightsMetadataDS, RoleMetadataDS, SdrIngestService, SearchService, SecondaryFileNameService, Set, ShelvingService, SimpleDublinCoreDs, StatusService, SuriService, TagService, TechnicalMetadataDS, TechnicalMetadataService, ThumbnailService, VersionMetadataDS, VersionService, VersionTag, WorkflowDefinitionDs, WorkflowDs, WorkflowObject

Constant Summary collapse

Config =
Configuration.new(YAML.load(File.read(File.expand_path('../../config/config_defaults.yml', __dir__))))
VERSION =
'6.1.8'
INDEX_VERSION_FIELD =
'dor_services_version_ssi'
@@registered_classes =
{}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure(*args, &block) ⇒ Object



16
17
18
# File 'lib/dor-services.rb', line 16

def configure(*args, &block)
  Dor::Config.configure *args, &block
end

.ensure_models_loaded!Object

Deprecated.


49
50
51
52
# File 'lib/dor-services.rb', line 49

def ensure_models_loaded!
  ActiveSupport::Deprecation.warn 'Dor.ensure_models_loaded! is unnecessary and has been deprecated.'
  eager_load!
end

.find(pid, _opts = {}) ⇒ Object

Get objectType information from solr and load the correct class the first time, saving the overhead of using ActiveFedora::Base#adapt_to. It falls back to Dor.load_instance() if the item is not in the index, or is improperly indexed.

Parameters:

  • pid (String)

    The object’s PID

Returns:

  • (Object)

    the ActiveFedora-modeled object



33
34
35
# File 'lib/dor-services.rb', line 33

def find(pid, _opts = {})
  load_instance(pid)
end

.find_all(query, opts = {}) ⇒ Object

TODO: return enumerable and lazy load_instance TODO: restrict fieldlist (fl) for non-:lightweight queries



39
40
41
42
43
44
45
46
# File 'lib/dor-services.rb', line 39

def find_all(query, opts = {})
  ActiveSupport::Deprecation.warn 'Dor.find_all is deprecated; use activefedora finders instead'

  resp = SearchService.query query, opts
  resp['response']['docs'].collect do |solr_doc|
    find solr_doc['id']
  end
end

.load_instance(pid) ⇒ Object

Load an object and inspect its identityMetadata to figure out what class to adapt it to. This is necessary when the object is not indexed, or the index is missing the objectType property.

Parameters:

  • pid (String)

    The object’s PID



24
25
26
# File 'lib/dor-services.rb', line 24

def load_instance(pid)
  Dor::Abstract.find pid, cast: true
end

.loggerObject



58
59
60
61
62
63
64
65
# File 'lib/dor-services.rb', line 58

def logger
  require 'logger'
  @logger ||= if defined?(::Rails) && ::Rails.respond_to?(:logger)
                Rails.logger
              else
                Logger.new(STDOUT)
              end
end

.rootObject



54
55
56
# File 'lib/dor-services.rb', line 54

def root
  File.dirname(__FILE__)
end

Instance Method Details

#loggerObject



68
69
70
# File 'lib/dor-services.rb', line 68

def logger
  Dor.logger
end