// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.search.searchchain.model.federation; import java.util.List; import com.google.common.collect.ImmutableList; import com.yahoo.container.bundle.BundleInstantiationSpecification; import net.jcip.annotations.Immutable; import com.yahoo.component.ComponentSpecification; import com.yahoo.component.chain.dependencies.Dependencies; import com.yahoo.component.chain.model.ChainedComponentModel; import com.yahoo.search.federation.FederationSearcher; /** * Specifies how a federation searcher is to be set up. * * @author tonytv */ @Immutable public class FederationSearcherModel extends ChainedComponentModel { /** * Specifies one or more search chains that can be addressed * as a single source. */ public static class TargetSpec { public final ComponentSpecification sourceSpec; public final FederationOptions federationOptions; public TargetSpec(ComponentSpecification sourceSpec, FederationOptions federationOptions) { this.sourceSpec = sourceSpec; this.federationOptions = federationOptions; } } private static ComponentSpecification federationSearcherComponentSpecification = new ComponentSpecification(FederationSearcher.class.getName()); public final List targets; public final boolean inheritDefaultSources; public FederationSearcherModel(ComponentSpecification componentId, Dependencies dependencies, List targets, boolean inheritDefaultSources) { super(BundleInstantiationSpecification.getInternalSearcherSpecification(componentId, federationSearcherComponentSpecification), dependencies); this.inheritDefaultSources = inheritDefaultSources; this.targets = ImmutableList.copyOf(targets); } }