You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/03/26 12:04:52 UTC
[camel-karaf] 02/02: Catalog for Karaf
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-karaf.git
commit 2931b2a987ed06b5d5b1742af44a3e79251aa5a4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Mar 26 13:04:36 2020 +0100
Catalog for Karaf
---
catalog/camel-catalog-provider-karaf/pom.xml | 58 +--
.../catalog/karaf/KarafRuntimeProviderTest.java | 19 +
.../services/org/apache/camel/other.properties | 2 +-
.../camel/karaf/maven/PrepareCatalogKarafMojo.java | 433 ++++-----------------
4 files changed, 122 insertions(+), 390 deletions(-)
diff --git a/catalog/camel-catalog-provider-karaf/pom.xml b/catalog/camel-catalog-provider-karaf/pom.xml
index 3dceb24..e5d9ecc 100644
--- a/catalog/camel-catalog-provider-karaf/pom.xml
+++ b/catalog/camel-catalog-provider-karaf/pom.xml
@@ -17,7 +17,8 @@
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -77,34 +78,33 @@
<artifactId>camel-bundle-plugin</artifactId>
</plugin>
- <!-- unpack sources which are needed for the scheme generator -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>3.1.2</version>
- <executions>
- <execution>
- <id>process-sources</id>
- <phase>process-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-catalog</artifactId>
- <version>${project.version}</version>
- <type>jar</type>
- <overWrite>true</overWrite>
- <outputDirectory>target/classes/camel-catalog</outputDirectory>
- </artifactItem>
- </artifactItems>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
+ <!-- unpack sources which are needed for the scheme generator -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>3.1.2</version>
+ <executions>
+ <execution>
+ <id>process-sources</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-catalog</artifactId>
+ <version>${project.version}</version>
+ <type>jar</type>
+ <overWrite>true</overWrite>
+ <outputDirectory>target/sources/camel-catalog</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<!-- generate and include all components in the catalog -->
<plugin>
diff --git a/catalog/camel-catalog-provider-karaf/src/test/java/org/apache/camel/catalog/karaf/KarafRuntimeProviderTest.java b/catalog/camel-catalog-provider-karaf/src/test/java/org/apache/camel/catalog/karaf/KarafRuntimeProviderTest.java
index 6280cdc..e4dfc34 100644
--- a/catalog/camel-catalog-provider-karaf/src/test/java/org/apache/camel/catalog/karaf/KarafRuntimeProviderTest.java
+++ b/catalog/camel-catalog-provider-karaf/src/test/java/org/apache/camel/catalog/karaf/KarafRuntimeProviderTest.java
@@ -62,7 +62,26 @@ public class KarafRuntimeProviderTest {
assertNotNull(names);
assertFalse(names.isEmpty());
+ // core components
+ assertTrue(names.contains("direct"));
+ assertTrue(names.contains("seda"));
+ assertTrue(names.contains("vm"));
+ assertTrue(names.contains("log"));
+ assertTrue(names.contains("mock"));
+ assertTrue(names.contains("bean"));
+
+ // regular components
+ assertTrue(names.contains("ahc"));
+ assertTrue(names.contains("aws-s3"));
assertTrue(names.contains("ftp"));
+ assertTrue(names.contains("http"));
+ assertTrue(names.contains("jetty"));
+ assertTrue(names.contains("zookeeper"));
+
+ // hbase is not in karaf
+ assertFalse(names.contains("hbase"));
+
+ // pax is from camel-karaf
assertTrue(names.contains("paxlogging"));
}
diff --git a/components/camel-osgi-activator/src/generated/resources/META-INF/services/org/apache/camel/other.properties b/components/camel-osgi-activator/src/generated/resources/META-INF/services/org/apache/camel/other.properties
index 9138f8a..66edb5b 100644
--- a/components/camel-osgi-activator/src/generated/resources/META-INF/services/org/apache/camel/other.properties
+++ b/components/camel-osgi-activator/src/generated/resources/META-INF/services/org/apache/camel/other.properties
@@ -3,5 +3,5 @@ name=osgi-activator
groupId=org.apache.camel.karaf
artifactId=camel-osgi-activator
version=3.2.0-SNAPSHOT
-projectName=Camel :: OSGi Activator
+projectName=Camel Karaf :: OSGi Activator
projectDescription=Camel OSGi Activator for running Camel routes from other bundles
diff --git a/tooling/camel-catalog-generator-karaf-maven-plugin/src/main/java/org/apache/camel/karaf/maven/PrepareCatalogKarafMojo.java b/tooling/camel-catalog-generator-karaf-maven-plugin/src/main/java/org/apache/camel/karaf/maven/PrepareCatalogKarafMojo.java
index 94d0792..cc0cf34 100644
--- a/tooling/camel-catalog-generator-karaf-maven-plugin/src/main/java/org/apache/camel/karaf/maven/PrepareCatalogKarafMojo.java
+++ b/tooling/camel-catalog-generator-karaf-maven-plugin/src/main/java/org/apache/camel/karaf/maven/PrepareCatalogKarafMojo.java
@@ -17,7 +17,6 @@
package org.apache.camel.karaf.maven;
import java.io.File;
-import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -52,8 +51,6 @@ import org.apache.maven.project.MavenProjectHelper;
@Mojo(name = "prepare-catalog-karaf", threadSafe = true)
public class PrepareCatalogKarafMojo extends AbstractMojo {
- // TODO: move to camel-karaf and rework this catalog maven plugin
-
/**
* The maven project.
*/
@@ -91,22 +88,28 @@ public class PrepareCatalogKarafMojo extends AbstractMojo {
protected File featuresDir;
/**
- * The components directory where all the Apache Camel components are
+ * The components directory where all the Apache Camel components are from the camel-catalog
*/
- @Parameter(defaultValue = "${project.build.directory}/../../../components")
+ @Parameter(defaultValue = "${project.build.directory}/sources/camel-catalog/org/apache/camel/catalog/components")
protected File componentsDir;
/**
- * The camel-core directory
+ * The dataformats directory where all the Apache Camel components are from the camel-catalog
+ */
+ @Parameter(defaultValue = "${project.build.directory}/sources/camel-catalog/org/apache/camel/catalog/dataformats")
+ protected File dataformatsDir;
+
+ /**
+ * The languages directory where all the Apache Camel components are from the camel-catalog
*/
- @Parameter(defaultValue = "${project.build.directory}/../../../core/camel-core-engine")
- protected File coreDir;
+ @Parameter(defaultValue = "${project.build.directory}/sources/camel-catalog/org/apache/camel/catalog/languages")
+ protected File languagessDir;
/**
- * The camel-base directory
+ * The languages directory where all the Apache Camel components are from the camel-catalog
*/
- @Parameter(defaultValue = "${project.build.directory}/../../../core/camel-base")
- protected File baseDir;
+ @Parameter(defaultValue = "${project.build.directory}/sources/camel-catalog/org/apache/camel/catalog/others")
+ protected File otherssDir;
/**
* Maven ProjectHelper.
@@ -118,384 +121,98 @@ public class PrepareCatalogKarafMojo extends AbstractMojo {
* Execute goal.
*
* @throws MojoExecutionException execution of the main class or one of the
- * threads it generated failed.
- * @throws MojoFailureException something bad happened...
+ * threads it generated failed.
+ * @throws MojoFailureException something bad happened...
*/
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
Set<String> features = findKarafFeatures();
- executeComponents(features);
- executeDataFormats(features);
- executeLanguages(features);
- executeOthers(features);
+ executeFeatures(features);
}
- protected void executeComponents(Set<String> features) throws MojoExecutionException, MojoFailureException {
- getLog().info("Copying all Camel component json descriptors");
-
+ protected void executeFeatures(Set<String> features) throws MojoExecutionException, MojoFailureException {
// lets use sorted set/maps
Set<File> jsonFiles = new TreeSet<>();
- Set<File> componentFiles = new TreeSet<>();
- // find all json files in components and camel-core
if (componentsDir != null && componentsDir.isDirectory()) {
- File[] components = componentsDir.listFiles();
- if (components != null) {
- for (File dir : components) {
- if (dir.isDirectory() && !"target".equals(dir.getName())) {
- File target = new File(dir, "target/classes");
-
- // the directory must be in the list of known features
- if (!features.contains(dir.getName())) {
- continue;
- }
-
- // special for some components which is in a sub dir
- if ("camel-as2".equals(dir.getName())) {
- target = new File(dir, "camel-as2-component/target/classes");
- } else if ("camel-box".equals(dir.getName())) {
- target = new File(dir, "camel-box-component/target/classes");
- } else if ("camel-salesforce".equals(dir.getName())) {
- target = new File(dir, "camel-salesforce-component/target/classes");
- } else if ("camel-servicenow".equals(dir.getName())) {
- target = new File(dir, "camel-servicenow-component/target/classes");
- } else {
- // this module must be active with a source folder
- File src = new File(dir, "src");
- boolean active = src.isDirectory() && src.exists();
- if (!active) {
- continue;
- }
- }
-
- findComponentFilesRecursive(target, jsonFiles, componentFiles, new CamelComponentsFileFilter());
+ File[] files = componentsDir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ String name = stripExt(file);
+ if (features.contains("camel-" + name) || isCoreComponent(name)) {
+ jsonFiles.add(file);
}
}
}
}
- if (coreDir != null && coreDir.isDirectory()) {
- File target = new File(coreDir, "target/classes");
- findComponentFilesRecursive(target, jsonFiles, componentFiles, new CamelComponentsFileFilter());
+ if (!jsonFiles.isEmpty()) {
+ Path outDir = componentsOutDir.toPath();
+ copyFiles(outDir, jsonFiles);
+ generateJsonList(outDir, "../components.properties");
+ getLog().info("Copying " + jsonFiles.size() + " Camel component json descriptors");
}
- getLog().info("Found " + componentFiles.size() + " component.properties files");
- getLog().info("Found " + jsonFiles.size() + " component json files");
-
- // copy json files
- Path outDir = componentsOutDir.toPath();
- copyFiles(outDir, jsonFiles);
- generateJsonList(outDir, "../components.properties");
- }
-
- protected void executeDataFormats(Set<String> features) throws MojoExecutionException, MojoFailureException {
- getLog().info("Copying all Camel dataformat json descriptors");
-
- // lets use sorted set/maps
- Set<File> jsonFiles = new TreeSet<>();
- Set<File> dataFormatFiles = new TreeSet<>();
-
- // find all data formats from the components directory
- if (componentsDir != null && componentsDir.isDirectory()) {
- File[] dataFormats = componentsDir.listFiles();
- if (dataFormats != null) {
- for (File dir : dataFormats) {
- if (dir.isDirectory() && !"target".equals(dir.getName())) {
- // the directory must be in the list of known features
- if (!features.contains(dir.getName())) {
- continue;
- }
-
- // this module must be active with a source folder
- File src = new File(dir, "src");
- boolean active = src.isDirectory() && src.exists();
- if (!active) {
- continue;
- }
-
- File target = new File(dir, "target/classes");
- findDataFormatFilesRecursive(target, jsonFiles, dataFormatFiles, new CamelDataFormatsFileFilter());
- }
+ jsonFiles.clear();
+ if (dataformatsDir != null && dataformatsDir.isDirectory()) {
+ File[] files = dataformatsDir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ // all dataformats are supported on karaf
+ jsonFiles.add(file);
}
}
}
- if (coreDir != null && coreDir.isDirectory()) {
- File target = new File(coreDir, "target/classes");
- findDataFormatFilesRecursive(target, jsonFiles, dataFormatFiles, new CamelDataFormatsFileFilter());
- }
-
- getLog().info("Found " + dataFormatFiles.size() + " dataformat.properties files");
- getLog().info("Found " + jsonFiles.size() + " dataformat json files");
-
- // copy json files
- if (dataFormatFiles.size() != 0) {
- Path outDir = dataFormatsOutDir.toPath();
- copyFiles(outDir, jsonFiles);
- generateJsonList(outDir, "../dataformats.properties");
+ if (!jsonFiles.isEmpty()) {
+ Path outDir = dataFormatsOutDir.toPath();
+ copyFiles(outDir, jsonFiles);
+ generateJsonList(outDir, "../dataformats.properties");
+ getLog().info("Copying " + jsonFiles.size() + " Camel dataformat json descriptors");
}
- }
-
- protected void executeLanguages(Set<String> features) throws MojoExecutionException, MojoFailureException {
- getLog().info("Copying all Camel language json descriptors");
-
- // lets use sorted set/maps
- Set<File> jsonFiles = new TreeSet<>();
- Set<File> languageFiles = new TreeSet<>();
-
- // find all languages from the components directory
- if (componentsDir != null && componentsDir.isDirectory()) {
- File[] languages = componentsDir.listFiles();
- if (languages != null) {
- for (File dir : languages) {
- // the directory must be in the list of known features (or
- // known languages)
- if (!features.contains(dir.getName()) && !dir.getName().equals("camel-bean") && !dir.getName().equals("camel-xpath")) {
- continue;
- }
-
- // this module must be active with a source folder
- File src = new File(dir, "src");
- boolean active = src.isDirectory() && src.exists();
- if (!active) {
- continue;
- }
- if (dir.isDirectory() && !"target".equals(dir.getName())) {
- File target = new File(dir, "target/classes");
- findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
- }
+ jsonFiles.clear();
+ if (languagessDir != null && languagessDir.isDirectory()) {
+ File[] files = languagessDir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ // all languages are supported on karaf
+ jsonFiles.add(file);
}
}
}
- if (baseDir != null && baseDir.isDirectory()) {
- File target = new File(baseDir, "target/classes");
- findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
- // also look in camel-xml-jaxp
- target = new File(baseDir, "../camel-xml-jaxp/target/classes");
- findLanguageFilesRecursive(target, jsonFiles, languageFiles, new CamelLanguagesFileFilter());
- }
-
- getLog().info("Found " + languageFiles.size() + " language.properties files");
- getLog().info("Found " + jsonFiles.size() + " language json files");
-
- if (languageFiles.size() != 0) {
- // copy json files
- Path outDir = languagesOutDir.toPath();
- copyFiles(outDir, jsonFiles);
- generateJsonList(outDir, "../languages.properties");
+ if (!jsonFiles.isEmpty()) {
+ Path outDir = languagesOutDir.toPath();
+ copyFiles(outDir, jsonFiles);
+ generateJsonList(outDir, "../languages.properties");
+ getLog().info("Copying " + jsonFiles.size() + " Camel language json descriptors");
}
- }
-
- protected void executeOthers(Set<String> features) throws MojoExecutionException, MojoFailureException {
- getLog().info("Copying all Camel other json descriptors");
-
- // lets use sorted set/maps
- Set<File> jsonFiles = new TreeSet<>();
- Set<File> otherFiles = new TreeSet<>();
-
- // find all languages from the components directory
- if (componentsDir != null && componentsDir.isDirectory()) {
- File[] others = componentsDir.listFiles();
- if (others != null) {
- for (File dir : others) {
- // the directory must be in the list of known features
- if (!features.contains(dir.getName())) {
- continue;
- }
- // skip these special cases
- boolean special = "camel-core-osgi".equals(dir.getName()) || "camel-core-xml".equals(dir.getName()) || "camel-http-base".equals(dir.getName())
- || "camel-http-common".equals(dir.getName()) || "camel-jetty-common".equals(dir.getName());
- boolean special2 = "camel-as2".equals(dir.getName()) || "camel-box".equals(dir.getName()) || "camel-olingo2".equals(dir.getName())
- || "camel-olingo4".equals(dir.getName()) || "camel-servicenow".equals(dir.getName()) || "camel-salesforce".equals(dir.getName());
- boolean special3 = "camel-debezium-common".equals(dir.getName());
- if (special || special2 || special3) {
- continue;
+ jsonFiles.clear();
+ if (otherssDir != null && otherssDir.isDirectory()) {
+ File[] files = otherssDir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (features.contains("camel-" + stripExt(file))) {
+ jsonFiles.add(file);
}
-
- // this module must be active with a source folder
- File src = new File(dir, "src");
- boolean active = src.isDirectory() && src.exists();
- if (!active) {
- continue;
- }
-
- if (dir.isDirectory() && !"target".equals(dir.getName())) {
- File target = new File(dir, "target/classes");
- findOtherFilesRecursive(target, jsonFiles, otherFiles, new CamelOthersFileFilter());
- }
- }
- }
- }
- getLog().info("Found " + otherFiles.size() + " other.properties files");
- getLog().info("Found " + jsonFiles.size() + " other json files");
-
- // copy json files
- Path outDir = othersOutDir.toPath();
- copyFiles(outDir, jsonFiles);
- generateJsonList(outDir, "../others.properties");
- }
-
- private void findComponentFilesRecursive(File dir, Set<File> found, Set<File> components, FileFilter filter) {
- File[] files = dir.listFiles(filter);
- if (files != null) {
- for (File file : files) {
- // skip files in root dirs as Camel does not store information
- // there but others may do
- boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
- boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(PackageHelper.JSON_SUFIX);
- boolean componentFile = !rootDir && file.isFile() && file.getName().equals("component.properties");
- if (jsonFile) {
- found.add(file);
- } else if (componentFile) {
- components.add(file);
- } else if (file.isDirectory()) {
- findComponentFilesRecursive(file, found, components, filter);
- }
- }
- }
- }
-
- private void findDataFormatFilesRecursive(File dir, Set<File> found, Set<File> dataFormats, FileFilter filter) {
- File[] files = dir.listFiles(filter);
- if (files != null) {
- for (File file : files) {
- // skip files in root dirs as Camel does not store information
- // there but others may do
- boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
- boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(PackageHelper.JSON_SUFIX);
- boolean dataFormatFile = !rootDir && file.isFile() && file.getName().equals("dataformat.properties");
- if (jsonFile) {
- found.add(file);
- } else if (dataFormatFile) {
- dataFormats.add(file);
- } else if (file.isDirectory()) {
- findDataFormatFilesRecursive(file, found, dataFormats, filter);
- }
- }
- }
- }
-
- private void findLanguageFilesRecursive(File dir, Set<File> found, Set<File> languages, FileFilter filter) {
- File[] files = dir.listFiles(filter);
- if (files != null) {
- for (File file : files) {
- // skip files in root dirs as Camel does not store information
- // there but others may do
- boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
- boolean jsonFile = !rootDir && file.isFile() && file.getName().endsWith(PackageHelper.JSON_SUFIX);
- boolean languageFile = !rootDir && file.isFile() && file.getName().equals("language.properties");
- if (jsonFile) {
- found.add(file);
- } else if (languageFile) {
- languages.add(file);
- } else if (file.isDirectory()) {
- findLanguageFilesRecursive(file, found, languages, filter);
- }
- }
- }
- }
-
- private void findOtherFilesRecursive(File dir, Set<File> found, Set<File> others, FileFilter filter) {
- File[] files = dir.listFiles(filter);
- if (files != null) {
- for (File file : files) {
- // skip files in root dirs as Camel does not store information
- // there but others may do
- boolean rootDir = "classes".equals(dir.getName()) || "META-INF".equals(dir.getName());
- boolean jsonFile = rootDir && file.isFile() && file.getName().endsWith(PackageHelper.JSON_SUFIX);
- boolean otherFile = !rootDir && file.isFile() && file.getName().equals("other.properties");
- if (jsonFile) {
- found.add(file);
- } else if (otherFile) {
- others.add(file);
- } else if (file.isDirectory()) {
- findOtherFilesRecursive(file, found, others, filter);
- }
- }
- }
- }
-
- private static class CamelComponentsFileFilter implements FileFilter {
-
- @Override
- public boolean accept(File pathname) {
- if (pathname.isDirectory() && pathname.getName().equals("model")) {
- // do not check the camel-core model packages as there is no
- // components there
- return false;
- }
- if (pathname.isFile() && pathname.getName().endsWith(PackageHelper.JSON_SUFIX)) {
- // must be a components json file
- try {
- String json = PackageHelper.loadText(pathname);
- return "component".equals(PackageHelper.getSchemaKind(json));
- } catch (IOException e) {
- // ignore
}
}
- return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("component.properties"));
}
- }
-
- private static class CamelDataFormatsFileFilter implements FileFilter {
-
- @Override
- public boolean accept(File pathname) {
- if (pathname.isDirectory() && pathname.getName().equals("model")) {
- // do not check the camel-core model packages as there is no
- // components there
- return false;
- }
- if (pathname.isFile() && pathname.getName().endsWith(PackageHelper.JSON_SUFIX)) {
- // must be a dataformat json file
- try {
- String json = PackageHelper.loadText(pathname);
- return "dataformat".equals(PackageHelper.getSchemaKind(json));
- } catch (IOException e) {
- // ignore
- }
- }
- return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("dataformat.properties"));
+ if (!jsonFiles.isEmpty()) {
+ Path outDir = othersOutDir.toPath();
+ copyFiles(outDir, jsonFiles);
+ generateJsonList(outDir, "../others.properties");
+ getLog().info("Copying " + jsonFiles.size() + " Camel other json descriptors");
}
}
- private static class CamelLanguagesFileFilter implements FileFilter {
-
- @Override
- public boolean accept(File pathname) {
- if (pathname.isDirectory() && pathname.getName().equals("model")) {
- // do not check the camel-core model packages as there is no
- // components there
- return false;
- }
- if (pathname.isFile() && pathname.getName().endsWith(PackageHelper.JSON_SUFIX)) {
- // must be a language json file
- try {
- String json = PackageHelper.loadText(pathname);
- return "language".equals(PackageHelper.getSchemaKind(json));
- } catch (IOException e) {
- // ignore
- }
- }
- return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("language.properties"));
- }
+ private static boolean isCoreComponent(String name) {
+ return ("bean,browse,controlbus,dataformat,dataset,direct,directvm,file,language,log,mock,ref"
+ + ",rest,saga,scheduler,seda,stub,timer,validator,vm,xpath,xslt").contains(name);
}
- private static class CamelOthersFileFilter implements FileFilter {
-
- @Override
- public boolean accept(File pathname) {
- if (pathname.isFile() && pathname.getName().endsWith(PackageHelper.JSON_SUFIX)) {
- // must be a language json file
- try {
- String json = PackageHelper.loadText(pathname);
- return "other".equals(PackageHelper.getSchemaKind(json));
- } catch (IOException e) {
- // ignore
- }
- }
- return pathname.isDirectory() || (pathname.isFile() && pathname.getName().equals("other.properties"));
- }
+ private static String stripExt(File file) {
+ String name = file.getName();
+ return name.substring(0, name.indexOf("."));
}
public static void copyFiles(Path outDir, Collection<File> files) throws MojoFailureException {
@@ -513,8 +230,8 @@ public class PrepareCatalogKarafMojo extends AbstractMojo {
Path all = outDir.resolve(outFile);
try {
Set<String> answer = Files.list(outDir).filter(p -> p.getFileName().toString().endsWith(PackageHelper.JSON_SUFIX)).map(p -> p.getFileName().toString())
- // strip out .json from the name
- .map(n -> n.substring(0, n.length() - PackageHelper.JSON_SUFIX.length())).sorted().collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
+ // strip out .json from the name
+ .map(n -> n.substring(0, n.length() - PackageHelper.JSON_SUFIX.length())).sorted().collect(LinkedHashSet::new, LinkedHashSet::add, LinkedHashSet::addAll);
String data = String.join("\n", answer) + "\n";
FileUtil.updateFile(all, data);
return answer;
@@ -523,10 +240,6 @@ public class PrepareCatalogKarafMojo extends AbstractMojo {
}
}
- public static void copyFile(File from, File to) throws IOException {
- FileUtil.updateFile(from.toPath(), to.toPath());
- }
-
private Set<String> findKarafFeatures() throws MojoExecutionException, MojoFailureException {
// load features.xml file and parse it