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 2019/12/04 04:24:36 UTC
[camel] branch master updated: CAMEL-14215: Rename to
camel-core-osgi-activator. Add docs. (#3381)
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.git
The following commit(s) were added to refs/heads/master by this push:
new ae20689 CAMEL-14215: Rename to camel-core-osgi-activator. Add docs. (#3381)
ae20689 is described below
commit ae2068909149125f306674db358eaf88cc692f2f
Author: Bob Paulin <bo...@bobpaulin.com>
AuthorDate: Tue Dec 3 22:24:22 2019 -0600
CAMEL-14215: Rename to camel-core-osgi-activator. Add docs. (#3381)
---
apache-camel/pom.xml | 8 ++---
apache-camel/src/main/descriptors/common-bin.xml | 2 +-
.../pom.xml | 6 ++--
.../src/assembly/test-bundles.xml | 2 +-
.../src/main/docs/camel-core-osgi-activator.adoc | 37 ++++++++++++++++++++++
.../camel/core/osgi/main/internal/Activator.java | 6 ++--
.../apache/camel/core/osgi/main/it/BundleIT.java | 12 +++----
.../camel/core/osgi/main/it/PaxExamOptions.java | 0
core/pom.xml | 2 +-
parent/pom.xml | 10 +++---
.../karaf/features/src/main/resources/features.xml | 2 +-
11 files changed, 62 insertions(+), 25 deletions(-)
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index 70fd984..cbc51d1 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -85,6 +85,10 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-core-osgi-activator</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-core-xml</artifactId>
</dependency>
<dependency>
@@ -107,10 +111,6 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-main</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main-osgi</artifactId>
- </dependency>
<!-- NOTE: auto-generated list of components when building camel catalog -->
<!-- camel components: START -->
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index eb29501..7817b24 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -36,11 +36,11 @@
<include>org.apache.camel:camel-core</include>
<include>org.apache.camel:camel-core-engine</include>
<include>org.apache.camel:camel-core-osgi</include>
+ <include>org.apache.camel:camel-core-osgi-activator</include>
<include>org.apache.camel:camel-core-xml</include>
<include>org.apache.camel:camel-cloud</include>
<include>org.apache.camel:camel-jaxp</include>
<include>org.apache.camel:camel-main</include>
- <include>org.apache.camel:camel-main-osgi</include>
<!-- NOTE: auto-generated list of components when building camel catalog -->
<!-- camel components: START -->
diff --git a/core/camel-main-osgi/pom.xml b/core/camel-core-osgi-activator/pom.xml
similarity index 97%
rename from core/camel-main-osgi/pom.xml
rename to core/camel-core-osgi-activator/pom.xml
index 52a89da..166905a 100644
--- a/core/camel-main-osgi/pom.xml
+++ b/core/camel-core-osgi-activator/pom.xml
@@ -28,11 +28,11 @@
<version>3.1.0-SNAPSHOT</version>
</parent>
- <artifactId>camel-main-osgi</artifactId>
+ <artifactId>camel-core-osgi-activator</artifactId>
<packaging>jar</packaging>
- <name>Camel :: Main OSGi</name>
- <description>Camel Main OSGi</description>
+ <name>Camel :: Core OSGi Activator</name>
+ <description>Camel Core OSGi Activator</description>
<properties>
<maven.failsafe.version>2.22.1</maven.failsafe.version>
diff --git a/core/camel-main-osgi/src/assembly/test-bundles.xml b/core/camel-core-osgi-activator/src/assembly/test-bundles.xml
similarity index 94%
rename from core/camel-main-osgi/src/assembly/test-bundles.xml
rename to core/camel-core-osgi-activator/src/assembly/test-bundles.xml
index 0350be6..bd6fc39 100644
--- a/core/camel-main-osgi/src/assembly/test-bundles.xml
+++ b/core/camel-core-osgi-activator/src/assembly/test-bundles.xml
@@ -30,7 +30,7 @@
<outputDirectory/>
<outputFileNameMapping>${artifact.artifactId}.jar</outputFileNameMapping>
<includes>
- <include>org.apache.camel:camel-main-osgi</include>
+ <include>org.apache.camel:camel-core-osgi-activator</include>
</includes>
</dependencySet>
</dependencySets>
diff --git a/core/camel-core-osgi-activator/src/main/docs/camel-core-osgi-activator.adoc b/core/camel-core-osgi-activator/src/main/docs/camel-core-osgi-activator.adoc
new file mode 100644
index 0000000..f0614a6
--- /dev/null
+++ b/core/camel-core-osgi-activator/src/main/docs/camel-core-osgi-activator.adoc
@@ -0,0 +1,37 @@
+= camel-core-osgi-activator
+
+A small bundle for starting an OSGi Apache Camel Project. The bundle starts the CamelContext and registering RouteBuilders from any bundle.
+
+Install bundle
+
+Register an Apache Camel RouteBuilder as an OSGi service.
+
+Using annotations
+
+[source,java]
+----
+@Component(service = RouteBuilder.class)
+public class MyRouteBuilder extends RouteBuilder {
+ @Override
+ public void configure() throws Exception {
+ from("timer:test?fixedRate=true&period=1000")
+ .log("Hello");
+ }
+}
+----
+
+Or Manually
+
+[source,java]
+----
+public void start(BundleContext context) throws Exception {
+ context.registerService(RouteBuilder.class, new MyRouteBuilder(), null);
+}
+----
+
+And it's automatically added or removed to the context from any bundle!
+
+[source,text]
+----
+Route: route1 started and consuming from: timer://test?fixedRate=true&period=1000
+----
diff --git a/core/camel-main-osgi/src/main/java/org/apache/camel/core/osgi/main/internal/Activator.java b/core/camel-core-osgi-activator/src/main/java/org/apache/camel/core/osgi/main/internal/Activator.java
similarity index 95%
rename from core/camel-main-osgi/src/main/java/org/apache/camel/core/osgi/main/internal/Activator.java
rename to core/camel-core-osgi-activator/src/main/java/org/apache/camel/core/osgi/main/internal/Activator.java
index 719cbf2..a82a94f 100644
--- a/core/camel-main-osgi/src/main/java/org/apache/camel/core/osgi/main/internal/Activator.java
+++ b/core/camel-core-osgi-activator/src/main/java/org/apache/camel/core/osgi/main/internal/Activator.java
@@ -63,7 +63,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer<Rout
}
this.routeServiceTracker.open();
- LOG.info("Camel Main Osgi RouteBuilder ServiceTracker Tracker Open");
+ LOG.info("Camel Core OSGi Activator RouteBuilder ServiceTracker Tracker Open");
}
@Override
@@ -73,7 +73,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer<Rout
// need to synchronize here since adding routes is not synchronized
synchronized (camelContext) {
this.camelContext.addRoutes(builder);
- LOG.debug("Camel Routes from RouteBuilder Class {} Added to Camel Main", builder.getClass().getName());
+ LOG.debug("Camel Routes from RouteBuilder Class {} Added to Camel Core OSGi Activator Context", builder.getClass().getName());
}
} catch (Exception e) {
LOG.error("Error Adding Camel Route Builder", e);
@@ -103,7 +103,7 @@ public class Activator implements BundleActivator, ServiceTrackerCustomizer<Rout
try {
synchronized (camelContext) {
camelContext.removeRouteDefinitions(routesToBeRemoved);
- LOG.debug("Camel Routes from RouteBuilder Class {} Removed to Camel Main",
+ LOG.debug("Camel Routes from RouteBuilder Class {} Removed from Camel Core OSGi Activator Context",
service.getClass().getName());
}
} catch (Exception e) {
diff --git a/core/camel-main-osgi/src/test/java/org/apache/camel/core/osgi/main/it/BundleIT.java b/core/camel-core-osgi-activator/src/test/java/org/apache/camel/core/osgi/main/it/BundleIT.java
similarity index 90%
rename from core/camel-main-osgi/src/test/java/org/apache/camel/core/osgi/main/it/BundleIT.java
rename to core/camel-core-osgi-activator/src/test/java/org/apache/camel/core/osgi/main/it/BundleIT.java
index 35df365..2cbd6bb 100644
--- a/core/camel-main-osgi/src/test/java/org/apache/camel/core/osgi/main/it/BundleIT.java
+++ b/core/camel-core-osgi-activator/src/test/java/org/apache/camel/core/osgi/main/it/BundleIT.java
@@ -61,7 +61,7 @@ public class BundleIT {
.read(
Files.newInputStream(
Paths.get("target/test-bundles")
- .resolve("camel-main-osgi.jar")))
+ .resolve("camel-core-osgi-activator.jar")))
.build()),
junitBundles());
}
@@ -70,7 +70,7 @@ public class BundleIT {
public void testBundleLoaded() throws Exception {
boolean hasCore = false;
boolean hasOsgi = false;
- boolean hasCamelMainOsgi = false;
+ boolean hasCamelCoreOsgiActivator = false;
for (Bundle b : bc.getBundles()) {
if ("org.apache.camel.camel-core".equals(b.getSymbolicName())) {
hasCore = true;
@@ -81,14 +81,14 @@ public class BundleIT {
assertEquals("Camel Core OSGi not activated", Bundle.ACTIVE, b.getState());
}
- if ("org.apache.camel.camel-main-osgi".equals(b.getSymbolicName())) {
- hasCamelMainOsgi = true;
- assertEquals("Camel Main OSGi not activated", Bundle.ACTIVE, b.getState());
+ if ("org.apache.camel.camel-core-osgi-activator".equals(b.getSymbolicName())) {
+ hasCamelCoreOsgiActivator = true;
+ assertEquals("Camel Core OSGi Activator not activated", Bundle.ACTIVE, b.getState());
}
}
assertTrue("Camel Core bundle not found", hasCore);
assertTrue("Camel Core OSGi bundle not found", hasOsgi);
- assertTrue("Camel Main OSGi bundle not found", hasCamelMainOsgi);
+ assertTrue("Camel Core OSGi Activator bundle not found", hasCamelCoreOsgiActivator);
}
@Test
diff --git a/core/camel-main-osgi/src/test/java/org/apache/camel/core/osgi/main/it/PaxExamOptions.java b/core/camel-core-osgi-activator/src/test/java/org/apache/camel/core/osgi/main/it/PaxExamOptions.java
similarity index 100%
rename from core/camel-main-osgi/src/test/java/org/apache/camel/core/osgi/main/it/PaxExamOptions.java
rename to core/camel-core-osgi-activator/src/test/java/org/apache/camel/core/osgi/main/it/PaxExamOptions.java
diff --git a/core/pom.xml b/core/pom.xml
index 334e535..9c25515 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -47,10 +47,10 @@
<module>camel-core</module>
<module>camel-endpointdsl</module>
<module>camel-core-osgi</module>
+ <module>camel-core-osgi-activator</module>
<module>camel-core-xml</module>
<module>camel-cloud</module>
<module>camel-main</module>
- <module>camel-main-osgi</module>
</modules>
<build>
diff --git a/parent/pom.xml b/parent/pom.xml
index 32e07ce..106416b 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -787,6 +787,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-core-osgi-activator</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-core-xml</artifactId>
<version>${project.version}</version>
</dependency>
@@ -810,11 +815,6 @@
<artifactId>camel-main</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-main-osgi</artifactId>
- <version>${project.version}</version>
- </dependency>
<!-- NOTE: auto-generated list of components when building camel catalog -->
<!-- camel components: START -->
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 13cb2d4..c4eebec 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -58,10 +58,10 @@
<bundle>mvn:org.apache.camel/camel-core-engine/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-core/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-core-osgi/${project.version}</bundle>
+ <bundle>mvn:org.apache.camel/camel-core-osgi-activator/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-cloud/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-jaxp/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-main/${project.version}</bundle>
- <bundle>mvn:org.apache.camel/camel-main-osgi/${project.version}</bundle>
<bundle>mvn:org.apache.camel/camel-caffeine-lrucache/${project.version}</bundle>
<!-- core components -->
<bundle>mvn:org.apache.camel/camel-bean/${project.version}</bundle>