Sha256: db76ff80690c2708c9f47dcd6dfd1b7e9c4dd64c372e9f8c9d003bb5037e0d23

Contents?: true

Size: 773 Bytes

Versions: 7

Compression:

Stored size: 773 Bytes

Contents

require 'rubydora'

module ActiveFedora
  class RubydoraConnection
    
    attr_accessor :options, :connection

    def initialize(params={})
      params = params.dup
      self.options = params
      connect
    end

    def connect(force=false)
      return unless @connection.nil? or force
      @connection = Rubydora.connect options

      Rubydora::Transaction.after_rollback do |options|
        begin
          case options[:method]
            when :ingest
              solr = ActiveFedora::SolrService.instance.conn
              solr.delete_by_id(options[:pid])
              solr.commit
            else
              ActiveFedora::Base.find(options[:pid]).update_index
          end
        rescue
          # no-op
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active-fedora-8.7.0 lib/active_fedora/rubydora_connection.rb
active-fedora-8.6.0 lib/active_fedora/rubydora_connection.rb
active-fedora-8.5.0 lib/active_fedora/rubydora_connection.rb
active-fedora-8.4.2 lib/active_fedora/rubydora_connection.rb
active-fedora-8.4.1 lib/active_fedora/rubydora_connection.rb
active-fedora-8.4.0 lib/active_fedora/rubydora_connection.rb
active-fedora-8.3.0 lib/active_fedora/rubydora_connection.rb