String createStringValue() { if (isNonEmpty(version) || (namespace != null)) { StringBuilder builder = new StringBuilder(name); if (isNonEmpty(version)) builder.append(':').append(version); if (namespace != null) builder.append('@').append(namespace.stringValue()); return builder.toString(); } else { return name; } }
static JSONArray renderRequestHandlers(JdiscBindingsConfig bindingsConfig, Map<ComponentId, ? extends RequestHandler> handlersById) { JSONArray ret = new JSONArray(); for (Map.Entry<ComponentId, ? extends RequestHandler> handlerEntry : handlersById.entrySet()) { String id = handlerEntry.getKey().stringValue(); RequestHandler handler = handlerEntry.getValue(); JSONObject handlerJson = renderComponent(handler, handlerEntry.getKey()); addBindings(bindingsConfig, id, handlerJson); ret.put(handlerJson); } return ret; }
private String rendererNames() { StringBuilder r = new StringBuilder(); for (Renderer<Result> c : allComponents()) { if (r.length() > 0) r.append(", "); r.append(c.getId().stringValue()); } return r.toString(); }
private SortedSet<String> allProviderIdsStringValue() { SortedSet<String> result = new TreeSet<>(); for (ComponentAdaptor<SearchChainInvocationSpec> providerSource : providerSources.allComponents()) { result.add(providerSource.getId().stringValue()); } return result; }
private static JSONObject renderComponent(Object component, ComponentId id) { JSONObject jc = new JSONObject(); putJson(jc, "id", id.stringValue()); addBundleInfo(jc, component); return jc; }
public boolean equals(Object o) { if (o==this) return true; if ( ! (o instanceof ComponentId)) return false; ComponentId c = (ComponentId) o; if (isAnonymous() || c.isAnonymous()) return false; return c.stringValue().equals(stringValue); }
private static boolean containsIndexingChain(ComponentRegistry<DocprocChain> allChains, ChainSpecification chainSpec) { if (IndexingDocprocChain.NAME.equals(chainSpec.componentId.stringValue())) return true; ChainSpecification.Inheritance inheritance = chainSpec.inheritance; for (ComponentSpecification parentComponentSpec : inheritance.chainSpecifications) { ChainSpecification parentSpec = getChainSpec(allChains, parentComponentSpec); if (containsIndexingChain(allChains, parentSpec)) return true; } return false; }
private static JSONObject renderComponent(Object component, ComponentId id) { JSONObject jc = new JSONObject(); putJson(jc, "id", id.stringValue()); addBundleInfo(jc, component); return jc; }
private void appendComponent(int i, StringBuilder b) { if (i >= components().size()) return; b.append(components().get(i).getId().stringValue()); if (i < components().size() - 1) b.append(" -> "); }
private void initBreakdown() { if (searcherTracking != null) { throw new IllegalStateException("initBreakdown invoked" + " when measurement structures are already initialized."); } List<? extends Processor> searchers = searchChain.components(); searcherTracking = new SearcherTimer[searchers.size()]; for (int i = 0; i < searcherTracking.length; ++i) { searcherTracking[i] = new SearcherTimer(searchers.get(i).getId().stringValue()); } }
public Chain(ChainSpecification specWithoutInnerComponents) { super(specWithoutInnerComponents.componentId.stringValue()); this.componentId = specWithoutInnerComponents.componentId; this.specWithoutInnerComponents = specWithoutInnerComponents; assertNoInnerComponents(specWithoutInnerComponents); innerComponentsGroup = new ComponentGroup<>(this, "component"); }
@Override public void getConfig(FederationConfig.Builder builder) { for (Target target : resolvedTargets.values()) { builder.target(target.getTargetConfig()); } if (targetSelector.isPresent()) { builder.targetSelector(targetSelector.get().getGlobalComponentId().stringValue()); } }
private static void addSearchChainTimedOutError(Query query, ComponentId searchChainId) { ErrorMessage timeoutMessage = ErrorMessage.createTimeout("The search chain '" + searchChainId + "' timed out."); timeoutMessage.setSource(searchChainId.stringValue()); query.errors().add(timeoutMessage); }
private static CallStack convertToCallStack(Chain<DocumentProcessor> chain, Statistics statistics, Metric metric) { CallStack stack = new CallStack(chain.getId().stringValue(), statistics, metric); for (DocumentProcessor processor : chain.components()) { processor.getFieldMap().putAll(DocprocService.schemaMap.chainMap(chain.getId().stringValue(), processor.getId().stringValue())); stack.addLast(processor); } return stack; }
/** * Looks up source.(sourceId).provider in the query properties. * @return null if the default provider should be used */ private ComponentSpecification providerSpecificationForSource(Properties queryProperties) { String spec = queryProperties.getString("source." + sourceId().stringValue() + ".provider"); return ComponentSpecification.fromString(spec); }
static JSONObject renderChains(ComponentRegistry<? extends Chain<?>> chains) { JSONObject ret = new JSONObject(); for (Chain<?> chain : chains.allComponents()) { putJson(ret, chain.getId().stringValue(), renderAbstractComponents(chain.components())); } return ret; }
@Override public void getConfig(HttpFilterConfig.Builder builder) { builder.filterName(filterModel.getComponentId().stringValue()) .filterClass(filterModel.getClassId().stringValue()); for (Map.Entry<String, String> param : configMap.entrySet()) { builder.param( new Param.Builder() .name(param.getKey()) .value(param.getValue())); } }
public FederationConfig.Target.Builder getTargetConfig() { FederationConfig.Target.Builder tb = new FederationConfig.Target.Builder(); tb. id(id.stringValue()). useByDefault(targetOptions.getUseByDefault()); getSearchChainsConfig(tb); return tb; }
public static Components.Builder componentsConfig(Component<?, ?> component) { Components.Builder builder = new Components.Builder(); builder.id(component.getGlobalComponentId().stringValue()); builder.configId(component.getConfigId()); bundleInstantiationSpecification(builder, component.model.bundleInstantiationSpec); builder.inject.addAll(componentsToInject(component.injectedComponents)); return builder; }
@Override public Result search(Query query, Execution execution) { Point dims = latencyGauge.builder() .set("chain", execution.chain().getId().stringValue()) .build(); latencyGauge.sample(query.getDurationTime(), dims); return execution.search(query); }