Skip to content

Commit

Permalink
RSS native support
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed Sep 25, 2020
1 parent 70567a3 commit c54879e
Show file tree
Hide file tree
Showing 25 changed files with 384 additions and 250 deletions.
8 changes: 4 additions & 4 deletions docs/modules/ROOT/pages/reference/extensions/rss.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
= RSS
:cq-artifact-id: camel-quarkus-rss
:cq-native-supported: false
:cq-status: Preview
:cq-native-supported: true
:cq-status: Stable
:cq-description: Poll RSS feeds.
:cq-deprecated: false
:cq-jvm-since: 1.1.0
:cq-native-since: n/a
:cq-native-since: 1.2.0

[.badges]
[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native##[.badge-unsupported]##unsupported##
[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native since##[.badge-supported]##1.2.0##

Poll RSS feeds.

Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/partials/reference/components/rss.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
:cq-artifact-id: camel-quarkus-rss
:cq-artifact-id-base: rss
:cq-native-supported: false
:cq-status: Preview
:cq-native-supported: true
:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.1.0
:cq-native-since: n/a
:cq-native-since: 1.2.0
:cq-camel-part-name: rss
:cq-camel-part-title: RSS
:cq-camel-part-description: Poll RSS feeds.
Expand Down
6 changes: 3 additions & 3 deletions docs/modules/ROOT/partials/reference/dataformats/rss.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
:cq-artifact-id: camel-quarkus-rss
:cq-artifact-id-base: rss
:cq-native-supported: false
:cq-status: Preview
:cq-native-supported: true
:cq-status: Stable
:cq-deprecated: false
:cq-jvm-since: 1.1.0
:cq-native-since: n/a
:cq-native-since: 1.2.0
:cq-camel-part-name: rss
:cq-camel-part-title: RSS
:cq-camel-part-description: Transform from ROME SyndFeed Java Objects to XML and vice-versa.
Expand Down
1 change: 0 additions & 1 deletion extensions-jvm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
<module>pulsar</module>
<module>quickfix</module>
<module>robotframework</module>
<module>rss</module>
<module>saga</module>
<module>saxon</module>
<module>schematron</module>
Expand Down

This file was deleted.

100 changes: 0 additions & 100 deletions extensions-jvm/rss/integration-test/pom.xml

This file was deleted.

This file was deleted.

1 change: 1 addition & 0 deletions extensions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
<module>ref</module>
<module>rest</module>
<module>rest-openapi</module>
<module>rss</module>
<module>salesforce</module>
<module>sap-netweaver</module>
<module>scheduler</module>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-atom-deployment</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-rss</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* 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.quarkus.component.rss.deployment;

import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

class RssProcessor {

private static final String FEATURE = "camel-rss";

@BuildStep
FeatureBuildItem feature() {
return new FeatureBuildItem(FEATURE);
}

@BuildStep
NativeImageResourceBuildItem nativeImageResources() {
return new NativeImageResourceBuildItem("com/rometools/rome/rome.properties");
}

@BuildStep
IndexDependencyBuildItem indexDependencies() {
return new IndexDependencyBuildItem("com.rometools", "rome");
}

@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
// Register for reflection feed parser / generator classes from rome.properties
try {
InputStream stream = Thread.currentThread().getContextClassLoader()
.getResourceAsStream("com/rometools/rome/rome.properties");
Properties properties = new Properties();
properties.load(stream);

List<String> parserGenerators = new ArrayList<>();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
for (String className : entry.getValue().toString().split(" ")) {
parserGenerators.add(className);
}
}

reflectiveClass.produce(
new ReflectiveClassBuildItem(false, false, parserGenerators.toArray(new String[parserGenerators.size()])));
} catch (IOException e) {
throw new RuntimeException(e);
}

// Rome does some reflective work on classes that can be cloned
String[] clonableClasses = new String[] {
"com.rometools.rome.feed.module.DCModuleImpl",
"com.rometools.rome.feed.module.SyModuleImpl",
"com.rometools.rome.feed.module.ModuleImpl",
"java.util.Date",
};
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, clonableClasses));
}
}
1 change: 0 additions & 1 deletion extensions-jvm/rss/pom.xml → extensions/rss/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@
<modules>
<module>deployment</module>
<module>runtime</module>
<module>integration-test</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

<properties>
<camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
<camel.quarkus.nativeSince>1.2.0</camel.quarkus.nativeSince>
</properties>

<dependencyManagement>
Expand All @@ -53,6 +54,10 @@
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-atom</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-rss</artifactId>
Expand Down

0 comments on commit c54879e

Please sign in to comment.