Inheritance flattened() { return new Inheritance(Collections.<ComponentSpecification>emptySet(), excludedComponents); }
/** * @param allChainSpecifications resolves ChainSpecifications from ComponentSpecifications * as given in the inheritance fields. * @param path tracks which chains are used in each recursive invocation of flatten, used for detecting cycles. * @return ChainSpecification directly containing all the component references and phases of the inherited chains. */ private ChainSpecification flatten(Resolver<ChainSpecification> allChainSpecifications, Deque<ComponentId> path) { path.push(componentId); //if this turns out to be a bottleneck(which I seriously doubt), please add memoization Map<String, ComponentSpecification> resultingComponents = componentsByName(componentReferences); Map<String, Phase> resultingPhases = new LinkedHashMap<>(phases); for (ComponentSpecification inheritedChainSpecification : inheritance.chainSpecifications) { ChainSpecification inheritedChain = resolveChain(path, allChainSpecifications, inheritedChainSpecification). flatten(allChainSpecifications, path); mergeInto(resultingComponents, filterByComponentSpecification( filterByName(inheritedChain.componentReferences, names(componentReferences)), inheritance.excludedComponents)); mergeInto(resultingPhases, inheritedChain.phases); } path.pop(); return new ChainSpecification(componentId, inheritance.flattened(), resultingPhases.values(), new LinkedHashSet<>(resultingComponents.values())); }
public ChainSpecification addInherits(Collection<ComponentSpecification> inheritedChains) { return new ChainSpecification(componentId, inheritance.addInherits(inheritedChains), phases(), componentReferences); }
private static ChainSpecification.Inheritance createInheritance(List<String> inherit, List<String> exclude) { return new ChainSpecification.Inheritance( createComponentSpecifications(inherit), createComponentSpecifications(exclude)); } }
public static ChainSpecification emptyChainSpec(ComponentId chainId) { return new ChainSpecification(chainId, new ChainSpecification.Inheritance(null, null), Collections.<Phase>emptySet(), Collections.<ComponentSpecification>emptySet()); }
private static ChainSpecification vespaPhasesSpecification() { return new ChainSpecification( new ComponentId("vespaPhases"), new ChainSpecification.Inheritance(null, null), PhasesCreator.linearPhases( PhaseNames.RAW_QUERY, PhaseNames.TRANSFORMED_QUERY, PhaseNames.BLENDED_RESULT, PhaseNames.UNBLENDED_RESULT, PhaseNames.BACKEND), noSearcherReferences()); }
public Inheritance addInherits(Collection<ComponentSpecification> inheritedChains) { Set<ComponentSpecification> newChainSpecifications = new LinkedHashSet<>(chainSpecifications); newChainSpecifications.addAll(inheritedChains); return new Inheritance(newChainSpecifications, excludedComponents); } }
public IndexingDocprocChain() { super(new ChainSpecification(new ComponentId(NAME), new ChainSpecification.Inheritance(Collections.<ComponentSpecification>emptySet(), Collections.<ComponentSpecification>emptySet()), phases, Collections.<ComponentSpecification>emptySet()), new HashMap<>()); addInnerComponent(new IndexingProcessor()); }
private static ChainSpecification.Inheritance inherits(ComponentId chainId) { Set<ComponentSpecification> inheritsSet = new LinkedHashSet<>(); inheritsSet.add(chainId.toSpecification()); return new ChainSpecification.Inheritance(inheritsSet, null); }
public InheritanceBuilder(Element spec) { inheritance = new ChainSpecification.Inheritance( // XXX: for this to work, the tagname in the spec must match the tagname inside the 'inherits' elem, e.g. 'searchchain->inherits->searchchain' read(spec, "inherits", spec.getTagName()), read(spec, "excludes", "exclude")); }