This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-karaf.git

commit 4327aba452d739a5422c15f5091202066b0b946f
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Mon Mar 23 09:28:17 2020 +0100

    Added camel-paxloggin component and more
---
 components/camel-paxlogging/pom.xml                |  75 ++++++++++++++
 .../paxlogging/PaxLoggingComponentConfigurer.java  |  55 ++++++++++
 .../paxlogging/PaxLoggingEndpointConfigurer.java   |  63 ++++++++++++
 .../services/org/apache/camel/component.properties |   7 ++
 .../services/org/apache/camel/component/paxlogging |   2 +
 .../apache/camel/configurer/paxlogging-component   |   2 +
 .../apache/camel/configurer/paxlogging-endpoint    |   2 +
 .../camel/component/paxlogging/paxlogging.json     |  34 +++++++
 .../src/main/docs/paxlogging-component.adoc        | 113 +++++++++++++++++++++
 .../component/paxlogging/PaxLoggingComponent.java  |  59 +++++++++++
 .../component/paxlogging/PaxLoggingConsumer.java   | 104 +++++++++++++++++++
 .../component/paxlogging/PaxLoggingEndpoint.java   |  75 ++++++++++++++
 components/pom.xml                                 | 104 +++++++++++++++++++
 core/pom.xml                                       | 105 +++++++++++++++++++
 pom.xml                                            |  50 ++++++++-
 15 files changed, 848 insertions(+), 2 deletions(-)

diff --git a/components/camel-paxlogging/pom.xml 
b/components/camel-paxlogging/pom.xml
new file mode 100644
index 0000000..6a28700
--- /dev/null
+++ b/components/camel-paxlogging/pom.xml
@@ -0,0 +1,75 @@
+<?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="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>
+        <groupId>org.apache.camel.karaf</groupId>
+        <artifactId>components</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-paxlogging</artifactId>
+    <packaging>jar</packaging>
+    <name>Camel :: Pax Logging</name>
+    <description>Camel OSGi PaxLogging support</description>
+
+    <properties>
+    </properties>
+
+    <dependencies>
+
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-support</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.ops4j.pax.logging</groupId>
+            <artifactId>pax-logging-api</artifactId>
+            <version>${pax-logging-version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.ops4j.pax.logging</groupId>
+            <artifactId>pax-logging-service</artifactId>
+            <version>${pax-logging-version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi.core</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- test dependencies -->
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+</project>
diff --git 
a/components/camel-paxlogging/src/generated/java/org/apache/camel/component/paxlogging/PaxLoggingComponentConfigurer.java
 
b/components/camel-paxlogging/src/generated/java/org/apache/camel/component/paxlogging/PaxLoggingComponentConfigurer.java
new file mode 100644
index 0000000..bb7d7ea
--- /dev/null
+++ 
b/components/camel-paxlogging/src/generated/java/org/apache/camel/component/paxlogging/PaxLoggingComponentConfigurer.java
@@ -0,0 +1,55 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.paxlogging;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class PaxLoggingComponentConfigurer extends PropertyConfigurerSupport 
implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+    @Override
+    public boolean configure(CamelContext camelContext, Object obj, String 
name, Object value, boolean ignoreCase) {
+        PaxLoggingComponent target = (PaxLoggingComponent) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "basicpropertybinding":
+        case "basicPropertyBinding": 
target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); 
return true;
+        case "bridgeerrorhandler":
+        case "bridgeErrorHandler": 
target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); 
return true;
+        case "bundlecontext":
+        case "bundleContext": target.setBundleContext(property(camelContext, 
org.osgi.framework.BundleContext.class, value)); return true;
+        default: return false;
+        }
+    }
+
+    @Override
+    public Map<String, Object> getAllOptions(Object target) {
+        Map<String, Object> answer = new CaseInsensitiveMap();
+        answer.put("basicPropertyBinding", boolean.class);
+        answer.put("bridgeErrorHandler", boolean.class);
+        answer.put("bundleContext", org.osgi.framework.BundleContext.class);
+        return answer;
+    }
+
+    @Override
+    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+        PaxLoggingComponent target = (PaxLoggingComponent) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "basicpropertybinding":
+        case "basicPropertyBinding": return target.isBasicPropertyBinding();
+        case "bridgeerrorhandler":
+        case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+        case "bundlecontext":
+        case "bundleContext": return target.getBundleContext();
+        default: return null;
+        }
+    }
+}
+
diff --git 
a/components/camel-paxlogging/src/generated/java/org/apache/camel/component/paxlogging/PaxLoggingEndpointConfigurer.java
 
