This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 907dceaf21082b7a8615e400a3895bb31d5d0335 Author: Claus Ibsen <[email protected]> AuthorDate: Wed Jun 15 06:35:56 2022 +0200 camel-jbang - Cleanup and removed unused code --- .../apache/camel/dsl/jbang/core/api/Converter.java | 23 ----- .../apache/camel/dsl/jbang/core/api/Extractor.java | 21 ---- .../apache/camel/dsl/jbang/core/api/Printer.java | 21 ---- .../camel/dsl/jbang/core/api/TemplateParser.java | 25 ----- .../dsl/jbang/core/commands/AbstractSearch.java | 106 --------------------- .../apache/camel/dsl/jbang/core/commands/Init.java | 8 +- .../apache/camel/dsl/jbang/core/commands/Run.java | 6 +- .../core/{commands => common}/GistHelper.java | 2 +- .../core/{commands => common}/GitHubHelper.java | 2 +- .../dsl/jbang/core/common/MatchExtractor.java | 46 --------- .../{exceptions => }/ResourceDoesNotExist.java | 2 +- .../common/exceptions/ResourceAlreadyExists.java | 28 ------ .../jbang/core/components/ComponentConverter.java | 37 ------- .../components/ComponentDescriptionMatching.java | 34 ------- .../jbang/core/components/ComponentPrinter.java | 28 ------ .../dsl/jbang/core/kamelets/KameletConverter.java | 35 ------- .../core/kamelets/KameletDescriptionMatching.java | 34 ------- .../dsl/jbang/core/kamelets/KameletPrinter.java | 28 ------ .../jbang/core/languages/LanguageConverter.java | 37 ------- .../languages/LanguageDescriptionMatching.java | 34 ------- .../dsl/jbang/core/languages/LanguagePrinter.java | 28 ------ .../dsl/jbang/core/others/OtherConverter.java | 37 ------- .../core/others/OtherDescriptionMatching.java | 34 ------- .../camel/dsl/jbang/core/others/OtherPrinter.java | 28 ------ .../camel/dsl/jbang/core/types/Component.java | 24 ----- .../apache/camel/dsl/jbang/core/types/Kamelet.java | 23 ----- .../camel/dsl/jbang/core/types/Language.java | 21 ---- .../apache/camel/dsl/jbang/core/types/Other.java | 20 ---- 28 files changed, 10 insertions(+), 762 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Converter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Converter.java deleted file mode 100644 index 7a66a2ba94d..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Converter.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.api; - -import java.util.regex.Matcher; - -public interface Converter<T> { - T convert(Matcher matcher); -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Extractor.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Extractor.java deleted file mode 100644 index be2ff86e5e7..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Extractor.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.api; - -public interface Extractor { - void extract(String line); -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Printer.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Printer.java deleted file mode 100644 index 2582f175921..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/Printer.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.api; - -public interface Printer<T> { - void inject(T data); -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/TemplateParser.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/TemplateParser.java deleted file mode 100644 index eacf43b9b26..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/api/TemplateParser.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.api; - -import java.io.Writer; - -import org.apache.camel.CamelException; - -public interface TemplateParser { - void parse(String templateFileName, Writer writer) throws CamelException; -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/AbstractSearch.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/AbstractSearch.java deleted file mode 100644 index cb14056b604..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/AbstractSearch.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.commands; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.util.regex.Pattern; - -import org.apache.camel.CamelContext; -import org.apache.camel.dsl.jbang.core.api.Extractor; -import org.apache.camel.dsl.jbang.core.common.RuntimeUtil; -import org.apache.camel.dsl.jbang.core.common.exceptions.ResourceDoesNotExist; -import org.apache.camel.github.GitHubResourceResolver; -import org.apache.camel.main.KameletMain; -import org.apache.camel.spi.Resource; -import org.apache.commons.io.IOUtils; - -@Deprecated -public abstract class AbstractSearch { - private String resourceLocation; - private String branch; - - // Only used for the search subcommand - protected AbstractSearch() { - } - - public AbstractSearch(String resourceLocation, Pattern pattern) { - this.resourceLocation = resourceLocation; - } - - protected void setResourceLocation(String baseResourceLocation, String resourcePath) { - this.resourceLocation = baseResourceLocation + ":" + resourcePath; - } - - public void setBranch(String branch) { - this.branch = branch; - } - - protected void downloadResource(File indexFile) throws ResourceDoesNotExist, IOException { - // turn off logging as we use camel to download - RuntimeUtil.configureLog("off", true, false, false, false); - - KameletMain main = new KameletMain(); - main.start(); - CamelContext context = main.getCamelContext(); - - try (GitHubResourceResolver resolver = new GitHubResourceResolver()) { - resolver.setCamelContext(context); - resolver.setBranch(branch); - - Resource resource = resolver.resolve(resourceLocation); - if (!resource.exists()) { - throw new ResourceDoesNotExist(resource); - } - - try (FileOutputStream fo = new FileOutputStream(indexFile)) { - IOUtils.copy(resource.getInputStream(), fo); - } - } - } - - private void readFileByLine(File indexFile, Extractor extractor) throws IOException { - FileReader indexFileReader = new FileReader(indexFile); - try (BufferedReader br = new BufferedReader(indexFileReader)) { - String line; - do { - line = br.readLine(); - if (line != null) { - extractor.extract(line); - } - } while (line != null); - } - } - - public abstract void printHeader(); - - public void search(Extractor extractor) throws ResourceDoesNotExist, IOException { - File indexFile = getIndexFile(); - printHeader(); - readFileByLine(indexFile, extractor); - } - - private File getIndexFile() throws ResourceDoesNotExist, IOException { - File indexFile = new File("index"); - indexFile.deleteOnExit(); - downloadResource(indexFile); - return indexFile; - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java index f6cacc55bab..c002c9db9c4 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java @@ -21,7 +21,7 @@ import java.io.InputStream; import java.util.StringJoiner; import org.apache.camel.CamelContext; -import org.apache.camel.dsl.jbang.core.common.exceptions.ResourceDoesNotExist; +import org.apache.camel.dsl.jbang.core.common.ResourceDoesNotExist; import org.apache.camel.github.GistResourceResolver; import org.apache.camel.github.GitHubResourceResolver; import org.apache.camel.impl.lw.LightweightCamelContext; @@ -33,9 +33,9 @@ import picocli.CommandLine; import picocli.CommandLine.Command; import picocli.CommandLine.Option; -import static org.apache.camel.dsl.jbang.core.commands.GistHelper.fetchGistUrls; -import static org.apache.camel.dsl.jbang.core.commands.GitHubHelper.asGithubSingleUrl; -import static org.apache.camel.dsl.jbang.core.commands.GitHubHelper.fetchGithubUrls; +import static org.apache.camel.dsl.jbang.core.common.GistHelper.fetchGistUrls; +import static org.apache.camel.dsl.jbang.core.common.GitHubHelper.asGithubSingleUrl; +import static org.apache.camel.dsl.jbang.core.common.GitHubHelper.fetchGithubUrls; @Command(name = "init", description = "Initialize empty Camel integration") class Init extends CamelCommand { diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java index 568768edf0c..317eabc84c6 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java @@ -65,9 +65,9 @@ import picocli.CommandLine.Command; import picocli.CommandLine.Option; import picocli.CommandLine.Parameters; -import static org.apache.camel.dsl.jbang.core.commands.GistHelper.fetchGistUrls; -import static org.apache.camel.dsl.jbang.core.commands.GitHubHelper.asGithubSingleUrl; -import static org.apache.camel.dsl.jbang.core.commands.GitHubHelper.fetchGithubUrls; +import static org.apache.camel.dsl.jbang.core.common.GistHelper.fetchGistUrls; +import static org.apache.camel.dsl.jbang.core.common.GitHubHelper.asGithubSingleUrl; +import static org.apache.camel.dsl.jbang.core.common.GitHubHelper.fetchGithubUrls; @Command(name = "run", description = "Run as local Camel application") class Run extends CamelCommand { diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GistHelper.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/GistHelper.java similarity index 99% rename from dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GistHelper.java rename to dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/GistHelper.java index 33dd9d598f0..bf7fc58ac75 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GistHelper.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/GistHelper.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.jbang.core.commands; +package org.apache.camel.dsl.jbang.core.common; import java.net.URI; import java.net.http.HttpClient; diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GitHubHelper.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/GitHubHelper.java similarity index 99% rename from dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GitHubHelper.java rename to dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/GitHubHelper.java index efd708d5656..d7d7fb09c50 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GitHubHelper.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/GitHubHelper.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.jbang.core.commands; +package org.apache.camel.dsl.jbang.core.common; import java.net.URI; import java.net.http.HttpClient; diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/MatchExtractor.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/MatchExtractor.java deleted file mode 100644 index 2d0c52d8e7d..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/MatchExtractor.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.common; - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.apache.camel.dsl.jbang.core.api.Converter; -import org.apache.camel.dsl.jbang.core.api.Extractor; -import org.apache.camel.dsl.jbang.core.api.Printer; - -public class MatchExtractor<T> implements Extractor { - private final Pattern pattern; - private final Converter<T> converter; - private final Printer<T> injector; - - public MatchExtractor(Pattern pattern, Converter<T> converter, Printer<T> injector) { - this.pattern = pattern; - this.converter = converter; - this.injector = injector; - } - - @Override - public void extract(String line) { - Matcher matcher = pattern.matcher(line); - - if (matcher.find()) { - T data = converter.convert(matcher); - injector.inject(data); - } - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/exceptions/ResourceDoesNotExist.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/ResourceDoesNotExist.java similarity index 94% rename from dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/exceptions/ResourceDoesNotExist.java rename to dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/ResourceDoesNotExist.java index ef656aaf8ae..b1a3b01b80d 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/exceptions/ResourceDoesNotExist.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/ResourceDoesNotExist.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.dsl.jbang.core.common.exceptions; +package org.apache.camel.dsl.jbang.core.common; import org.apache.camel.CamelException; import org.apache.camel.spi.Resource; diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/exceptions/ResourceAlreadyExists.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/exceptions/ResourceAlreadyExists.java deleted file mode 100644 index 24d4eaa32bb..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/common/exceptions/ResourceAlreadyExists.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.common.exceptions; - -import java.io.File; - -import org.apache.camel.CamelException; - -public class ResourceAlreadyExists extends CamelException { - - public ResourceAlreadyExists(File resource) { - super("The destination file already exists: " + resource.getAbsolutePath()); - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentConverter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentConverter.java deleted file mode 100644 index 977c2eff1f9..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.components; - -import java.util.regex.Matcher; - -import org.apache.camel.dsl.jbang.core.api.Converter; -import org.apache.camel.dsl.jbang.core.types.Component; - -public class ComponentConverter implements Converter<Component> { - - @Override - public Component convert(Matcher matcher) { - Component component = new Component(); - - component.name = matcher.group(2).replace(".adoc", ""); - component.shortName = component.name.replace("-component", ""); - component.description = matcher.group(3); - component.link = String.format("https://camel.apache.org/components/latest/%s.html", component.name); - - return component; - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentDescriptionMatching.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentDescriptionMatching.java deleted file mode 100644 index fb357f9f6a0..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentDescriptionMatching.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.components; - -import org.apache.camel.dsl.jbang.core.types.Component; - -public class ComponentDescriptionMatching extends ComponentPrinter { - private final String searchTerm; - - public ComponentDescriptionMatching(String searchTerm) { - this.searchTerm = searchTerm; - } - - @Override - public void inject(Component component) { - if (component.description.toLowerCase().contains(searchTerm.toLowerCase())) { - super.inject(component); - } - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentPrinter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentPrinter.java deleted file mode 100644 index dd2570eedca..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/components/ComponentPrinter.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.components; - -import org.apache.camel.dsl.jbang.core.api.Printer; -import org.apache.camel.dsl.jbang.core.types.Component; - -public class ComponentPrinter implements Printer<Component> { - - @Override - public void inject(Component component) { - System.out.printf("%-35s %-45s %s%n", component.shortName, component.description, component.link); - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletConverter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletConverter.java deleted file mode 100644 index 999d7e99e48..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletConverter.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.kamelets; - -import java.util.regex.Matcher; - -import org.apache.camel.dsl.jbang.core.api.Converter; -import org.apache.camel.dsl.jbang.core.types.Kamelet; - -public class KameletConverter implements Converter<Kamelet> { - - public Kamelet convert(Matcher matcher) { - Kamelet kamelet = new Kamelet(); - - kamelet.name = matcher.group(3).replace(".adoc", ""); - kamelet.description = matcher.group(5); - kamelet.link = String.format("https://camel.apache.org/camel-kamelets/latest/%s.html", kamelet.name); - - return kamelet; - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletDescriptionMatching.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletDescriptionMatching.java deleted file mode 100644 index cdbb50eada6..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletDescriptionMatching.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.kamelets; - -import org.apache.camel.dsl.jbang.core.types.Kamelet; - -public class KameletDescriptionMatching extends KameletPrinter { - private final String searchTerm; - - public KameletDescriptionMatching(String searchTerm) { - this.searchTerm = searchTerm; - } - - @Override - public void inject(Kamelet kamelet) { - if (kamelet.description.toLowerCase().contains(searchTerm.toLowerCase())) { - super.inject(kamelet); - } - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletPrinter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletPrinter.java deleted file mode 100644 index 6aa697e4a00..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/kamelets/KameletPrinter.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.kamelets; - -import org.apache.camel.dsl.jbang.core.api.Printer; -import org.apache.camel.dsl.jbang.core.types.Kamelet; - -public class KameletPrinter implements Printer<Kamelet> { - - @Override - public void inject(Kamelet kamelet) { - System.out.printf("%-35s %-45s %s%n", kamelet.name, kamelet.description, kamelet.link); - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguageConverter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguageConverter.java deleted file mode 100644 index a258e2a8bd3..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguageConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.languages; - -import java.util.regex.Matcher; - -import org.apache.camel.dsl.jbang.core.api.Converter; -import org.apache.camel.dsl.jbang.core.types.Language; - -public class LanguageConverter implements Converter<Language> { - - @Override - public Language convert(Matcher matcher) { - Language language = new Language(); - - language.name = matcher.group(2).replace(".adoc", ""); - language.shortName = language.name.replace("-language", ""); - language.description = matcher.group(3); - language.link = String.format("https://camel.apache.org/components/latest/languages/%s.html", language.name); - - return language; - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguageDescriptionMatching.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguageDescriptionMatching.java deleted file mode 100644 index 86df88f096e..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguageDescriptionMatching.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.languages; - -import org.apache.camel.dsl.jbang.core.types.Language; - -public class LanguageDescriptionMatching extends LanguagePrinter { - private final String searchTerm; - - public LanguageDescriptionMatching(String searchTerm) { - this.searchTerm = searchTerm; - } - - @Override - public void inject(Language language) { - if (language.description.toLowerCase().contains(searchTerm.toLowerCase())) { - super.inject(language); - } - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguagePrinter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguagePrinter.java deleted file mode 100644 index e439a5fc442..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/languages/LanguagePrinter.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.languages; - -import org.apache.camel.dsl.jbang.core.api.Printer; -import org.apache.camel.dsl.jbang.core.types.Language; - -public class LanguagePrinter implements Printer<Language> { - - @Override - public void inject(Language language) { - System.out.printf("%-35s %-45s %s%n", language.shortName, language.description, language.link); - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherConverter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherConverter.java deleted file mode 100644 index 5dbd79caea8..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherConverter.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.others; - -import java.util.regex.Matcher; - -import org.apache.camel.dsl.jbang.core.api.Converter; -import org.apache.camel.dsl.jbang.core.types.Other; - -public class OtherConverter implements Converter<Other> { - - @Override - public Other convert(Matcher matcher) { - Other other = new Other(); - - other.name = matcher.group(2).replace(".adoc", ""); - other.shortName = other.name.replace("-other", ""); - other.description = matcher.group(3); - other.link = String.format("https://camel.apache.org/components/latest/others/%s.html", other.name); - - return other; - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherDescriptionMatching.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherDescriptionMatching.java deleted file mode 100644 index 3c7ac5006ca..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherDescriptionMatching.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.others; - -import org.apache.camel.dsl.jbang.core.types.Other; - -public class OtherDescriptionMatching extends OtherPrinter { - private final String searchTerm; - - public OtherDescriptionMatching(String searchTerm) { - this.searchTerm = searchTerm; - } - - @Override - public void inject(Other other) { - if (other.description.toLowerCase().contains(searchTerm.toLowerCase())) { - super.inject(other); - } - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherPrinter.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherPrinter.java deleted file mode 100644 index 211ff9ff919..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/others/OtherPrinter.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.others; - -import org.apache.camel.dsl.jbang.core.api.Printer; -import org.apache.camel.dsl.jbang.core.types.Other; - -public class OtherPrinter implements Printer<Other> { - - @Override - public void inject(Other other) { - System.out.printf("%-35s %-45s %s%n", other.shortName, other.description, other.link); - } -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Component.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Component.java deleted file mode 100644 index de515633d09..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Component.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.types; - -public class Component { - public String name; - public String shortName; - public String description; - public String link; -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Kamelet.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Kamelet.java deleted file mode 100644 index ea0eaa07081..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Kamelet.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.types; - -public class Kamelet { - public String name; - public String description; - public String link; -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Language.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Language.java deleted file mode 100644 index 896266d5a85..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Language.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.types; - -public class Language extends Component { - -} diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Other.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Other.java deleted file mode 100644 index b97a580ca44..00000000000 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/types/Other.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.dsl.jbang.core.types; - -public class Other extends Component { -}
