private static ChainSpecification.Inheritance createInheritance(List<String> inherit, List<String> exclude) { return new ChainSpecification.Inheritance( createComponentSpecifications(inherit), createComponentSpecifications(exclude)); } }
public ChainSpecification addInherits(Collection<ComponentSpecification> inheritedChains) { return new ChainSpecification(componentId, inheritance.addInherits(inheritedChains), phases(), componentReferences); }
public ChainSpecification build(Set<ComponentSpecification> outerComponentReferences) { return new ChainSpecification(componentId, inheritance, phases, outerComponentReferences); } }
public static ChainsModel buildFromConfig(ChainsConfig chainsConfig) { ChainsModel model = createChainsModel(chainsConfig); for (ChainsConfig.Components component : chainsConfig.components()) { ChainedComponentModel componentModel = createChainedComponentModel(component); model.register(componentModel.getComponentId(), componentModel); } return model; }
private static ChainsModel createChainsModel(ChainsConfig chainsConfig) { ChainsModel model = new ChainsModel(); for (ChainsConfig.Chains chainConfig : chainsConfig.chains()) { model.register( createChainSpecification(chainConfig)); } return model; }
private static ChainSpecification createChainSpecification(ChainsConfig.Chains config) { return new ChainSpecification(new ComponentId(config.id()), createInheritance(config.inherits(), config.excludes()), createPhases(config.phases()), createComponentSpecifications(config.components())); }
public static ChainSpecification emptyChainSpec(ComponentId chainId) { return new ChainSpecification(chainId, new ChainSpecification.Inheritance(null, null), Collections.<Phase>emptySet(), Collections.<ComponentSpecification>emptySet()); }
public ChainSpecification setComponentId(ComponentId newComponentId) { return new ChainSpecification(newComponentId, inheritance, phases(), componentReferences); }
private static <COMPONENT extends ChainedComponent> void initDependencies( ChainsModel model, ComponentRegistry<COMPONENT> allComponents) { for (ChainedComponentModel componentModel : model.allComponents()) { COMPONENT component = getComponentOrThrow(allComponents, componentModel.getComponentId().toSpecification()); component.initDependencies(componentModel.dependencies); } }
public void register(ComponentId globalComponentId, ChainedComponentModel componentModel) { assert (componentModel.getComponentId().withoutNamespace().equals( globalComponentId.withoutNamespace())); componentModels.register(globalComponentId, ComponentAdaptor.create(globalComponentId, componentModel)); }
private static ChainedComponentModel createChainedComponentModel(ChainsConfig.Components component) { return new ChainedComponentModel( new BundleInstantiationSpecification(new ComponentSpecification(component.id()), null, null), createDependencies( component.dependencies().provides(), component.dependencies().before(), component.dependencies().after()), null); }
public static <T> ComponentAdaptor<T> create(ComponentId globalComponentId, T model) { return new ComponentAdaptor<>(globalComponentId, model); }
public ChainedComponentModel build() { return new ChainedComponentModel(bundleInstantiationSpec, dependencies); }
private static boolean allAdded(Collection<ChainedComponentModel> searcherModels, Set<ComponentId> componentIds) { for (ChainedComponentModel model : searcherModels) { if (!componentIds.add(model.getComponentId())) return false; } return true; }
public void validate() { allChainsFlattened(); for (ComponentAdaptor<ChainSpecification> chain : chainSpecifications.allComponents()) { validate(chain.model); } }
Inheritance flattened() { return new Inheritance(Collections.<ComponentSpecification>emptySet(), excludedComponents); }
public Inheritance(Set<ComponentSpecification> inheritedChains, Set<ComponentSpecification> excludedComponents) { this.chainSpecifications = immutableCopy(inheritedChains); this.excludedComponents = immutableCopy(excludedComponents); }
public ChainSpecification flatten(Resolver<ChainSpecification> allChainSpecifications) { Deque<ComponentId> path = new ArrayDeque<>(); return flatten(allChainSpecifications, path); }
public void register(ChainSpecification chainSpecification) { chainSpecifications.register(chainSpecification.componentId, ComponentAdaptor.create(chainSpecification.componentId, chainSpecification)); }
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()); }