org.apache.camel.catalog.CamelCatalog Java Examples
The following examples show how to use
org.apache.camel.catalog.CamelCatalog.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CamelPropertyFileEntryInstance.java From camel-language-server with Apache License 2.0 | 6 votes |
public CamelPropertyFileEntryInstance(CompletableFuture<CamelCatalog> camelCatalog, String line, int lineNumber, TextDocumentItem textDocumentItem) { this.line = line; this.lineNumber = lineNumber; int indexOf = line.indexOf('='); String camelPropertyFileKeyInstanceString; String camelPropertyFileValueInstanceString; if (indexOf != -1) { camelPropertyFileKeyInstanceString = line.substring(0, indexOf); camelPropertyFileValueInstanceString = line.substring(indexOf+1); } else { camelPropertyFileKeyInstanceString = line; camelPropertyFileValueInstanceString = null; } camelPropertyFileKeyInstance = new CamelPropertyFileKeyInstance(camelCatalog, camelPropertyFileKeyInstanceString, this); camelPropertyFileValueInstance = new CamelPropertyFileValueInstance(camelCatalog, camelPropertyFileValueInstanceString, camelPropertyFileKeyInstance, textDocumentItem); }
Example #2
Source File: CatalogProcessor3x.java From camel-k-runtime with Apache License 2.0 | 6 votes |
private static void processComponents(org.apache.camel.catalog.CamelCatalog catalog, Map<String, CamelArtifact> artifacts) { for (String name : catalog.findComponentNames()) { String json = catalog.componentJSonSchema(name); CatalogComponentDefinition definition = CatalogSupport.unmarshallComponent(json); artifacts.compute(definition.getArtifactId(), (key, artifact) -> { CamelArtifact.Builder builder = artifactBuilder(artifact, definition); builder.addJavaType(definition.getJavaType()); definition.getSchemes().map(StringUtils::trimToNull).filter(Objects::nonNull).forEach(scheme -> { builder.addScheme( new CamelScheme.Builder() .id(scheme) .http(KNOWN_HTTP_URIS.contains(scheme)) .passive(KNOWN_PASSIVE_URIS.contains(scheme)) .build()); }); return builder.build(); }); } }
Example #3
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Checks whether the given value is matching the default value from the given component. * * @param scheme the component name * @param key the option key * @param value the option value * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise */ public static boolean isDefaultValue(CamelCatalog camelCatalog, String scheme, String key, String value) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String defaultValue = propertyMap.get("defaultValue"); if (key.equals(name)) { return value.equalsIgnoreCase(defaultValue); } } } return false; }
Example #4
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Checks whether the given key is a multi valued option * * @param scheme the component name * @param key the option key * @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise */ public static boolean isMultiValue(CamelCatalog camelCatalog, String scheme, String key) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String multiValue = propertyMap.get("multiValue"); if (key.equals(name)) { return "true".equals(multiValue); } } } return false; }
Example #5
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Checks whether the given key is a multi valued option * * @param scheme the component name * @param key the option key * @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise */ public static String getPrefix(CamelCatalog camelCatalog, String scheme, String key) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String prefix = propertyMap.get("prefix"); if (key.equals(name)) { return prefix; } } } return null; }
Example #6
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Checks whether the given value corresponds to a dummy none placeholder for an enum type * * @param scheme the component name * @param key the option key * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise */ public static boolean isNonePlaceholderEnumValue(CamelCatalog camelCatalog, String scheme, String key) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String enums = propertyMap.get("enum"); if (key.equals(name) && enums != null) { if (!enums.contains("none")) { return true; } else { return false; } } } } return false; }
Example #7
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Checks whether the given value corresponds to a dummy none placeholder for an enum type * * @param scheme the component name * @param key the option key * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise */ public static boolean isNonePlaceholderEnumValueComponent(CamelCatalog camelCatalog, String scheme, String key) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("componentProperties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String enums = propertyMap.get("enum"); if (key.equals(name) && enums != null) { if (!enums.contains("none")) { return true; } else { return false; } } } } return false; }
Example #8
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Get's the java type for the given option if its enum based, otherwise it returns null * * @param scheme the component name * @param key the option key * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise */ public static String getEnumJavaTypeComponent(CamelCatalog camelCatalog, String scheme, String key) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("componentProperties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String javaType = propertyMap.get("javaType"); String name = propertyMap.get("name"); String enums = propertyMap.get("enum"); if (key.equals(name) && enums != null) { return javaType; } } } return null; }
Example #9
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Checks whether the given value is matching the default value from the given model. * * @param modelName the model name * @param key the option key * @param value the option value * @return <tt>true</tt> if matching the default value, <tt>false</tt> otherwise */ public static boolean isModelDefaultValue(CamelCatalog camelCatalog, String modelName, String key, String value) { // use the camel catalog String json = camelCatalog.modelJSonSchema(modelName); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String defaultValue = propertyMap.get("defaultValue"); if (key.equals(name)) { return value.equalsIgnoreCase(defaultValue); } } } return false; }
Example #10
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Checks whether the given key is an expression kind * * @param modelName the model name * @param key the option key * @return <tt>true</tt> if the key is an expression type, <tt>false</tt> otherwise */ public static boolean isModelExpressionKind(CamelCatalog camelCatalog, String modelName, String key) { // use the camel catalog String json = camelCatalog.modelJSonSchema(modelName); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); if (key.equals(name)) { return "expression".equals(propertyMap.get("kind")); } } } return false; }
Example #11
Source File: CamelXmlHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
protected static List<ContextDto> parseCamelContexts(CamelCatalog camelCatalog, File xmlFile) throws Exception { List<ContextDto> camelContexts = new ArrayList<>(); RouteXml routeXml = new RouteXml(); XmlModel xmlModel = routeXml.unmarshal(xmlFile); // TODO we don't handle multiple contexts inside an XML file! CamelContextFactoryBean contextElement = xmlModel.getContextElement(); String name = contextElement.getId(); List<RouteDefinition> routeDefs = contextElement.getRoutes(); ContextDto context = new ContextDto(name); camelContexts.add(context); String key = name; if (Strings.isNullOrBlank(key)) { key = "_camelContext" + camelContexts.size(); } context.setKey(key); List<NodeDto> routes = createRouteDtos(camelCatalog, routeDefs, context); context.setChildren(routes); return camelContexts; }
Example #12
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
public static Set<String> dataFormatsFromArtifact(CamelCatalog camelCatalog, String artifactId) { Set<String> answer = new TreeSet<String>(); // use the camel catalog to find what components the artifact has for (String name : camelCatalog.findDataFormatNames()) { String json = camelCatalog.dataFormatJSonSchema(name); if (json != null) { List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("dataformat", json, false); String df = null; String artifact = null; for (Map<String, String> row : data) { if (row.get("artifactId") != null) { artifact = row.get("artifactId"); } if (row.get("name") != null) { df = row.get("name"); } } if (artifactId.equals(artifact) && df != null) { answer.add(df); } } } return answer; }
Example #13
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Gets the java type of the given model * * @param modelName the model name * @return the java type */ public static String getModelJavaType(CamelCatalog camelCatalog, String modelName) { // use the camel catalog String json = camelCatalog.modelJSonSchema(modelName); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false); if (data != null) { for (Map<String, String> propertyMap : data) { String javaType = propertyMap.get("javaType"); if (javaType != null) { return javaType; } } } return null; }
Example #14
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Whether the EIP supports outputs * * @param modelName the model name * @return <tt>true</tt> if output supported, <tt>false</tt> otherwise */ public static boolean isModelSupportOutput(CamelCatalog camelCatalog, String modelName) { // use the camel catalog String json = camelCatalog.modelJSonSchema(modelName); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false); if (data != null) { for (Map<String, String> propertyMap : data) { String output = propertyMap.get("output"); if (output != null) { return "true".equals(output); } } } return false; }
Example #15
Source File: CatalogProcessor3Test.java From camel-k-runtime with Apache License 2.0 | 6 votes |
@Test public void testArtifactsDoNotContainVersion() { CatalogProcessor processor = new CatalogProcessor3x(); CamelCatalog catalog = versionCamelCatalog("3.0.0"); RuntimeSpec runtime = new RuntimeSpec.Builder().version("1.0.0").provider("main").applicationClass("unknown").build(); CamelCatalogSpec.Builder builder = new CamelCatalogSpec.Builder().runtime(runtime); assertThat(processor.accepts(catalog)).isTrue(); processor.process(new MavenProject(), catalog, builder); CamelCatalogSpec spec = builder.build(); Map<String, CamelArtifact> artifactMap = spec.getArtifacts(); for (Map.Entry<String, CamelArtifact> artifact: artifactMap.entrySet()) { assertThat(artifact.getValue().getVersion()).isNotPresent(); for (Artifact dependency: artifact.getValue().getDependencies()) { assertThat(dependency.getVersion()).isNotPresent(); } } }
Example #16
Source File: CamelComponentOptionNamesCompletionFuture.java From camel-language-server with Apache License 2.0 | 6 votes |
@Override public List<CompletionItem> apply(CamelCatalog catalog) { Stream<ComponentOptionModel> endpointOptions = ModelHelper.generateComponentModel(catalog.componentJSonSchema(componentId), true).getComponentOptions().stream(); return endpointOptions .map(parameter -> { CompletionItem completionItem = new CompletionItem(parameter.getName()); completionItem.setDocumentation(parameter.getDescription()); completionItem.setDetail(parameter.getJavaType()); completionItem.setDeprecated(Boolean.valueOf(parameter.getDeprecated())); String insertText = parameter.getName(); if (hasValueProvided() && parameter.getDefaultValue() != null) { insertText += String.format("=%s", parameter.getDefaultValue()); } completionItem.setInsertText(insertText); CompletionResolverUtils.applyTextEditToCompletionItem(camelComponentParameterPropertyFileInstance, completionItem); return completionItem; }) .filter(FilterPredicateUtils.matchesCompletionFilter(startFilter)) .collect(Collectors.toList()); }
Example #17
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
/** * Whether the component is consumer only */ public static boolean isComponentConsumerOnly(CamelCatalog camelCatalog, String scheme) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { return false; } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("component", json, false); if (data != null) { for (Map<String, String> propertyMap : data) { String consumerOnly = propertyMap.get("consumerOnly"); if (consumerOnly != null) { return true; } } } return false; }
Example #18
Source File: ConfigureEndpointPropertiesStep.java From fabric8-forge with Apache License 2.0 | 6 votes |
public ConfigureEndpointPropertiesStep(ProjectFactory projectFactory, DependencyInstaller dependencyInstaller, CamelCatalog camelCatalog, String componentName, String group, List<InputComponent> allInputs, List<InputComponent> inputs, boolean last, int index, int total) { this.projectFactory = projectFactory; this.dependencyInstaller = dependencyInstaller; this.camelCatalog = camelCatalog; this.componentName = componentName; this.group = group; this.allInputs = allInputs; this.inputs = inputs; this.last = last; // we want to 1-based this.index = index + 1; this.total = total; }
Example #19
Source File: ComponentProxyComponent.java From syndesis with Apache License 2.0 | 6 votes |
public ComponentProxyComponent(String componentId, String componentScheme, String componentClass, CamelCatalog catalog) { this.componentId = StringHelper.notEmpty(componentId, "componentId"); this.componentScheme = StringHelper.notEmpty(componentScheme, "componentScheme"); this.componentSchemeAlias = Optional.empty(); this.configuredOptions = new HashMap<>(); this.remainingOptions = new HashMap<>(); this.catalog = ObjectHelper.notNull(catalog, "catalog"); if (ObjectHelper.isNotEmpty(componentClass)) { this.catalog.addComponent(componentScheme, componentClass); } try { this.definition = ComponentDefinition.forScheme(catalog, componentScheme); } catch (IOException e) { throw RuntimeCamelException.wrapRuntimeCamelException(e); } registerExtension(this::getComponentVerifierExtension); }
Example #20
Source File: ConfigureComponentPropertiesStep.java From fabric8-forge with Apache License 2.0 | 6 votes |
public ConfigureComponentPropertiesStep(ProjectFactory projectFactory, DependencyInstaller dependencyInstaller, CamelCatalog camelCatalog, String componentName, String group, List<InputComponent> allInputs, List<InputComponent> inputs, boolean last, int index, int total) { this.projectFactory = projectFactory; this.dependencyInstaller = dependencyInstaller; this.camelCatalog = camelCatalog; this.componentName = componentName; this.group = group; this.allInputs = allInputs; this.inputs = inputs; this.last = last; // we want to 1-based this.index = index + 1; this.total = total; }
Example #21
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
public static Set<String> componentsFromArtifact(CamelCatalog camelCatalog, String artifactId) { Set<String> answer = new TreeSet<String>(); // use the camel catalog to find what components the artifact has for (String name : camelCatalog.findComponentNames()) { String json = camelCatalog.componentJSonSchema(name); if (json != null) { List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("component", json, false); String scheme = null; String artifact = null; for (Map<String, String> row : data) { if (row.get("artifactId") != null) { artifact = row.get("artifactId"); } if (row.get("scheme") != null) { scheme = row.get("scheme"); } } if (artifactId.equals(artifact) && scheme != null) { answer.add(scheme); } } } return answer; }
Example #22
Source File: CamelCatalogHelper.java From fabric8-forge with Apache License 2.0 | 6 votes |
public static Set<String> languagesFromArtifact(CamelCatalog camelCatalog, String artifactId) { Set<String> answer = new TreeSet<String>(); // use the camel catalog to find what components the artifact has for (String name : camelCatalog.findLanguageNames()) { String json = camelCatalog.languageJSonSchema(name); if (json != null) { List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("language", json, false); String lan = null; String artifact = null; for (Map<String, String> row : data) { if (row.get("artifactId") != null) { artifact = row.get("artifactId"); } if (row.get("name") != null) { lan = row.get("name"); } } if (artifactId.equals(artifact) && lan != null) { answer.add(lan); } } } return answer; }
Example #23
Source File: CamelComponentOptionValuesCompletionsFuture.java From camel-language-server with Apache License 2.0 | 5 votes |
private Optional<ComponentOptionModel> retrieveEndpointOptionModel(CamelCatalog camelCatalog) { CamelComponentPropertyFilekey camelComponentPropertyFilekey = camelPropertyFileValueInstance.getKey().getCamelComponentPropertyFilekey(); if(camelComponentPropertyFilekey != null) { String componentId = camelComponentPropertyFilekey.getComponentId(); String keyName = camelComponentPropertyFilekey.getComponentProperty(); if (keyName != null) { List<ComponentOptionModel> endpointOptions = ModelHelper.generateComponentModel(camelCatalog.componentJSonSchema(componentId), true).getComponentOptions(); return endpointOptions.stream() .filter(endpoint -> keyName.equals(endpoint.getName())) .findAny(); } } return Optional.empty(); }
Example #24
Source File: CamelPropertyFileKeyInstance.java From camel-language-server with Apache License 2.0 | 5 votes |
public CamelPropertyFileKeyInstance(CompletableFuture<CamelCatalog> camelCatalog, String camelPropertyFileKey, CamelPropertyFileEntryInstance camelPropertyFileEntryInstance) { this.camelPropertyFileKey = camelPropertyFileKey; this.camelPropertyFileEntryInstance = camelPropertyFileEntryInstance; if (camelPropertyFileKey.startsWith(CAMEL_COMPONENT_KEY_PREFIX)) { camelComponentPropertyFilekey = new CamelComponentPropertyFilekey(camelCatalog, camelPropertyFileKey.substring(CAMEL_COMPONENT_KEY_PREFIX.length()), this); } }
Example #25
Source File: CamelComponentPropertyFilekey.java From camel-language-server with Apache License 2.0 | 5 votes |
public CamelComponentPropertyFilekey(CompletableFuture<CamelCatalog> camelCatalog, String camelComponentPropertyFileKey, CamelPropertyFileKeyInstance camelPropertyFileKeyInstance) { this.fullCamelComponentPropertyFileKey = camelComponentPropertyFileKey; this.camelPropertyFileKeyInstance = camelPropertyFileKeyInstance; int firstDotIndex = camelComponentPropertyFileKey.indexOf('.'); if(firstDotIndex != -1) { componentName = new CamelComponentNamePropertyFileInstance(camelCatalog, camelComponentPropertyFileKey.substring(0, firstDotIndex), this); componentProperty = new CamelComponentParameterPropertyFileInstance(camelCatalog, camelComponentPropertyFileKey.substring(firstDotIndex+1), componentName.getEndPositionInLine() + 1, this); } else { componentName = new CamelComponentNamePropertyFileInstance(camelCatalog, camelComponentPropertyFileKey, this); } }
Example #26
Source File: CamelCommandsHelper.java From fabric8-forge with Apache License 2.0 | 5 votes |
public static Callable<Iterable<ComponentDto>> createAllComponentDtoValues(final Project project, final CamelCatalog camelCatalog, final UISelectOne<String> componentCategoryFilter, final boolean excludeComponentsOnClasspath) { // use callable so we can live update the filter return new Callable<Iterable<ComponentDto>>() { @Override public Iterable<ComponentDto> call() throws Exception { String label = componentCategoryFilter.getValue(); return new CamelComponentsCompleter(project, camelCatalog, null, excludeComponentsOnClasspath, true, false, false, false).getValueChoices(label); } }; }
Example #27
Source File: CamelDocumentationProvider.java From camel-idea-plugin with Apache License 2.0 | 5 votes |
/** * Generates documentation for the endpoint option. * @param componentName the name of the Camel component * @param option the name of the Camel component option to generate documentation for * @param project the current project * @return a String representing the HTML documentation */ private String generateCamelEndpointOptionDocumentation(String componentName, String option, Project project) { CamelCatalog camelCatalog = ServiceManager.getService(project, CamelCatalogService.class).get(); String json = camelCatalog.componentJSonSchema(componentName); if (json == null) { return null; } ComponentModel component = ModelHelper.generateComponentModel(json, true); EndpointOptionModel endpointOption; if (option.endsWith(".")) { // find the line with this prefix as prefix and multivalue endpointOption = component.getEndpointOptions().stream().filter( o -> "true".equals(o.getMultiValue()) && option.equals(o.getPrefix())) .findFirst().orElse(null); } else { endpointOption = component.getEndpointOption(option); } if (endpointOption == null) { return null; } StringBuilder builder = new StringBuilder(); builder.append("<strong>").append(endpointOption.getName()).append("</strong><br/><br/>"); builder.append("<strong>Group: </strong>").append(endpointOption.getGroup()).append("<br/>"); builder.append("<strong>Type: </strong>").append("<tt>").append(endpointOption.getJavaType()).append("</tt>").append("<br/>"); boolean required = false; if (!endpointOption.getRequired().equals("")) { required = true; } builder.append("<strong>Required: </strong>").append(required).append("<br/>"); if (!endpointOption.getEnums().equals("")) { builder.append("<strong>Possible values: </strong>").append(endpointOption.getEnums().replace(",", ", ")).append("<br/>"); } if (!endpointOption.getDefaultValue().equals("")) { builder.append("<strong>Default value: </strong>").append(endpointOption.getDefaultValue()).append("<br/>"); } builder.append("<br/><div>").append(endpointOption.getDescription()).append("</div>"); return builder.toString(); }
Example #28
Source File: CamelCommandsHelper.java From fabric8-forge with Apache License 2.0 | 5 votes |
public static Callable<Iterable<ComponentDto>> createComponentDtoValues(final Project project, final CamelCatalog camelCatalog, final UISelectOne<String> componentCategoryFilter, final boolean excludeComponentsOnClasspath) { // use callable so we can live update the filter return new Callable<Iterable<ComponentDto>>() { @Override public Iterable<ComponentDto> call() throws Exception { String label = componentCategoryFilter != null ? componentCategoryFilter.getValue() : null; return new CamelComponentsCompleter(project, camelCatalog, null, excludeComponentsOnClasspath, false, false, false, false).getValueChoices(label); } }; }
Example #29
Source File: CamelComponentSchemesCompletionsFuture.java From camel-language-server with Apache License 2.0 | 5 votes |
@Override public List<CompletionItem> apply(CamelCatalog catalog) { List<CompletionItem> result = getCompletionForComponents(catalog); if (ReferenceUtils.isReferenceComponentKind(uriElement)) { result.addAll(addExistingEndpointsOfSameSchemeCompletionItems()); } return result; }
Example #30
Source File: CamelOptionValuesCompletionsFuture.java From camel-language-server with Apache License 2.0 | 5 votes |
private Optional<EndpointOptionModel> retrieveEndpointOptionModel(CamelCatalog camelCatalog) { String componentName = optionParamValueURIInstance.getOptionParamURIInstance().getComponentName(); String keyName = optionParamValueURIInstance.getOptionParamURIInstance().getKey().getKeyName(); List<EndpointOptionModel> endpointOptions = ModelHelper.generateComponentModel(camelCatalog.componentJSonSchema(componentName), true).getEndpointOptions(); return endpointOptions.stream() .filter(endpoint -> keyName.equals(endpoint.getName())) .findAny(); }