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 2021/06/14 07:40:23 UTC

[camel] branch main updated (a80dd50 -> a40c145)

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

davsclaus pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from a80dd50  Sync deps
     new c9ae6aa  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
     new 086788d  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
     new bc25f8d  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
     new baa144c  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
     new c1d0b35  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
     new c526ecb  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
     new a40c145  CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 components/camel-cmis/pom.xml                      |  12 --
 .../camel/component/cmis/osgi/Activator.java       |  45 -----
 components/camel-corda/pom.xml                     |   9 -
 components/camel-hdfs/pom.xml                      |  12 --
 .../camel/component/hdfs/osgi/HdfsActivator.java   |  52 ------
 components/camel-jcache/pom.xml                    |   9 -
 ...vider.java => DefaultJCacheManagerFactory.java} |   9 +-
 .../camel/component/jcache/JCacheEndpoint.java     |   2 +-
 .../camel/component/jcache/JCacheHelper.java       |  38 +----
 ...acheProvider.java => JCacheManagerFactory.java} |   5 +-
 .../component/jcache/osgi/OSGiCacheManager.java    | 113 -------------
 .../aggregate/JCacheAggregationRepository.java     |  22 ++-
 .../idempotent/JCacheIdempotentRepository.java     |  22 ++-
 .../JCacheAggregationRepositoryTestSupport.java    |   1 +
 .../idempotent/JCacheIdempotentRepositoryTest.java |   5 +-
 components/camel-zookeeper-master/pom.xml          |  16 --
 .../zookeepermaster/ZookeeperGroupSupport.java     |  15 +-
 .../group/DefaultGroupFactoryStrategy.java         |  19 +--
 .../zookeepermaster/group/ManagedGroupFactory.java |   4 +
 .../internal/osgi/OsgiManagedGroupFactory.java     | 184 ---------------------
 .../internal/osgi/TrackingZooKeeperGroup.java      |  66 --------
 21 files changed, 75 insertions(+), 585 deletions(-)
 delete mode 100644 components/camel-cmis/src/main/java/org/apache/camel/component/cmis/osgi/Activator.java
 delete mode 100644 components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/osgi/HdfsActivator.java
 copy components/camel-jcache/src/main/java/org/apache/camel/component/jcache/{JCacheProvider.java => DefaultJCacheManagerFactory.java} (78%)
 copy components/camel-jcache/src/main/java/org/apache/camel/component/jcache/{JCacheProvider.java => JCacheManagerFactory.java} (87%)
 delete mode 100644 components/camel-jcache/src/main/java/org/apache/camel/component/jcache/osgi/OSGiCacheManager.java
 delete mode 100644 components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/osgi/OsgiManagedGroupFactory.java
 delete mode 100644 components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/osgi/TrackingZooKeeperGroup.java

[camel] 07/07: CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a40c1456fa2c360bee0512c9d5647a8be2c701c2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 09:36:19 2021 +0200

    CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
---
 .../component/zookeepermaster/ZookeeperGroupSupport.java     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
index ec1f73e..14215bb 100644
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
+++ b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
@@ -175,10 +175,16 @@ public class ZookeeperGroupSupport extends ServiceSupport
             }
         }
         if (managedGroupFactory == null) {
-            if (managedGroupFactoryStrategy == null) {
-                managedGroupFactoryStrategy = new DefaultGroupFactoryStrategy();
+            Set<ManagedGroupFactoryStrategy> set
+                    = getCamelContext().getRegistry().findByType(ManagedGroupFactoryStrategy.class);
+            if (set.size() == 1) {
+                setManagedGroupFactoryStrategy(set.iterator().next());
+            } else {
+                setManagedGroupFactoryStrategy(new DefaultGroupFactoryStrategy());
             }
-            setManagedGroupFactory(managedGroupFactoryStrategy.createGroupFactory(curator, getClass().getClassLoader(),
+        }
+        if (managedGroupFactory == null) {
+            setManagedGroupFactory(getManagedGroupFactoryStrategy().createGroupFactory(curator, getClass().getClassLoader(),
                     getCamelContext(), this));
         }
     }

[camel] 04/07: CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit baa144cff4478a9e1e14a3e78421e708789ac4fe
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 07:30:49 2021 +0200

    CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
---
 components/camel-jcache/pom.xml                    |   9 --
 .../jcache/DefaultJCacheManagerFactory.java}       |  19 ++--
 .../camel/component/jcache/JCacheEndpoint.java     |   2 +-
 .../camel/component/jcache/JCacheHelper.java       |  38 ++-----
 .../component/jcache/JCacheManagerFactory.java}    |  17 +---
 .../component/jcache/osgi/OSGiCacheManager.java    | 113 ---------------------
 .../aggregate/JCacheAggregationRepository.java     |  22 +++-
 .../idempotent/JCacheIdempotentRepository.java     |  22 +++-
 .../JCacheAggregationRepositoryTestSupport.java    |   1 +
 .../idempotent/JCacheIdempotentRepositoryTest.java |   5 +-
 10 files changed, 58 insertions(+), 190 deletions(-)

