Sha256: e232d016f78f5ed47edc7b2c501e5c597798c4415f174ee09dc05bdd45857765

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 KB

Contents

module ActiveFedora::Aggregation
  ##
  # Repository for Proxies. This repository is responsible for decorating a
  # proxy such that it's useful for aggregation and is an attempt at
  # centralizing hard-coded dependencies without a dependency injection
  # container.
  class ProxyRepository < SimpleDelegator
    attr_reader :owner, :base_proxy_factory
    # @param [ActiveFedora::Base] owner The node which proxy will assert order
    #   on.
    # @param [#find, #new] base_proxy_factory The base factory which returns proxies
    #   that will be decorated.
    # @return [#find, #new] A repository which can return proxies useful for
    #  aggregation.
    def initialize(owner, base_proxy_factory)
      @owner = owner
      @base_proxy_factory = base_proxy_factory
      super(repository)
    end

    private

    def repository
      DecoratingRepository.new(proxy_decorator, base_proxy_factory)
    end

    def proxy_decorator
      DecoratorList.new(
        DecoratorWithArguments.new(OrderedProxy, proxy_owner),
        DecoratorWithArguments.new(AppendsToAggregation, proxy_owner)
      )
    end

    def proxy_owner
      @proxy_owner ||= ProxyOwner.new(owner)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
activefedora-aggregation-0.9.0 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.8.1 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.8.0 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.7.0 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.6.0 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.5.0 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.4.2 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.4.1 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.4.0 lib/active_fedora/aggregation/proxy_repository.rb
activefedora-aggregation-0.3.0 lib/active_fedora/aggregation/proxy_repository.rb