-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #75: Adding camel-quarkus-catalog
- Loading branch information
Showing
22 changed files
with
1,779 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
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> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>catalog</artifactId> | ||
<version>0.2.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>camel-catalog-quarkus</artifactId> | ||
<packaging>jar</packaging> | ||
<name>Camel Quarkus :: Camel Quarkus Catalog</name> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-catalog</artifactId> | ||
<version>${camel.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.12</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
<!-- logging --> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-api</artifactId> | ||
<version>2.12.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
<version>2.12.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-slf4j-impl</artifactId> | ||
<version>2.12.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
|
||
<!-- generate and include all components in the catalog --> | ||
<plugin> | ||
<groupId>org.apache.camel.quarkus</groupId> | ||
<artifactId>camel-quarkus-package-maven-plugin</artifactId> | ||
<version>${project.version}</version> | ||
<dependencies> | ||
<!-- include camel-catalog on classpath --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-catalog</artifactId> | ||
<version>${camel.version}</version> | ||
</dependency> | ||
</dependencies> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>prepare-catalog-quarkus</goal> | ||
</goals> | ||
<phase>process-resources</phase> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
</plugins> | ||
|
||
</build> | ||
|
||
</project> |
146 changes: 146 additions & 0 deletions
146
...uarkus-catalog/src/main/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
/* | ||
* 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.catalog.quarkus; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.apache.camel.catalog.CamelCatalog; | ||
import org.apache.camel.catalog.CatalogHelper; | ||
import org.apache.camel.catalog.RuntimeProvider; | ||
|
||
/** | ||
* A Quarkus based {@link RuntimeProvider} which only includes the supported Camel components, data formats, and languages | ||
* which can be installed in Quarkus using the Camel extensions. | ||
*/ | ||
public class QuarkusRuntimeProvider implements RuntimeProvider { | ||
|
||
private static final String COMPONENT_DIR = "org/apache/camel/catalog/quarkus/components"; | ||
private static final String DATAFORMAT_DIR = "org/apache/camel/catalog/quarkus/dataformats"; | ||
private static final String LANGUAGE_DIR = "org/apache/camel/catalog/quarkus/languages"; | ||
private static final String OTHER_DIR = "org/apache/camel/catalog/quarkus/others"; | ||
private static final String COMPONENTS_CATALOG = "org/apache/camel/catalog/quarkus/components.properties"; | ||
private static final String DATA_FORMATS_CATALOG = "org/apache/camel/catalog/quarkus/dataformats.properties"; | ||
private static final String LANGUAGE_CATALOG = "org/apache/camel/catalog/quarkus/languages.properties"; | ||
private static final String OTHER_CATALOG = "org/apache/camel/catalog/quarkus/others.properties"; | ||
|
||
private CamelCatalog camelCatalog; | ||
|
||
@Override | ||
public CamelCatalog getCamelCatalog() { | ||
return camelCatalog; | ||
} | ||
|
||
@Override | ||
public void setCamelCatalog(CamelCatalog camelCatalog) { | ||
this.camelCatalog = camelCatalog; | ||
} | ||
|
||
@Override | ||
public String getProviderName() { | ||
return "quarkus"; | ||
} | ||
|
||
@Override | ||
public String getProviderGroupId() { | ||
return "org.apache.camel.quarkus"; | ||
} | ||
|
||
@Override | ||
public String getProviderArtifactId() { | ||
return "camel-quarkus-catalog"; | ||
} | ||
|
||
@Override | ||
public String getComponentJSonSchemaDirectory() { | ||
return COMPONENT_DIR; | ||
} | ||
|
||
@Override | ||
public String getDataFormatJSonSchemaDirectory() { | ||
return DATAFORMAT_DIR; | ||
} | ||
|
||
@Override | ||
public String getLanguageJSonSchemaDirectory() { | ||
return LANGUAGE_DIR; | ||
} | ||
|
||
@Override | ||
public String getOtherJSonSchemaDirectory() { | ||
return OTHER_DIR; | ||
} | ||
|
||
@Override | ||
public List<String> findComponentNames() { | ||
List<String> names = new ArrayList<>(); | ||
InputStream is = camelCatalog.getVersionManager().getResourceAsStream(COMPONENTS_CATALOG); | ||
if (is != null) { | ||
try { | ||
CatalogHelper.loadLines(is, names); | ||
} catch (IOException e) { | ||
// ignore | ||
} | ||
} | ||
return names; | ||
} | ||
|
||
@Override | ||
public List<String> findDataFormatNames() { | ||
List<String> names = new ArrayList<>(); | ||
InputStream is = camelCatalog.getVersionManager().getResourceAsStream(DATA_FORMATS_CATALOG); | ||
if (is != null) { | ||
try { | ||
CatalogHelper.loadLines(is, names); | ||
} catch (IOException e) { | ||
// ignore | ||
} | ||
} | ||
return names; | ||
} | ||
|
||
@Override | ||
public List<String> findLanguageNames() { | ||
List<String> names = new ArrayList<>(); | ||
InputStream is = camelCatalog.getVersionManager().getResourceAsStream(LANGUAGE_CATALOG); | ||
if (is != null) { | ||
try { | ||
CatalogHelper.loadLines(is, names); | ||
} catch (IOException e) { | ||
// ignore | ||
} | ||
} | ||
return names; | ||
} | ||
|
||
@Override | ||
public List<String> findOtherNames() { | ||
List<String> names = new ArrayList<>(); | ||
InputStream is = camelCatalog.getVersionManager().getResourceAsStream(OTHER_CATALOG); | ||
if (is != null) { | ||
try { | ||
CatalogHelper.loadLines(is, names); | ||
} catch (IOException e) { | ||
// ignore | ||
} | ||
} | ||
return names; | ||
} | ||
|
||
} |
Oops, something went wrong.