b/components/camel-paxlogging/src/generated/java/org/apache/camel/component/paxlogging/PaxLoggingEndpointConfigurer.java
new file mode 100644
index 0000000..39a651c
--- /dev/null
+++ 
b/components/camel-paxlogging/src/generated/java/org/apache/camel/component/paxlogging/PaxLoggingEndpointConfigurer.java
@@ -0,0 +1,63 @@
+/* Generated by camel build tools - do NOT edit this file! */
+package org.apache.camel.component.paxlogging;
+
+import java.util.Map;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.spi.GeneratedPropertyConfigurer;
+import org.apache.camel.spi.PropertyConfigurerGetter;
+import org.apache.camel.util.CaseInsensitiveMap;
+import org.apache.camel.support.component.PropertyConfigurerSupport;
+
+/**
+ * Generated by camel build tools - do NOT edit this file!
+ */
+@SuppressWarnings("unchecked")
+public class PaxLoggingEndpointConfigurer extends PropertyConfigurerSupport 
implements GeneratedPropertyConfigurer, PropertyConfigurerGetter {
+
+    @Override
+    public boolean configure(CamelContext camelContext, Object obj, String 
name, Object value, boolean ignoreCase) {
+        PaxLoggingEndpoint target = (PaxLoggingEndpoint) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "basicpropertybinding":
+        case "basicPropertyBinding": 
target.setBasicPropertyBinding(property(camelContext, boolean.class, value)); 
return true;
+        case "bridgeerrorhandler":
+        case "bridgeErrorHandler": 
target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); 
return true;
+        case "exceptionhandler":
+        case "exceptionHandler": 
target.setExceptionHandler(property(camelContext, 
org.apache.camel.spi.ExceptionHandler.class, value)); return true;
+        case "exchangepattern":
+        case "exchangePattern": 
target.setExchangePattern(property(camelContext, 
org.apache.camel.ExchangePattern.class, value)); return true;
+        case "synchronous": target.setSynchronous(property(camelContext, 
boolean.class, value)); return true;
+        default: return false;
+        }
+    }
+
+    @Override
+    public Map<String, Object> getAllOptions(Object target) {
+        Map<String, Object> answer = new CaseInsensitiveMap();
+        answer.put("basicPropertyBinding", boolean.class);
+        answer.put("bridgeErrorHandler", boolean.class);
+        answer.put("exceptionHandler", 
org.apache.camel.spi.ExceptionHandler.class);
+        answer.put("exchangePattern", org.apache.camel.ExchangePattern.class);
+        answer.put("synchronous", boolean.class);
+        return answer;
+    }
+
+    @Override
+    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
+        PaxLoggingEndpoint target = (PaxLoggingEndpoint) obj;
+        switch (ignoreCase ? name.toLowerCase() : name) {
+        case "basicpropertybinding":
+        case "basicPropertyBinding": return target.isBasicPropertyBinding();
+        case "bridgeerrorhandler":
+        case "bridgeErrorHandler": return target.isBridgeErrorHandler();
+        case "exceptionhandler":
+        case "exceptionHandler": return target.getExceptionHandler();
+        case "exchangepattern":
+        case "exchangePattern": return target.getExchangePattern();
+        case "synchronous": return target.isSynchronous();
+        default: return null;
+        }
+    }
+}
+
diff --git 
a/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/component.properties
 
b/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/component.properties
new file mode 100644
index 0000000..86311c8
--- /dev/null
+++ 
b/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/component.properties
@@ -0,0 +1,7 @@
+# Generated by camel build tools - do NOT edit this file!
+components=paxlogging
+groupId=org.apache.camel
+artifactId=camel-paxlogging
+version=3.2.0-SNAPSHOT
+projectName=Camel :: Pax Logging
+projectDescription=Camel OSGi PaxLogging support
diff --git 
a/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/component/paxlogging
 
