org.apache.camel.catalog.DefaultCamelCatalog Java Examples
The following examples show how to use
org.apache.camel.catalog.DefaultCamelCatalog.
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: CamelTextDocumentService.java From camel-language-server with Apache License 2.0 | 6 votes |
public void updateCatalog(String camelVersion, List<Map<?,?>> extraComponents) { camelCatalog = CompletableFuture.supplyAsync(() -> { DefaultCamelCatalog catalog = new DefaultCamelCatalog(true); if (camelVersion != null && !camelVersion.isEmpty()) { catalog.setVersionManager(new MavenVersionManager()); if (!catalog.loadVersion(camelVersion)) { LOGGER.warn("Cannot load Camel catalog with version {}", camelVersion); } } if (extraComponents != null) { for (Map<?,?> extraComponent : extraComponents) { JSONUtility jsonUtility = new JSONUtility(); Map<?,?> extraComponentTopLevel = jsonUtility.toModel(extraComponent, Map.class); Map<?,?> componentAttributes = jsonUtility.toModel(extraComponentTopLevel.get("component"), Map.class); String name = (String) componentAttributes.get("scheme"); String className = (String) componentAttributes.get("javaType"); catalog.addComponent(name, className, new Gson().toJson(extraComponent)); } } return catalog; }); }
Example #2
Source File: CqCatalog.java From camel-quarkus with Apache License 2.0 | 5 votes |
public CqCatalog(Path baseDir) { super(); final DefaultCamelCatalog c = new DefaultCamelCatalog(true); c.setRuntimeProvider(new CqRuntimeProvider(c)); c.setVersionManager(new CqVersionManager(c, baseDir)); this.catalog = c; }
Example #3
Source File: AbstractCatalogProcessorTest.java From camel-k-runtime with Apache License 2.0 | 5 votes |
protected CamelCatalog versionCamelCatalog(String version) { return new DefaultCamelCatalog() { @Override public String getCatalogVersion() { return version; } }; }
Example #4
Source File: KnativeComponentProxyFactory.java From syndesis with Apache License 2.0 | 5 votes |
public static CamelCatalog createCatalog() { String jsonSchema; try (InputStream schemaStream = KnativeComponentProxyFactory.class.getResourceAsStream("/org/apache/camel/component/knative/knative.json")) { jsonSchema = IOUtils.toString(schemaStream, StandardCharsets.UTF_8); } catch (Exception e) { throw ObjectHelper.wrapRuntimeCamelException(e); } CamelCatalog catalog = new DefaultCamelCatalog(false); catalog.addComponent("knative", "org.apache.camel.component.knative.KnativeComponent", jsonSchema); return catalog; }
Example #5
Source File: CamelArchetypeCatalogFactory.java From fabric8-forge with Apache License 2.0 | 5 votes |
@Override public ArchetypeCatalog getArchetypeCatalog() { if (cachedArchetypes == null) { // use the camel catalog to load the archetypes String xml = new DefaultCamelCatalog().archetypeCatalogAsXml(); if (xml != null) { try { cachedArchetypes = new ArchetypeCatalogXpp3Reader().read(new StringReader(xml)); } catch (Exception e) { logger.log(Level.SEVERE, "Error while retrieving archetypes", e); } } } return cachedArchetypes; }
Example #6
Source File: ConnectorGenerator.java From funktion-connectors with Apache License 2.0 | 5 votes |
private CamelCatalog createCamelCatalog() throws IOException{ CamelCatalog result = new DefaultCamelCatalog(true); //add funktion camel components Predicate<String> filter = new FilterBuilder().includePackage("io.fabric8.funktion.camel"); Reflections resources = new Reflections(new ConfigurationBuilder() .filterInputsBy(filter) .setScanners(new ResourcesScanner()) .setUrls(ClasspathHelper.forJavaClassPath())); Set<String> jsonFiles = resources.getResources(Pattern.compile(".*\\.json")); LOG.info("Processing Funktion Camel components ..."); for (String jsonFile: jsonFiles){ InputStream inputStream = getClass().getClassLoader().getResourceAsStream(jsonFile); ObjectMapper mapper = new ObjectMapper(); JsonNode root = mapper.readTree(inputStream); JsonNode component = root.path("component"); if (!component.isMissingNode()) { String scheme = component.path("scheme").asText(); String componentName = component.path("javaType").asText(); result.addComponent(scheme,componentName); LOG.info("Processed component " + scheme); }else{ LOG.error("Failed to find Component for " + jsonFile); } } return result; }
Example #7
Source File: QuarkusRuntimeProviderTest.java From camel-quarkus with Apache License 2.0 | 4 votes |
@BeforeAll public static void createCamelCatalog() { catalog = new DefaultCamelCatalog(); catalog.setRuntimeProvider(new QuarkusRuntimeProvider()); }
Example #8
Source File: CqCatalog.java From camel-quarkus with Apache License 2.0 | 4 votes |
public CqCatalog() { super(); this.catalog = new DefaultCamelCatalog(true); }
Example #9
Source File: SpringBootRuntimeProviderTest.java From camel-spring-boot with Apache License 2.0 | 4 votes |
@BeforeClass public static void createCamelCatalog() { catalog = new DefaultCamelCatalog(); catalog.setRuntimeProvider(new SpringBootRuntimeProvider()); }
Example #10
Source File: CamelTextDocumentService.java From camel-language-server with Apache License 2.0 | 4 votes |
public CamelTextDocumentService(CamelLanguageServer camelLanguageServer) { this.camelLanguageServer = camelLanguageServer; camelCatalog = CompletableFuture.supplyAsync(() -> new DefaultCamelCatalog(true)); }
Example #11
Source File: ComponentProxyComponent.java From syndesis with Apache License 2.0 | 4 votes |
public ComponentProxyComponent(String componentId, String componentScheme) { this(componentId, componentScheme, (String)null, new DefaultCamelCatalog(false)); }
Example #12
Source File: ComponentProxyComponent.java From syndesis with Apache License 2.0 | 4 votes |
public ComponentProxyComponent(String componentId, String componentScheme, String componentClass) { this(componentId, componentScheme, componentClass, new DefaultCamelCatalog(false)); }
Example #13
Source File: ComponentProxyComponent.java From syndesis with Apache License 2.0 | 4 votes |
public ComponentProxyComponent(String componentId, String componentScheme, Class<?> componentClass) { this(componentId, componentScheme, componentClass.getName(), new DefaultCamelCatalog(false)); }
Example #14
Source File: ComponentDefinitionTest.java From syndesis with Apache License 2.0 | 4 votes |
@Test public void testForScheme() throws IOException { ComponentDefinition definition = ComponentDefinition.forScheme(new DefaultCamelCatalog(), "direct"); Assert.assertNotNull(definition); Assert.assertEquals("direct:name", definition.getComponent().getSyntax()); }
Example #15
Source File: ComponentDefinitionTest.java From syndesis with Apache License 2.0 | 4 votes |
@Test public void testForSchemeNotFound() { assertThatExceptionOfType(IllegalArgumentException.class).isThrownBy(() -> ComponentDefinition.forScheme(new DefaultCamelCatalog(), "unknown")) .withMessage("Failed to find component definition for scheme 'unknown'. Missing component definition in classpath 'org/apache/camel/catalog/components/unknown.json'"); }
Example #16
Source File: WildFlyRuntimeProviderTest.java From wildfly-camel with Apache License 2.0 | 4 votes |
@BeforeClass public static void createCamelCatalog() { catalog = new DefaultCamelCatalog(); catalog.setRuntimeProvider(new WildFlyRuntimeProvider()); }