diff --git a/components/camel-jcache/pom.xml b/components/camel-jcache/pom.xml
index 122a517..7a9ecc5 100644
--- a/components/camel-jcache/pom.xml
+++ b/components/camel-jcache/pom.xml
@@ -47,15 +47,6 @@
             <version>${jcache-bundle-version}</version>
         </dependency>
 
-        <!-- osgi -->
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
-            <version>6.0.0</version>
-        </dependency>
-
         <!-- testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
diff --git a/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/DefaultJCacheManagerFactory.java
similarity index 54%
copy from components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java
copy to components/camel-jcache/src/main/java/org/apache/camel/component/jcache/DefaultJCacheManagerFactory.java
index fa655ca..2f3fbb2 100644
--- a/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java
+++ b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/DefaultJCacheManagerFactory.java
@@ -14,20 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.jcache.processor.aggregate;
+package org.apache.camel.component.jcache;
 
-import org.apache.camel.component.jcache.JCacheConfiguration;
-import org.apache.camel.component.jcache.support.HazelcastTest;
-import org.apache.camel.test.junit5.CamelTestSupport;
+public class DefaultJCacheManagerFactory implements JCacheManagerFactory {
 
-@HazelcastTest
-class JCacheAggregationRepositoryTestSupport extends CamelTestSupport {
-
-    protected JCacheAggregationRepository createRepository(boolean optimistic) throws Exception {
-        JCacheAggregationRepository repository = new JCacheAggregationRepository();
-        repository.setConfiguration(new JCacheConfiguration("aggregation-repository"));
-        repository.setOptimistic(optimistic);
-
-        return repository;
+    @Override
+    public <K, V> JCacheManager<K, V> createManager(JCacheConfiguration configuration) {
+        return new JCacheManager<>(configuration);
     }
+
 }
diff --git a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheEndpoint.java b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheEndpoint.java
index a520c8a..034818d 100644
--- a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheEndpoint.java
+++ b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheEndpoint.java
@@ -66,7 +66,7 @@ public class JCacheEndpoint extends DefaultEndpoint {
 
     @Override
     protected void doStart() throws Exception {
-        cacheManager = JCacheHelper.createManager(configuration);
+        cacheManager = JCacheHelper.createManager(getCamelContext(), configuration);
     }
 
     @Override
diff --git a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheHelper.java b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheHelper.java
index 55a27f8..327faa9 100644
--- a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheHelper.java
+++ b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheHelper.java
@@ -16,29 +16,22 @@
  */
 package org.apache.camel.component.jcache;
 
-import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.lang.reflect.Proxy;
 
-import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.CamelContext;
+import org.apache.camel.support.CamelContextHelper;
 
 public final class JCacheHelper {
     private JCacheHelper() {
     }
 
-    public static <K, V> JCacheManager<K, V> createManager(JCacheConfiguration configuration) {
-        if (isOSGi()) {
-            try {
-                Class<?> type = Class.forName("org.apache.camel.component.jcache.osgi.OSGiCacheManager");
-                Constructor<?> ctor = type.getConstructor(JCacheConfiguration.class);
-
-                return (JCacheManager<K, V>) ctor.newInstance(configuration);
-            } catch (Exception e) {
-                throw new RuntimeCamelException(e);
-            }
+    public static <K, V> JCacheManager<K, V> createManager(CamelContext camelContext, JCacheConfiguration configuration) {
+        JCacheManagerFactory factory = CamelContextHelper.findByType(camelContext, JCacheManagerFactory.class);
+        if (factory == null) {
+            factory = new DefaultJCacheManagerFactory();
         }
-
-        return new JCacheManager<>(configuration);
+        return factory.createManager(configuration);
     }
 
     @SuppressWarnings("unchecked")
@@ -59,21 +52,4 @@ public final class JCacheHelper {
                 });
     }
 
-    public static boolean isOSGi() {
-        try {
-            // Check if we are in an osgi container
-            Class<?> fu = Class.forName("org.osgi.framework.FrameworkUtil");
-            if (fu != null) {
-                Method method = fu.getMethod("getBundle", Class.class);
-                if (method != null) {
-                    return method.invoke(null, JCacheHelper.class) != null;
-                }
-            }
-        } catch (ClassNotFoundException e) {
-        } catch (Exception e) {
-            throw new RuntimeCamelException(e);
-        }
-
-        return false;
-    }
 }
diff --git a/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheManagerFactory.java
similarity index 54%
copy from components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java
copy to components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheManagerFactory.java
index fa655ca..2e7cd40 100644
--- a/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java
+++ b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/JCacheManagerFactory.java
@@ -14,20 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.component.jcache.processor.aggregate;
+package org.apache.camel.component.jcache;
 
-import org.apache.camel.component.jcache.JCacheConfiguration;
-import org.apache.camel.component.jcache.support.HazelcastTest;
-import org.apache.camel.test.junit5.CamelTestSupport;
+public interface JCacheManagerFactory {
 
-@HazelcastTest
-class JCacheAggregationRepositoryTestSupport extends CamelTestSupport {
-
-    protected JCacheAggregationRepository createRepository(boolean optimistic) throws Exception {
-        JCacheAggregationRepository repository = new JCacheAggregationRepository();
-        repository.setConfiguration(new JCacheConfiguration("aggregation-repository"));
-        repository.setOptimistic(optimistic);
-
-        return repository;
-    }
+    <K, V> JCacheManager<K, V> createManager(JCacheConfiguration configuration);
 }
diff --git a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/osgi/OSGiCacheManager.java b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/osgi/OSGiCacheManager.java
deleted file mode 100644
index b08c5be..0000000
--- a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/osgi/OSGiCacheManager.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.jcache.osgi;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Enumeration;
-
-import javax.cache.Cache;
-
-import org.apache.camel.component.jcache.JCacheConfiguration;
-import org.apache.camel.component.jcache.JCacheHelper;
-import org.apache.camel.component.jcache.JCacheManager;
-import org.apache.camel.component.jcache.JCacheProvider;
-import org.apache.camel.component.jcache.JCacheProviders;
-import org.apache.camel.util.ObjectHelper;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.wiring.BundleWiring;
-
-public final class OSGiCacheManager<K, V> extends JCacheManager {
-    public OSGiCacheManager(JCacheConfiguration configuration) {
-        super(configuration);
-    }
-
-    @Override
-    public synchronized Cache<K, V> doGetCache(JCacheProvider provider) throws Exception {
-        final ClassLoader jcl = getClassLoader(provider.className());
-        final ClassLoader tccl = Thread.currentThread().getContextClassLoader();
-
-        try {
-            if (jcl != null) {
-                Thread.currentThread().setContextClassLoader(jcl);
-            }
-
-            Cache<K, V> cache = super.doGetCache(provider);
-            if (provider == JCacheProviders.hazelcast && jcl != null) {
-                cache = JCacheHelper.tcclProxy(cache, Cache.class, jcl);
-            }
-
-            return cache;
-        } finally {
-            Thread.currentThread().setContextClassLoader(tccl);
-        }
-    }
-
-    private ClassLoader getClassLoader(String providerName) throws Exception {
-        if (providerName == null || !getConfiguration().isLookupProviders()) {
-            return null;
-        }
-
-        final BundleContext bc = FrameworkUtil.getBundle(JCacheHelper.class).getBundleContext();
-        final ClassLoader bcl = bc.getBundle().adapt(BundleWiring.class).getClassLoader();
-        final ClassLoader acl = getConfiguration().getApplicationContextClassLoader();
-
-        for (final Bundle bundle : bc.getBundles()) {
-            URL spi = bundle.getResource("META-INF/services/javax.cache.spi.CachingProvider");
-            if (spi != null) {
-                try (BufferedReader in = new BufferedReader(new InputStreamReader(spi.openStream()))) {
-                    if (ObjectHelper.equal(providerName, in.readLine())) {
-                        return new ClassLoader(bcl) {
-                            @Override
-                            protected Class<?> findClass(String name) throws ClassNotFoundException {
-                                try {
-                                    return acl.loadClass(name);
-                                } catch (ClassNotFoundException e) {
-                                    return bundle.loadClass(name);
-                                }
-                            }
-
-                            @Override
-                            protected URL findResource(String name) {
-                                URL resource = acl.getResource(name);
-                                if (resource == null) {
-                                    resource = bundle.getResource(name);
-                                }
-                                return resource;
-                            }
-
-                            @Override
-                            protected Enumeration findResources(String name) throws IOException {
-                                try {
-                                    return acl.getResources(name);
-                                } catch (IOException e) {
-                                    return bundle.getResources(name);
-                                }
-                            }
-                        };
-                    }
-                }
-            }
-        }
-
-        return null;
-    }
-}
diff --git a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepository.java b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepository.java
index b8ef868..4bb33b1 100644
--- a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepository.java
+++ b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepository.java
@@ -24,6 +24,7 @@ import java.util.Set;
 import javax.cache.Cache;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.Exchange;
 import org.apache.camel.component.jcache.JCacheConfiguration;
 import org.apache.camel.component.jcache.JCacheHelper;
@@ -36,10 +37,12 @@ import org.apache.camel.util.ObjectHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class JCacheAggregationRepository extends ServiceSupport implements OptimisticLockingAggregationRepository {
+public class JCacheAggregationRepository extends ServiceSupport
+        implements CamelContextAware, OptimisticLockingAggregationRepository {
 
     private static final Logger LOG = LoggerFactory.getLogger(JCacheAggregationRepository.class);
 
+    private CamelContext camelContext;
     private JCacheConfiguration configuration;
     private Cache<String, DefaultExchangeHolder> cache;
     private boolean optimistic;
@@ -50,6 +53,16 @@ public class JCacheAggregationRepository extends ServiceSupport implements Optim
         this.configuration = new JCacheConfiguration();
     }
 
+    @Override
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    @Override
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
     public JCacheConfiguration getConfiguration() {
         return configuration;
     }
@@ -176,12 +189,13 @@ public class JCacheAggregationRepository extends ServiceSupport implements Optim
 
     @Override
     protected void doStart() throws Exception {
+        ObjectHelper.notNull(camelContext, "camelContext");
+        ObjectHelper.notNull(configuration, "configuration");
+
         if (cache != null) {
             cacheManager = new JCacheManager<>(cache);
         } else {
-            cacheManager = JCacheHelper.createManager(
-                    ObjectHelper.notNull(configuration, "configuration"));
-
+            cacheManager = JCacheHelper.createManager(getCamelContext(), configuration);
             cache = cacheManager.getCache();
         }
     }
diff --git a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/processor/idempotent/JCacheIdempotentRepository.java b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/processor/idempotent/JCacheIdempotentRepository.java
index 4fdd87d..8e9c8d5 100644
--- a/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/processor/idempotent/JCacheIdempotentRepository.java
+++ b/components/camel-jcache/src/main/java/org/apache/camel/component/jcache/processor/idempotent/JCacheIdempotentRepository.java
@@ -18,6 +18,8 @@ package org.apache.camel.component.jcache.processor.idempotent;
 
 import javax.cache.Cache;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.CamelContextAware;
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedOperation;
 import org.apache.camel.api.management.ManagedResource;
@@ -29,7 +31,8 @@ import org.apache.camel.support.service.ServiceSupport;
 import org.apache.camel.util.ObjectHelper;
 
 @ManagedResource(description = "JCache based message id repository")
-public class JCacheIdempotentRepository extends ServiceSupport implements IdempotentRepository {
+public class JCacheIdempotentRepository extends ServiceSupport implements CamelContextAware, IdempotentRepository {
+    private CamelContext camelContext;
     private JCacheConfiguration configuration;
     private Cache<String, Boolean> cache;
     private JCacheManager<String, Boolean> cacheManager;
@@ -38,6 +41,16 @@ public class JCacheIdempotentRepository extends ServiceSupport implements Idempo
         this.configuration = new JCacheConfiguration();
     }
 
+    @Override
+    public CamelContext getCamelContext() {
+        return camelContext;
+    }
+
+    @Override
+    public void setCamelContext(CamelContext camelContext) {
+        this.camelContext = camelContext;
+    }
+
     public JCacheConfiguration getConfiguration() {
         return configuration;
     }
@@ -94,12 +107,13 @@ public class JCacheIdempotentRepository extends ServiceSupport implements Idempo
 
     @Override
     protected void doStart() throws Exception {
+        ObjectHelper.notNull(camelContext, "camelContext");
+        ObjectHelper.notNull(configuration, "configuration");
+
         if (cache != null) {
             cacheManager = new JCacheManager<>(cache);
         } else {
-            cacheManager = JCacheHelper.createManager(
-                    ObjectHelper.notNull(configuration, "configuration"));
-
+            cacheManager = JCacheHelper.createManager(getCamelContext(), configuration);
             cache = cacheManager.getCache();
         }
     }
diff --git a/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java b/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java
index fa655ca..bdf415d 100644
--- a/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java
+++ b/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/aggregate/JCacheAggregationRepositoryTestSupport.java
@@ -25,6 +25,7 @@ class JCacheAggregationRepositoryTestSupport extends CamelTestSupport {
 
     protected JCacheAggregationRepository createRepository(boolean optimistic) throws Exception {
         JCacheAggregationRepository repository = new JCacheAggregationRepository();
+        repository.setCamelContext(context);
         repository.setConfiguration(new JCacheConfiguration("aggregation-repository"));
         repository.setOptimistic(optimistic);
 
diff --git a/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/idempotent/JCacheIdempotentRepositoryTest.java b/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/idempotent/JCacheIdempotentRepositoryTest.java
index dd7b42b..1ca2f70 100644
--- a/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/idempotent/JCacheIdempotentRepositoryTest.java
+++ b/components/camel-jcache/src/test/java/org/apache/camel/component/jcache/processor/idempotent/JCacheIdempotentRepositoryTest.java
@@ -43,10 +43,12 @@ public class JCacheIdempotentRepositoryTest extends CamelTestSupport {
     @Override
     @BeforeEach
     public void setUp() throws Exception {
-        cacheManager = JCacheHelper.createManager(new JCacheConfiguration("idempotent-repository"));
+        super.setUp();
+        cacheManager = JCacheHelper.createManager(context, new JCacheConfiguration("idempotent-repository"));
         cache = cacheManager.getCache();
 
         repository = new JCacheIdempotentRepository();
+        repository.setCamelContext(context);
         repository.setCache(cache);
         repository.start();
     }
@@ -54,6 +56,7 @@ public class JCacheIdempotentRepositoryTest extends CamelTestSupport {
     @Override
     @AfterEach
     public void tearDown() throws Exception {
+        super.tearDown();
         repository.stop();
         cacheManager.close();
     }

[camel] 06/07: CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c526ecb3289a98bac2c58875169ba7cc599ade53
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 09:24:06 2021 +0200

    CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
---
 .../zookeepermaster/group/GroupHelper.java         | 38 ----------------------
 1 file changed, 38 deletions(-)

diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/GroupHelper.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/GroupHelper.java
deleted file mode 100644
index b1120d5..0000000
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/GroupHelper.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.zookeepermaster.group;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.support.CamelContextHelper;
-import org.apache.curator.framework.CuratorFramework;
-
-public final class GroupHelper {
-
-    private GroupHelper() {
-    }
-
-    public static ManagedGroupFactory createManagedGroupFactory(
-            CamelContext camelContext, ClassLoader loader, CuratorFramework curator) {
-        ManagedGroupFactory factory = CamelContextHelper.findByType(camelContext, ManagedGroupFactory.class);
-        if (factory == null) {
-            factory = new DefaultManagedGroupFactory(curator, true);
-        }
-        factory.setClassLoader(loader);
-        return factory;
-    }
-
-}

[camel] 01/07: CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c9ae6aa273bfed357bbf37184cedce3e8f3f3a60
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 07:03:22 2021 +0200

    CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
---
 components/camel-cmis/pom.xml                      | 12 ------
 .../camel/component/cmis/osgi/Activator.java       | 45 ----------------------
 2 files changed, 57 deletions(-)

diff --git a/components/camel-cmis/pom.xml b/components/camel-cmis/pom.xml
index d6c9256..7bd1d57 100644
--- a/components/camel-cmis/pom.xml
+++ b/components/camel-cmis/pom.xml
@@ -32,9 +32,6 @@
     <description>Camel CMIS which is based on Apache Chemistry support</description>
 
     <properties>
-        <camel.osgi.activator>
-            org.apache.camel.component.cmis.osgi.Activator
-        </camel.osgi.activator>
         <camel.osgi.import>
             !org.apache.chemistry.opencmis.client.runtime,*
         </camel.osgi.import>
@@ -52,15 +49,6 @@
             <version>${cmis-version}</version>
         </dependency>
 
-        <!-- osgi support -->
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
-            <version>6.0.0</version>
-        </dependency>
-
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>
diff --git a/components/camel-cmis/src/main/java/org/apache/camel/component/cmis/osgi/Activator.java b/components/camel-cmis/src/main/java/org/apache/camel/component/cmis/osgi/Activator.java
deleted file mode 100644
index cc19215..0000000
--- a/components/camel-cmis/src/main/java/org/apache/camel/component/cmis/osgi/Activator.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.cmis.osgi;
-
-import org.apache.camel.component.cmis.SessionFactoryLocator;
-import org.apache.chemistry.opencmis.client.api.SessionFactory;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-// Locator the SessionFactoryImpl service
-public class Activator implements BundleActivator {
-    private ServiceReference reference;
-
-    @Override
-    public void start(BundleContext context) throws Exception {
-        // get the reference of SessionFactory service
-        reference = context.getServiceReference(SessionFactory.class.getName());
-        SessionFactory sessionFactory = (SessionFactory) context.getService(reference);
-        SessionFactoryLocator.setSessionFactory(sessionFactory);
-    }
-
-    @Override
-    public void stop(BundleContext context) throws Exception {
-        // release the reference
-        if (reference != null) {
-            context.ungetService(reference);
-        }
-    }
-
-}

[camel] 03/07: CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit bc25f8d8a9efc0982a441b0258dcb26ec3eaddad
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 07:12:07 2021 +0200

    CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
---
 components/camel-hdfs/pom.xml                      | 12 -----
 .../camel/component/hdfs/osgi/HdfsActivator.java   | 52 ----------------------
 2 files changed, 64 deletions(-)

diff --git a/components/camel-hdfs/pom.xml b/components/camel-hdfs/pom.xml
index 401efb2..db75c98 100644
--- a/components/camel-hdfs/pom.xml
+++ b/components/camel-hdfs/pom.xml
@@ -46,9 +46,6 @@
             org.apache.hadoop.net,
             org.apache.hadoop.ipc
         </camel.osgi.import.additional>
-        <camel.osgi.activator>
-            org.apache.camel.component.hdfs.osgi.HdfsActivator
-        </camel.osgi.activator>
     </properties>
 
     <dependencies>
@@ -140,15 +137,6 @@
             <scope>test</scope>
         </dependency>
 
-        <!-- osgi -->
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
-            <version>6.0.0</version>
-        </dependency>
-
         <!-- test infra -->
         <dependency>
             <groupId>org.apache.camel</groupId>
diff --git a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/osgi/HdfsActivator.java b/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/osgi/HdfsActivator.java
deleted file mode 100644
index 3a01814..0000000
--- a/components/camel-hdfs/src/main/java/org/apache/camel/component/hdfs/osgi/HdfsActivator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.hdfs.osgi;
-
-import org.apache.hadoop.util.ShutdownHookManager;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class HdfsActivator implements BundleActivator {
-
-    @Override
-    public void start(BundleContext context) throws Exception {
-        // no action needed
-    }
-
-    @Override
-    public void stop(BundleContext context) throws Exception {
-        // There's problem inside OSGi when framework is being shutdown
-        // hadoop.fs code registers some JVM shutdown hooks throughout the code and this ordered
-        // list of hooks is run in shutdown thread.
-        // At that time bundle class loader / bundle wiring is no longer valid (bundle is stopped)
-        // so ShutdownHookManager can't load additional classes. But there are some inner classes
-        // loaded when iterating over registered hadoop shutdown hooks.
-        // Let's explicitly load these inner classes when bundle is stopped, as there's last chance
-        // to use valid bundle class loader.
-        // This is based on the knowledge of what's contained in SMX bundle
-        // org.apache.servicemix.bundles.hadoop-client-*.jar
-        // the above is just a warning that hadoop may have some quirks when running inside OSGi
-        ClassLoader hadoopCl = ShutdownHookManager.class.getClassLoader();
-        if (hadoopCl != null) {
-            String shm = ShutdownHookManager.class.getName();
-            hadoopCl.loadClass(shm + "$1");
-            hadoopCl.loadClass(shm + "$2");
-            hadoopCl.loadClass(shm + "$HookEntry");
-        }
-    }
-
-}

[camel] 02/07: CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 086788df693cfd3668a2deb7a8a646f59c29dc7c
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 07:06:20 2021 +0200

    CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
---
 components/camel-corda/pom.xml | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/components/camel-corda/pom.xml b/components/camel-corda/pom.xml
index 0c3784a..8212b16 100644
--- a/components/camel-corda/pom.xml
+++ b/components/camel-corda/pom.xml
@@ -42,15 +42,6 @@
             <artifactId>corda-rpc</artifactId>
         </dependency>
 
-        <!-- osgi -->
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
-            <version>6.0.0</version>
-        </dependency>
-
         <!-- for testing -->
         <dependency>
             <groupId>org.apache.camel</groupId>

[camel] 05/07: CAMEL-16711: components - Move OSGi dependenct code to camel-karaf

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c1d0b3525fd03f1a08529689ac16fa060fd1c5e6
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jun 14 09:23:15 2021 +0200

    CAMEL-16711: components - Move OSGi dependenct code to camel-karaf
---
 components/camel-zookeeper-master/pom.xml          |  16 --
 .../zookeepermaster/ZookeeperGroupSupport.java     |   5 +-
 .../group/DefaultGroupFactoryStrategy.java         |  19 +--
 .../{ManagedGroupFactory.java => GroupHelper.java} |  17 +-
 .../zookeepermaster/group/ManagedGroupFactory.java |   4 +
 .../internal/osgi/OsgiManagedGroupFactory.java     | 184 ---------------------
 .../internal/osgi/TrackingZooKeeperGroup.java      |  66 --------
 7 files changed, 24 insertions(+), 287 deletions(-)

diff --git a/components/camel-zookeeper-master/pom.xml b/components/camel-zookeeper-master/pom.xml
index c189445..88a6e34 100644
--- a/components/camel-zookeeper-master/pom.xml
+++ b/components/camel-zookeeper-master/pom.xml
@@ -100,22 +100,6 @@
             <artifactId>jackson-annotations</artifactId>
         </dependency>
 
-        <!-- optional OSGi support -->
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.core</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
-            <version>6.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.osgi</groupId>
-            <artifactId>osgi.cmpn</artifactId>
-            <scope>provided</scope>
-            <optional>true</optional>
-            <version>6.0.0</version>
-        </dependency>
-
         <!-- test dependencies -->
         <dependency>
             <groupId>org.apache.camel</groupId>
diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
index 7a71d5f..ec1f73e 100644
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
+++ b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/ZookeeperGroupSupport.java
@@ -132,6 +132,7 @@ public class ZookeeperGroupSupport extends ServiceSupport
 
     public void setManagedGroupFactory(ManagedGroupFactory managedGroupFactory) {
         this.managedGroupFactory = managedGroupFactory;
+        this.managedGroupFactory.setClassLoader(this.getClass().getClassLoader());
     }
 
     public ManagedGroupFactoryStrategy getManagedGroupFactoryStrategy() {
@@ -177,8 +178,8 @@ public class ZookeeperGroupSupport extends ServiceSupport
             if (managedGroupFactoryStrategy == null) {
                 managedGroupFactoryStrategy = new DefaultGroupFactoryStrategy();
             }
-            managedGroupFactory = managedGroupFactoryStrategy.createGroupFactory(curator, getClass().getClassLoader(),
-                    getCamelContext(), this);
+            setManagedGroupFactory(managedGroupFactoryStrategy.createGroupFactory(curator, getClass().getClassLoader(),
+                    getCamelContext(), this));
         }
     }
 
diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/DefaultGroupFactoryStrategy.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/DefaultGroupFactoryStrategy.java
index b0fe74c..81d1858 100644
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/DefaultGroupFactoryStrategy.java
+++ b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/DefaultGroupFactoryStrategy.java
@@ -19,10 +19,7 @@ package org.apache.camel.component.zookeepermaster.group;
 import java.util.concurrent.Callable;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.component.zookeepermaster.ManagedGroupFactoryStrategy;
-import org.apache.camel.spi.BeanIntrospection;
-import org.apache.camel.support.ObjectHelper;
 import org.apache.curator.framework.CuratorFramework;
 
 public class DefaultGroupFactoryStrategy implements ManagedGroupFactoryStrategy {
@@ -34,22 +31,12 @@ public class DefaultGroupFactoryStrategy implements ManagedGroupFactoryStrategy
             CamelContext camelContext,
             Callable<CuratorFramework> factory)
             throws Exception {
+
         if (curator != null) {
             return new DefaultManagedGroupFactory(curator, false);
+        } else {
+            return new DefaultManagedGroupFactory(factory.call(), true);
         }
-        try {
-            Class<?> clazz = camelContext.getClassResolver()
-                    .resolveClass("org.apache.camel.component.zookeepermaster.group.internal.osgi.OsgiManagedGroupFactory");
-            if (clazz != null) {
-                Object instance = ObjectHelper.newInstance(clazz);
-                BeanIntrospection beanIntrospection = camelContext.adapt(ExtendedCamelContext.class).getBeanIntrospection();
-                beanIntrospection.setProperty(camelContext, instance, "classLoader", loader);
-                return (ManagedGroupFactory) instance;
-            }
-        } catch (Throwable e) {
-            // Ignore if we're not in OSGi
-        }
-        return new DefaultManagedGroupFactory(factory.call(), true);
     }
 
 }
diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/ManagedGroupFactory.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/GroupHelper.java
similarity index 60%
copy from components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/ManagedGroupFactory.java
copy to components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/GroupHelper.java
index 000bbb3..b1120d5 100644
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/ManagedGroupFactory.java
+++ b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/GroupHelper.java
@@ -16,12 +16,23 @@
  */
 package org.apache.camel.component.zookeepermaster.group;
 
+import org.apache.camel.CamelContext;
+import org.apache.camel.support.CamelContextHelper;
 import org.apache.curator.framework.CuratorFramework;
 
-public interface ManagedGroupFactory extends GroupFactory {
+public final class GroupHelper {
 
-    CuratorFramework getCurator();
+    private GroupHelper() {
+    }
 
-    void close();
+    public static ManagedGroupFactory createManagedGroupFactory(
+            CamelContext camelContext, ClassLoader loader, CuratorFramework curator) {
+        ManagedGroupFactory factory = CamelContextHelper.findByType(camelContext, ManagedGroupFactory.class);
+        if (factory == null) {
+            factory = new DefaultManagedGroupFactory(curator, true);
+        }
+        factory.setClassLoader(loader);
+        return factory;
+    }
 
 }
diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/ManagedGroupFactory.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/ManagedGroupFactory.java
index 000bbb3..f71e4d5 100644
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/ManagedGroupFactory.java
+++ b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/ManagedGroupFactory.java
@@ -24,4 +24,8 @@ public interface ManagedGroupFactory extends GroupFactory {
 
     void close();
 
+    default void setClassLoader(ClassLoader classLoader) {
+        // noop
+    }
+
 }
diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/osgi/OsgiManagedGroupFactory.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/osgi/OsgiManagedGroupFactory.java
deleted file mode 100644
index c206c59..0000000
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/osgi/OsgiManagedGroupFactory.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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.zookeepermaster.group.internal.osgi;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ThreadFactory;
-
-import org.apache.camel.component.zookeepermaster.group.Group;
-import org.apache.camel.component.zookeepermaster.group.ManagedGroupFactory;
-import org.apache.camel.component.zookeepermaster.group.NodeState;
-import org.apache.camel.component.zookeepermaster.group.internal.DelegateZooKeeperGroup;
-import org.apache.camel.component.zookeepermaster.group.internal.DelegateZooKeeperMultiGroup;
-import org.apache.curator.framework.CuratorFramework;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleReference;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-public class OsgiManagedGroupFactory implements ManagedGroupFactory {
-
-    private ManagedGroupFactory delegate;
-
-    public OsgiManagedGroupFactory() {
-    }
-
-    public void setClassLoader(ClassLoader loader) {
-        this.delegate = new OsgiTrackingManagedGroupFactory(loader);
-    }
-
-    @Override
-    public CuratorFramework getCurator() {
-        return delegate.getCurator();
-    }
-
-    @Override
-    public <T extends NodeState> Group<T> createGroup(String path, Class<T> clazz) {
-        return delegate.createGroup(path, clazz);
-    }
-
-    @Override
-    public <T extends NodeState> Group<T> createGroup(String path, Class<T> clazz, ThreadFactory threadFactory) {
-        return delegate.createGroup(path, clazz, threadFactory);
-    }
-
-    @Override
-    public <T extends NodeState> Group<T> createMultiGroup(String path, Class<T> clazz) {
-        throw new IllegalStateException("not supported");
-    }
-
-    @Override
-    public <T extends NodeState> Group<T> createMultiGroup(String path, Class<T> clazz, ThreadFactory threadFactory) {
-        throw new IllegalStateException("not supported");
-    }
-
-    @Override
-    public void close() {
-        delegate.close();
-    }
-
-    static class OsgiTrackingManagedGroupFactory
-            implements ManagedGroupFactory, ServiceTrackerCustomizer<CuratorFramework, CuratorFramework> {
-
-        private final BundleContext bundleContext;
-        private final ServiceTracker<CuratorFramework, CuratorFramework> tracker;
-        private CuratorFramework curator;
-        private final List<DelegateZooKeeperGroup<?>> groups = new ArrayList<>();
-
-        OsgiTrackingManagedGroupFactory(ClassLoader loader) {
-            this(getBundleContext(loader));
-        }
-
-        OsgiTrackingManagedGroupFactory(BundleContext bundleContext) {
-            this.bundleContext = bundleContext;
-            this.tracker = new ServiceTracker<>(
-                    bundleContext, CuratorFramework.class, this);
-            this.tracker.open();
-        }
-
-        static BundleContext getBundleContext(ClassLoader loader) {
-            if (!(loader instanceof BundleReference)) {
-                throw new IllegalStateException("Not an OSGi ClassLoader");
-            }
-            return ((BundleReference) loader).getBundle().getBundleContext();
-        }
-
-        @Override
-        public CuratorFramework addingService(ServiceReference<CuratorFramework> reference) {
-            CuratorFramework curator = OsgiTrackingManagedGroupFactory.this.bundleContext.getService(reference);
-            useCurator(curator);
-            return curator;
-        }
-
-        @Override
-        public void modifiedService(ServiceReference<CuratorFramework> reference, CuratorFramework service) {
-        }
-
-        @Override
-        public void removedService(ServiceReference<CuratorFramework> reference, CuratorFramework service) {
-            useCurator(null);
-            OsgiTrackingManagedGroupFactory.this.bundleContext.ungetService(reference);
-        }
-
-        protected void useCurator(CuratorFramework curator) {
-            this.curator = curator;
-            for (DelegateZooKeeperGroup<?> group : groups) {
-                group.useCurator(curator);
-            }
-        }
-
-        @Override
-        public CuratorFramework getCurator() {
-            return curator;
-        }
-
-        @Override
-        public <T extends NodeState> Group<T> createGroup(String path, Class<T> clazz) {
-            return new DelegateZooKeeperGroup<T>(path, clazz) {
-                @Override
-                public void start() {
-                    useCurator(curator);
-                    groups.add(this);
-                    super.start();
-                }
-
-                @Override
-                public void close() throws IOException {
-                    groups.remove(this);
-                    super.close();
-                }
-            };
-        }
-
-        @Override
-        public <T extends NodeState> Group<T> createGroup(String path, Class<T> clazz, ThreadFactory threadFactory) {
-            throw new IllegalStateException("not supported");
-        }
-
-        @Override
-        public <T extends NodeState> Group<T> createMultiGroup(String path, Class<T> clazz) {
-            return new DelegateZooKeeperMultiGroup<T>(path, clazz) {
-                @Override
-                public void start() {
-                    useCurator(curator);
-                    groups.add(this);
-                    super.start();
-                }
-
-                @Override
-                public void close() throws IOException {
-                    groups.remove(this);
-                    super.close();
-                }
-            };
-        }
-
-        @Override
-        public <T extends NodeState> Group<T> createMultiGroup(String path, Class<T> clazz, ThreadFactory threadFactory) {
-            throw new IllegalStateException("not supported");
-        }
-
-        @Override
-        public void close() {
-            this.tracker.close();
-        }
-    }
-
-}
diff --git a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/osgi/TrackingZooKeeperGroup.java b/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/osgi/TrackingZooKeeperGroup.java
deleted file mode 100644
index 67e2cfa..0000000
--- a/components/camel-zookeeper-master/src/main/java/org/apache/camel/component/zookeepermaster/group/internal/osgi/TrackingZooKeeperGroup.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.zookeepermaster.group.internal.osgi;
-
-import org.apache.camel.component.zookeepermaster.group.NodeState;
-import org.apache.camel.component.zookeepermaster.group.internal.DelegateZooKeeperGroup;
-import org.apache.curator.framework.CuratorFramework;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
-
-public class TrackingZooKeeperGroup<T extends NodeState> extends DelegateZooKeeperGroup<T> {
-
-    private final BundleContext bundleContext;
-    private final ServiceTracker<CuratorFramework, CuratorFramework> tracker;
-
-    public TrackingZooKeeperGroup(BundleContext bundleContext, String path, Class<T> clazz) {
-        super(path, clazz);
-        this.bundleContext = bundleContext;
-        this.tracker = new ServiceTracker<>(
-                bundleContext, CuratorFramework.class, new ServiceTrackerCustomizer<CuratorFramework, CuratorFramework>() {
-                    @Override
-                    public CuratorFramework addingService(ServiceReference<CuratorFramework> reference) {
-                        CuratorFramework curator = TrackingZooKeeperGroup.this.bundleContext.getService(reference);
-                        useCurator(curator);
-                        return curator;
-                    }
-
-                    @Override
-                    public void modifiedService(ServiceReference<CuratorFramework> reference, CuratorFramework service) {
-                    }
-
-                    @Override
-                    public void removedService(ServiceReference<CuratorFramework> reference, CuratorFramework service) {
-                        useCurator(null);
-                        TrackingZooKeeperGroup.this.bundleContext.ungetService(reference);
-                    }
-                });
-    }
-
-    @Override
-    protected void doStart() {
-        tracker.open();
-    }
-
-    @Override
-    protected void doStop() {
-        tracker.close();
-    }
-
-}