Skip to content

Commit

Permalink
Catalog: expose an API for consuming connectors catalog metadata and …
Browse files Browse the repository at this point in the history
…options, some little adjustments
  • Loading branch information
oscerd committed Oct 9, 2020
1 parent 9b7c6bc commit c792fd5
Showing 1 changed file with 6 additions and 2 deletions.
Expand Up @@ -17,6 +17,7 @@
package org.apache.camel.kafkaconnector.catalog;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
Expand All @@ -42,6 +43,9 @@ public class CamelKafkaConnectorCatalog {
static List<String> connectorsName = new ArrayList<String>();
static Map<String, CamelKafkaConnectorModel> connectorsModel = new HashMap<String, CamelKafkaConnectorModel>();
private static final Logger LOG = LoggerFactory.getLogger(CamelKafkaConnectorCatalog.class);
private static final String CONNECTORS_DIR = "src/generated/resources/connectors";
private static final String DESCRIPTORS_DIR = "src/generated/resources/descriptors";
private static final String CONNECTORS_PROPERTIES = "connectors.properties";

public CamelKafkaConnectorCatalog() {
initCatalog();
Expand All @@ -55,7 +59,7 @@ private void generateModel() {
}

private void initCatalog() {
try (FileInputStream input = new FileInputStream("src/generated/resources/descriptors/connectors.properties")) {
try (FileInputStream input = new FileInputStream(DESCRIPTORS_DIR + File.separator + CONNECTORS_PROPERTIES)) {

BufferedReader reader = new BufferedReader(new InputStreamReader(input));

Expand Down Expand Up @@ -83,7 +87,7 @@ private void initCatalog() {
public String getConnectorAsJson(String connectorName) {
String result = null;
try {
result = Files.lines(Paths.get("src/generated/resources/connectors/" + connectorName + ".json")).parallel() // for
result = Files.lines(Paths.get(CONNECTORS_DIR + File.separator + connectorName + ".json")).parallel() // for
// parallel
// processing
.map(String::trim) // to change line
Expand Down

0 comments on commit c792fd5

Please sign in to comment.