b/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/component/paxlogging
new file mode 100644
index 0000000..801af80
--- /dev/null
+++ 
b/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/component/paxlogging
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.paxlogging.PaxLoggingComponent
diff --git 
a/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/configurer/paxlogging-component
 
b/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/configurer/paxlogging-component
new file mode 100644
index 0000000..ee14d36
--- /dev/null
+++ 
b/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/configurer/paxlogging-component
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.paxlogging.PaxLoggingComponentConfigurer
diff --git 
a/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/configurer/paxlogging-endpoint
 
b/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/configurer/paxlogging-endpoint
new file mode 100644
index 0000000..d3c948f
--- /dev/null
+++ 
b/components/camel-paxlogging/src/generated/resources/META-INF/services/org/apache/camel/configurer/paxlogging-endpoint
@@ -0,0 +1,2 @@
+# Generated by camel build tools - do NOT edit this file!
+class=org.apache.camel.component.paxlogging.PaxLoggingEndpointConfigurer
diff --git 
a/components/camel-paxlogging/src/generated/resources/org/apache/camel/component/paxlogging/paxlogging.json
 
b/components/camel-paxlogging/src/generated/resources/org/apache/camel/component/paxlogging/paxlogging.json
new file mode 100644
index 0000000..7f61f17
--- /dev/null
+++ 
b/components/camel-paxlogging/src/generated/resources/org/apache/camel/component/paxlogging/paxlogging.json
@@ -0,0 +1,34 @@
+{
+  "component": {
+    "kind": "component",
+    "scheme": "paxlogging",
+    "extendsScheme": "",
+    "syntax": "paxlogging:appender",
+    "title": "OSGi PAX Logging",
+    "description": "The paxlogging component can be used in an OSGi 
environment to receive PaxLogging events and process them.",
+    "label": "monitoring",
+    "deprecated": false,
+    "async": false,
+    "consumerOnly": true,
+    "producerOnly": false,
+    "lenientProperties": false,
+    "javaType": "org.apache.camel.component.paxlogging.PaxLoggingComponent",
+    "firstVersion": "2.6.0",
+    "groupId": "org.apache.camel",
+    "artifactId": "camel-paxlogging",
+    "version": "3.2.0-SNAPSHOT"
+  },
+  "componentProperties": {
+    "bridgeErrorHandler": { "kind": "property", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by [...]
+    "bundleContext": { "kind": "property", "displayName": "Bundle Context", 
"group": "consumer", "required": false, "type": "object", "javaType": 
"org.osgi.framework.BundleContext", "deprecated": false, "secret": false, 
"description": "The OSGi BundleContext is automatic injected by Camel" },
+    "basicPropertyBinding": { "kind": "property", "displayName": "Basic 
Property Binding", "group": "advanced", "label": "advanced", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Whether the component should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities" }
+  },
+  "properties": {
+    "appender": { "kind": "path", "displayName": "Appender", "group": 
"consumer", "label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "secret": 
false, "description": "Appender is the name of the pax appender that need to be 
configured in the PaxLogging service configuration." },
+    "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled b [...]
+    "exceptionHandler": { "kind": "parameter", "displayName": "Exception 
Handler", "group": "consumer (advanced)", "label": "consumer,advanced", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", 
"deprecated": false, "secret": false, "description": "To let the consumer use a 
custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled 
then this option is not in use. By default the consumer will deal with [...]
+    "exchangePattern": { "kind": "parameter", "displayName": "Exchange 
Pattern", "group": "consumer (advanced)", "label": "consumer,advanced", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut", 
"InOptionalOut" ], "deprecated": false, "secret": false, "description": "Sets 
the exchange pattern when the consumer creates an exchange." },
+    "basicPropertyBinding": { "kind": "parameter", "displayName": "Basic 
Property Binding", "group": "advanced", "label": "advanced", "required": false, 
"type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, 
"defaultValue": false, "description": "Whether the endpoint should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities" },
+    "synchronous": { "kind": "parameter", "displayName": "Synchronous", 
"group": "advanced", "label": "advanced", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": 
"false", "description": "Sets whether synchronous processing should be strictly 
used, or Camel is allowed to use asynchronous processing (if supported)." }
+  }
+}
diff --git 
a/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc 
b/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
new file mode 100644
index 0000000..f6b46e2
--- /dev/null
+++ b/components/camel-paxlogging/src/main/docs/paxlogging-component.adoc
@@ -0,0 +1,113 @@
+[[paxlogging-component]]
+= OSGi PAX Logging Component
+
+*Since Camel 2.6*
+
+// HEADER START
+*Only consumer is supported*
+// HEADER END
+
+The PAX Logging component can be used in an OSGi environment to receive
+http://wiki.ops4j.org/display/paxlogging/Pax+Logging[PaxLogging] events
+and process them.
+
+== Dependencies
+
+Maven users need to add the following dependency to their `pom.xml`
+
+[source,xml]
+-------------------------------------------
+<dependency>
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-paxlogging</artifactId>
+  <version>${camel-version}</version>
+</dependency>
+-------------------------------------------
+
+where `${camel-version`} must be replaced by the actual version of Camel.
+
+== URI format
+
+[source,xml]
+-----------------------------
+paxlogging:appender[?options]
+-----------------------------
+
+where `appender` is the name of the pax appender that need to be
+configured in the PaxLogging service configuration.
+
+== URI options
+
+
+
+// component options: START
+The OSGi PAX Logging component supports 3 options, which are listed below.
+
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
+| *bundleContext* (consumer) | The OSGi BundleContext is automatic injected by 
Camel |  | BundleContext
+| *basicPropertyBinding* (advanced) | Whether the component should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities | false | boolean
+|===
+// component options: END
+
+
+
+
+// endpoint options: START
+The OSGi PAX Logging endpoint is configured using URI syntax:
+
+----
+paxlogging:appender
+----
+
+with the following path and query parameters:
+
+=== Path Parameters (1 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *appender* | *Required* Appender is the name of the pax appender that need 
to be configured in the PaxLogging service configuration. |  | String
+|===
+
+
+=== Query Parameters (5 parameters):
+
+
+[width="100%",cols="2,5,^1,2",options="header"]
+|===
+| Name | Description | Default | Type
+| *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the 
Camel routing Error Handler, which mean any exceptions occurred while the 
consumer is trying to pickup incoming messages, or the likes, will now be 
processed as a message and handled by the routing Error Handler. By default the 
consumer will use the org.apache.camel.spi.ExceptionHandler to deal with 
exceptions, that will be logged at WARN or ERROR level and ignored. | false | 
boolean
+| *exceptionHandler* (consumer) | To let the consumer use a custom 
ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this 
option is not in use. By default the consumer will deal with exceptions, that 
will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
+| *exchangePattern* (consumer) | Sets the exchange pattern when the consumer 
creates an exchange. The value can be one of: InOnly, InOut, InOptionalOut |  | 
ExchangePattern
+| *basicPropertyBinding* (advanced) | Whether the endpoint should use basic 
property binding (Camel 2.x) or the newer property binding with additional 
capabilities | false | boolean
+| *synchronous* (advanced) | Sets whether synchronous processing should be 
strictly used, or Camel is allowed to use asynchronous processing (if 
supported). | false | boolean
+|===
+// endpoint options: END
+
+
+== Message body
+
+The `in` message body will be set to the received PaxLoggingEvent.
+
+== Example usage
+
+[source,xml]
+----------------------------------
+<route>
+    <from uri="paxlogging:camel"/>
+    <to uri="stream:out"/>
+</route>
+----------------------------------
+
+Configuration:
+
+[source,java]
+----------------------------------------------------------
+log4j.rootLogger=INFO, out, osgi:VmLogAppender, osgi:camel
+----------------------------------------------------------
diff --git 
a/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingComponent.java
 
b/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingComponent.java
new file mode 100644
index 0000000..c1428e1
--- /dev/null
+++ 
b/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingComponent.java
@@ -0,0 +1,59 @@
+/*
+ * 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.component.paxlogging;
+
+import java.util.Map;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.spi.annotations.Component;
+import org.apache.camel.support.DefaultComponent;
+import org.apache.camel.util.ObjectHelper;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The OSGi pax-logging component allows receiving log events from OPS4j 
PaxLogging
+ * and send them to Camel routes.
+ */
+@Component("paxlogging")
+public class PaxLoggingComponent extends DefaultComponent {
+
+    private BundleContext bundleContext;
+
+    public BundleContext getBundleContext() {
+        return bundleContext;
+    }
+
+    /**
+     * The OSGi BundleContext is automatic injected by Camel
+     */
+    public void setBundleContext(BundleContext bundleContext) {
+        this.bundleContext = bundleContext;
+    }
+
+    @Override
+    protected Endpoint createEndpoint(String uri, String remaining, 
Map<String, Object> parameters) throws Exception {
+        PaxLoggingEndpoint endpoint = new PaxLoggingEndpoint(uri, this, 
remaining);
+        setProperties(endpoint, parameters);
+        return endpoint;
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+        ObjectHelper.notNull(bundleContext, "BundleContext", this);
+    }
+}
diff --git 
a/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java
 
b/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java
new file mode 100644
index 0000000..72aafa5
--- /dev/null
+++ 
b/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingConsumer.java
@@ -0,0 +1,104 @@
+/*
+ * 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.component.paxlogging;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.support.DefaultConsumer;
+import org.ops4j.pax.logging.spi.PaxAppender;
+import org.ops4j.pax.logging.spi.PaxLoggingEvent;
+import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Paxlogging consumer.
+ * This camel consumer will register a paxlogging appender and will
+ * receive all logging events and send them into the route.
+ * To avoid generating new logging events from sending the message,
+ * an MDC attribute is set in the sending thread, and all log events
+ * from this thread are ignored.
+ * Camel exchanges are actually sent from a specific thread to make
+ * sure the log events are cleanly separated. 
+ */
+public class PaxLoggingConsumer extends DefaultConsumer implements PaxAppender 
{
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(PaxLoggingConsumer.class);
+
+    private final PaxLoggingEndpoint endpoint;
+    private ExecutorService executor;
+    private ServiceRegistration registration;
+
+    public PaxLoggingConsumer(PaxLoggingEndpoint endpoint, Processor 
processor) {
+        super(endpoint, processor);
+        this.endpoint = endpoint;
+    }
+
+    @Override
+    public void doAppend(final PaxLoggingEvent paxLoggingEvent) {
+        // in order to "force" the copy of properties (especially the MDC 
ones) in the local thread
+        paxLoggingEvent.getProperties();
+        sendExchange(paxLoggingEvent);
+    }
+
+    protected void sendExchange(final PaxLoggingEvent paxLoggingEvent) {
+        Exchange exchange = endpoint.createExchange();
+        // TODO: populate exchange headers
+        exchange.getIn().setBody(paxLoggingEvent);
+
+        if (LOG.isTraceEnabled()) {
+            LOG.trace("PaxLogging {} is firing", endpoint.getAppender());
+        }
+        try {
+            getProcessor().process(exchange);
+        } catch (Exception e) {
+            exchange.setException(e);
+        }
+        // log exception if an exception occurred and was not handled
+        if (exchange.getException() != null) {
+            getExceptionHandler().handleException("Error processing exchange", 
exchange, exchange.getException());
+        }
+    }
+
+    @Override
+    protected void doStart() throws Exception {
+        super.doStart();
+
+        // start the executor before the registration
+        executor = 
endpoint.getCamelContext().getExecutorServiceManager().newSingleThreadExecutor(this,
 "PaxLoggingEventTask");
+
+        Dictionary<String, String> props = new Hashtable<>();
+        props.put("org.ops4j.pax.logging.appender.name", 
endpoint.getAppender());
+        registration = 
endpoint.getComponent().getBundleContext().registerService(PaxAppender.class.getName(),
 this, props);
+    }
+
+    @Override
+    protected void doStop() throws Exception {
+        if (registration != null) {
+            registration.unregister();
+        }
+        if (executor != null) {
+            
endpoint.getCamelContext().getExecutorServiceManager().shutdownNow(executor);
+            executor = null;
+        }
+        super.doStop();
+    }
+}
diff --git 
a/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingEndpoint.java
 
b/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingEndpoint.java
new file mode 100644
index 0000000..e731361
--- /dev/null
+++ 
b/components/camel-paxlogging/src/main/java/org/apache/camel/component/paxlogging/PaxLoggingEndpoint.java
@@ -0,0 +1,75 @@
+/*
+ * 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.component.paxlogging;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.spi.Metadata;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriPath;
+import org.apache.camel.support.DefaultEndpoint;
+
+/**
+ * The paxlogging component can be used in an OSGi environment to receive 
PaxLogging events and process them.
+ */
+@UriEndpoint(firstVersion = "2.6.0", scheme = "paxlogging", title = "OSGi PAX 
Logging", syntax = "paxlogging:appender",
+    consumerOnly = true, label = "monitoring")
+public class PaxLoggingEndpoint extends DefaultEndpoint {
+
+    @UriPath @Metadata(required = true)
+    private final String appender;
+
+    public PaxLoggingEndpoint(String uri, PaxLoggingComponent component, 
String appender) {
+        super(uri, component);
+        this.appender = appender;
+    }
+
+    /**
+     * Appender is the name of the pax appender that need to be configured in 
the PaxLogging service configuration.
+     */
+    public String getAppender() {
+        return appender;
+    }
+
+    /**
+     * @deprecated use {@link #getAppender()}
+     */
+    @Deprecated
+    public String getName() {
+        return getAppender();
+    }
+
+    @Override
+    public PaxLoggingComponent getComponent() {
+        return (PaxLoggingComponent) super.getComponent();
+    }
+
+    @Override
+    public Producer createProducer() throws Exception {
+        throw new RuntimeCamelException("Cannot produce to a 
PaxLoggingEndpoint: " + getEndpointUri());
+    }
+
+    @Override
+    public Consumer createConsumer(Processor processor) throws Exception {
+        PaxLoggingConsumer answer = new PaxLoggingConsumer(this, processor);
+        configureConsumer(answer);
+        return answer;
+    }
+
+}
diff --git a/components/pom.xml b/components/pom.xml
new file mode 100644
index 0000000..3ad2047
--- /dev/null
+++ b/components/pom.xml
@@ -0,0 +1,104 @@
+<?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="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>
+        <groupId>org.apache.camel.karaf</groupId>
+        <artifactId>karaf</artifactId>
+        <version>3.2.0-SNAPSHOT</version>
+        <relativePath>..</relativePath>
+    </parent>
+
+    <groupId>org.apache.camel.karaf</groupId>
+    <artifactId>components</artifactId>
+    <name>Camel Karaf :: Components Modules</name>
+    <description>Camel Karaf Components Modules</description>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>camel-paxlogging</module>
+    </modules>
+
+    <properties>
+        
<camel.osgi.manifest>${project.build.outputDirectory}/META-INF/MANIFEST.MF</camel.osgi.manifest>
+
+        <camel-prepare-component>true</camel-prepare-component>
+    </properties>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-bundle-plugin</artifactId>
+                <version>${project.version}</version>
+                <extensions>false</extensions>
+                <configuration>
+                    <supportIncrementalBuild>true</supportIncrementalBuild>
+                    <noWarningProjectTypes>pom</noWarningProjectTypes>
+                    
<excludeDependencies>${camel.osgi.exclude.dependencies}</excludeDependencies>
+                    <instructions>
+                        <Bundle-Name>${project.artifactId}</Bundle-Name>
+                        
<Bundle-SymbolicName>${camel.osgi.symbolic.name}</Bundle-SymbolicName>
+                        
<Bundle-Activator>${camel.osgi.activator}</Bundle-Activator>
+                        <Import-Package>${camel.osgi.import}</Import-Package>
+                        <Export-Package>${camel.osgi.export}</Export-Package>
+                        
<DynamicImport-Package>${camel.osgi.dynamic}</DynamicImport-Package>
+                        
<Private-Package>${camel.osgi.private.pkg}</Private-Package>
+                        
<Require-Capability>${camel.osgi.require.capability}</Require-Capability>
+                        
<Provide-Capability>${camel.osgi.provide.capability}</Provide-Capability>
+                        <Implementation-Title>Apache 
Camel</Implementation-Title>
+                        
<Implementation-Version>${project.version}</Implementation-Version>
+                        
<Karaf-Info>Camel;${project.artifactId}=${project.version}</Karaf-Info>
+                        
<_versionpolicy>${camel.osgi.import.default.version}</_versionpolicy>
+                        <_failok>${camel.osgi.failok}</_failok>
+                        <_removeheaders>Bnd-LastModified</_removeheaders>
+                        <_plugin>
+                            org.apache.felix.bundleplugin.BlueprintPlugin,
+                            aQute.lib.spring.SpringXMLType,
+                            org.apache.felix.bundleplugin.JpaPlugin,
+                            org.apache.camel.maven.bundle.CamelPlugin
+                        </_plugin>
+                    </instructions>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>versions</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>cleanVersions</goal>
+                        </goals>
+                        <configuration>
+                            <versions>
+                                
<camel.osgi.version.clean>${project.version}</camel.osgi.version.clean>
+                            </versions>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>bundle-manifest</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>manifest</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>
diff --git a/core/pom.xml b/core/pom.xml
index fb91603..e2e21a4 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -34,4 +34,109 @@
         <module>camel-core-osgi</module>
     </modules>
 
+    <properties>
+        
<camel.osgi.manifest>${project.build.outputDirectory}/META-INF/MANIFEST.MF</camel.osgi.manifest>
+    </properties>
+
+    <build>
+        <plugins>
+            <!--<plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-package-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>generate</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <phase>process-classes</phase>
+                    </execution>
+                </executions>
+            </plugin>-->
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>recompile</id>
+                        <goals>
+                            <goal>compile</goal>
+                        </goals>
+                        <phase>process-classes</phase>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                            <goal>add-resource</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>src/generated/java</source>
+                            </sources>
+                            <resources>
+                                <resource>
+                                    
<directory>src/generated/resources</directory>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-bundle-plugin</artifactId>
+                <version>${project.version}</version>
+                <configuration>
+                    <supportIncrementalBuild>true</supportIncrementalBuild>
+                    <noWarningProjectTypes>pom</noWarningProjectTypes>
+                    
<excludeDependencies>${camel.osgi.exclude.dependencies}</excludeDependencies>
+                    <instructions>
+                        <Bundle-Name>${project.artifactId}</Bundle-Name>
+                        
<Bundle-SymbolicName>${camel.osgi.symbolic.name}</Bundle-SymbolicName>
+                        
<Bundle-Activator>${camel.osgi.activator}</Bundle-Activator>
+                        <Import-Package>${camel.osgi.import}</Import-Package>
+                        <Export-Package>${camel.osgi.export}</Export-Package>
+                        
<DynamicImport-Package>${camel.osgi.dynamic}</DynamicImport-Package>
+                        
<Private-Package>${camel.osgi.private.pkg}</Private-Package>
+                        
<Require-Capability>${camel.osgi.require.capability}</Require-Capability>
+                        
<Provide-Capability>${camel.osgi.provide.capability}</Provide-Capability>
+                        <Implementation-Title>Apache 
Camel</Implementation-Title>
+                        
<Implementation-Version>${project.version}</Implementation-Version>
+                        
<Karaf-Info>Camel;${project.artifactId}=${project.version}</Karaf-Info>
+                        
<_versionpolicy>${camel.osgi.import.default.version}</_versionpolicy>
+                        <_failok>${camel.osgi.failok}</_failok>
+                        <_removeheaders>Bnd-LastModified</_removeheaders>
+                    </instructions>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>versions</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>cleanVersions</goal>
+                        </goals>
+                        <configuration>
+                            <versions>
+                                
<camel.osgi.version.clean>${project.version}</camel.osgi.version.clean>
+                            </versions>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>bundle-manifest</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>manifest</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>
diff --git a/pom.xml b/pom.xml
index 61931ab..0c47c81 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,8 +74,8 @@
     <modules>
         <!--<module>tooling</module>-->
         <module>core</module>
-        <!--<module>components-starter</module>
-        <module>catalog</module>
+        <module>components</module>
+        <!--<module>catalog</module>
         <module>tests</module>
         <module>examples</module>
         <module>docs</module>-->
@@ -150,6 +150,7 @@
         <kafka-avro-serializer-version>5.2.2</kafka-avro-serializer-version>
         <log4j2-version>2.13.1</log4j2-version>
         <lucene3-version>3.6.0</lucene3-version>
+        <maven-jar-plugin-version>3.2.0</maven-jar-plugin-version>
         
<maven-checkstyle-plugin-version>3.1.0</maven-checkstyle-plugin-version>
         <maven-checkstyle-version>8.26</maven-checkstyle-version>
         <maven-compiler-plugin-version>3.8.1</maven-compiler-plugin-version>
@@ -161,6 +162,7 @@
         <openjpa-version>3.1.1</openjpa-version>
         <opentracing-version>0.33.0</opentracing-version>
         <os-maven-plugin-version>1.6.0</os-maven-plugin-version>
+        <pax-logging-version>1.11.2</pax-logging-version>
         <protobuf-maven-plugin-version>0.6.1</protobuf-maven-plugin-version>
         <protobuf-version>3.11.1</protobuf-version>
         <reactor-version>3.2.15.RELEASE</reactor-version>
@@ -177,6 +179,40 @@
         <tomcat-version>9.0.31</tomcat-version>
         <undertow-version>2.0.30.Final</undertow-version>
         <weld3-version>3.0.5.RELEASE</weld3-version>
+
+        <!-- OSGi bundles properties -->
+        <camel.osgi.import.camel.version>
+            
version="[$(version;==;${camel.osgi.version.clean}),$(version;=+;${camel.osgi.version.clean}))"
+        </camel.osgi.import.camel.version>
+        <camel.osgi.import.strict.version>
+            
version="[$(version;===;${camel.osgi.version.clean}),$(version;==+;${camel.osgi.version.clean}))"
+        </camel.osgi.import.strict.version>
+        
<camel.osgi.import.default.version>[$(version;==;$(@)),$(version;+;$(@)))</camel.osgi.import.default.version>
+        <camel.osgi.import.defaults>
+        </camel.osgi.import.defaults>
+        <camel.osgi.import.before.defaults />
+        <camel.osgi.import.additional />
+        <camel.osgi.import.pkg>
+            org.apache.camel.*;${camel.osgi.import.camel.version},
+            ${camel.osgi.import.before.defaults},
+            ${camel.osgi.import.defaults},
+            ${camel.osgi.import.additional},
+            *
+        </camel.osgi.import.pkg>
+        <camel.osgi.activator />
+        <camel.osgi.failok>false</camel.osgi.failok>
+        <camel.osgi.private.pkg>!*</camel.osgi.private.pkg>
+        
<camel.osgi.export.pkg>$${replace;{local-packages};;;\;}</camel.osgi.export.pkg>
+        
<camel.osgi.export>${camel.osgi.export.pkg};-noimport:=true;${camel.osgi.version}</camel.osgi.export>
+        <camel.osgi.version>version=${project.version}</camel.osgi.version>
+        <camel.osgi.import>${camel.osgi.import.pkg}</camel.osgi.import>
+        <camel.osgi.dynamic />
+        
<camel.osgi.symbolic.name>${project.groupId}.${project.artifactId}</camel.osgi.symbolic.name>
+        
<camel.osgi.exclude.dependencies>false</camel.osgi.exclude.dependencies>
+        <camel.osgi.require.capability />
+        <camel.osgi.provide.capability />
+
+        
<camel.osgi.manifest>${project.build.outputDirectory}/META-INF/MANIFEST.MF</camel.osgi.manifest>
     </properties>
 
 
@@ -254,6 +290,16 @@
                     <encoding>UTF-8</encoding>
                 </configuration>
             </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>${maven-jar-plugin-version}</version>
+                    <configuration>
+                        <archive>
+                            <manifestFile>${camel.osgi.manifest}</manifestFile>
+                        </archive>
+                    </configuration>
+                </plugin>
         </plugins>
 
         <pluginManagement>

Reply via email to