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

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

commit d24b06fb9546e721f5da03c995c2f65072026e9f
Author: Claus Ibsen <[email protected]>
AuthorDate: Tue Apr 21 11:44:11 2020 +0200

    CAMEL-14936: camel-core - Remove optional prefix in FactoryFinder
---
 .../services/org/apache/camel/component/file       |   1 -
 .../apache/camel/component/file/FileComponent.java |   2 -
 .../apache/camel/component/file/FileEndpoint.java  |  24 ++---
 .../camel/component/file/FileProcessStrategy.java  |  35 -------
 .../camel/component/file/GenericFileEndpoint.java  |  42 +-------
 .../file/GenericFileProcessStrategyFactory.java    |  20 ++--
 .../file/strategy/FileProcessStrategyFactory.java  |   8 +-
 .../GenericFileProcessStrategyFactory.java         | 115 ---------------------
 .../services/org/apache/camel/component/ftp        |   1 -
 .../services/org/apache/camel/component/ftps       |   1 -
 .../services/org/apache/camel/component/sftp       |   1 -
 .../camel/component/file/remote/FtpComponent.java  |   3 -
 .../camel/component/file/remote/FtpEndpoint.java   |   7 ++
 .../camel/component/file/remote/FtpsComponent.java |   3 -
 .../camel/component/file/remote/SftpComponent.java |   3 -
 .../camel/component/file/remote/SftpEndpoint.java  |  10 ++
 .../remote/strategy/FtpProcessStrategyFactory.java |   9 +-
 .../strategy/SftpProcessStrategyFactory.java       |  42 ++++----
 .../remote/RemoteFileIgnoreDoPollErrorTest.java    |   6 ++
 .../java/org/apache/camel/spi/FactoryFinder.java   |  22 +---
 .../camel/impl/engine/DefaultFactoryFinder.java    |  37 +++----
 .../impl/engine/DefaultFactoryFinderTest.java      |  26 +----
 .../camel/maven/packaging/SpiGeneratorMojo.java    |   8 --
 .../camel/spi/annotations/SubServiceFactory.java   |  32 ------
 24 files changed, 88 insertions(+), 370 deletions(-)

diff --git 
a/components/camel-file/src/generated/resources/META-INF/services/org/apache/camel/component/file
 
b/components/camel-file/src/generated/resources/META-INF/services/org/apache/camel/component/file
index 83eca62..0a2260f 100644
--- 
a/components/camel-file/src/generated/resources/META-INF/services/org/apache/camel/component/file
+++ 
b/components/camel-file/src/generated/resources/META-INF/services/org/apache/camel/component/file
@@ -1,3 +1,2 @@
 # Generated by camel build tools - do NOT edit this file!
 class=org.apache.camel.component.file.FileComponent
-strategy.factory.class=org.apache.camel.component.file.strategy.FileProcessStrategyFactory
diff --git 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileComponent.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileComponent.java
index 3de7cfe..b114aec 100644
--- 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileComponent.java
+++ 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileComponent.java
@@ -20,7 +20,6 @@ import java.io.File;
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.component.file.strategy.FileProcessStrategyFactory;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.util.FileUtil;
 import org.apache.camel.util.StringHelper;
@@ -30,7 +29,6 @@ import org.apache.camel.util.StringHelper;
  * access to file systems.
  */
 @Component("file")
-@FileProcessStrategy(FileProcessStrategyFactory.class)
 public class FileComponent extends GenericFileComponent<File> {
     /**
      * GenericFile property on Camel Exchanges.
diff --git 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
index d81bd1e..1ac6a67 100644
--- 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
+++ 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
@@ -31,6 +31,7 @@ import org.apache.camel.Message;
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.Processor;
 import org.apache.camel.component.file.strategy.FileMoveExistingStrategy;
+import org.apache.camel.component.file.strategy.FileProcessStrategyFactory;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
@@ -215,6 +216,11 @@ public class FileEndpoint extends 
GenericFileEndpoint<File> {
         return new GenericFileDefaultMoveExistingFileStrategy();
     }
 
+    @Override
+    protected GenericFileProcessStrategy<File> createGenericFileStrategy() {
+        return new 
FileProcessStrategyFactory().createGenericFileProcessStrategy(getCamelContext(),
 getParamsAsMap());
+    }
+
     public File getFile() {
         return file;
     }
@@ -367,13 +373,8 @@ public class FileEndpoint extends 
GenericFileEndpoint<File> {
         if (chmod == null || chmod.length() < 3 || chmod.length() > 4) {
             return false;
         }
-        String permissionsString = chmod.trim().substring(chmod.length() - 3); 
// if
-                                                                               
// 4
-                                                                               
// digits
-                                                                               
// chop
-                                                                               
// off
-                                                                               
// leading
-                                                                               
// one
+        // if 4 digits chop off leading one
+        String permissionsString = chmod.trim().substring(chmod.length() - 3);
         for (int i = 0; i < permissionsString.length(); i++) {
             char c = permissionsString.charAt(i);
             if (!Character.isDigit(c) || 
Integer.parseInt(Character.toString(c)) > 7) {
@@ -453,13 +454,8 @@ public class FileEndpoint extends 
GenericFileEndpoint<File> {
             return permissions;
         }
 
-        String chmodString = chmodDirectory.substring(chmodDirectory.length() 
- 3); // if
-                                                                               
     // 4
-                                                                               
     // digits
-                                                                               
     // chop
-                                                                               
     // off
-                                                                               
     // leading
-                                                                               
     // one
+        // if 4 digits chop off leading one
+        String chmodString = chmodDirectory.substring(chmodDirectory.length() 
- 3);
 
         int ownerValue = Integer.parseInt(chmodString.substring(0, 1));
         int groupValue = Integer.parseInt(chmodString.substring(1, 2));
diff --git 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileProcessStrategy.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/FileProcessStrategy.java
deleted file mode 100644
index 6649bd4..0000000
--- 
a/components/camel-file/src/main/java/org/apache/camel/component/file/FileProcessStrategy.java
+++ /dev/null
@@ -1,35 +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.file;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.apache.camel.spi.annotations.SubServiceFactory;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Target({ElementType.TYPE})
-@SubServiceFactory("strategy.factory")
-public @interface FileProcessStrategy {
-
-    Class value();
-
-}
diff --git 
a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index 83890b0..ed95322 100644
--- 
a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ 
b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -59,7 +59,6 @@ import org.slf4j.LoggerFactory;
  */
 public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint 
implements BrowsableEndpoint {
 
-    protected static final String DEFAULT_STRATEGYFACTORY_CLASS = 
"org.apache.camel.component.file.strategy.GenericFileProcessStrategyFactory";
     protected static final int DEFAULT_IDEMPOTENT_CACHE_SIZE = 1000;
     protected static final int DEFAULT_IN_PROGRESS_CACHE_SIZE = 50000;
 
@@ -486,46 +485,7 @@ public abstract class GenericFileEndpoint<T> extends 
ScheduledPollEndpoint imple
     /**
      * A strategy method to lazily create the file strategy
      */
-    @SuppressWarnings("unchecked")
-    protected GenericFileProcessStrategy<T> createGenericFileStrategy() {
-        FactoryFinder finder = 
getCamelContext().adapt(ExtendedCamelContext.class).getFactoryFinder("META-INF/services/org/apache/camel/component/");
-        LOG.trace("Using FactoryFinder: {}", finder);
-        Class<?> factory = finder.findClass(getScheme(), "strategy.factory.", 
CamelContext.class).orElse(null);
-
-        if (factory == null) {
-            // use default
-            try {
-                LOG.trace("Using ClassResolver to resolve class: {}", 
DEFAULT_STRATEGYFACTORY_CLASS);
-                factory = 
this.getCamelContext().getClassResolver().resolveClass(DEFAULT_STRATEGYFACTORY_CLASS);
-            } catch (Exception e) {
-                LOG.trace("Cannot load class: {}", 
DEFAULT_STRATEGYFACTORY_CLASS, e);
-            }
-            // fallback and us this class loader
-            try {
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace("Using classloader: {} to resolve class: {}", 
this.getClass().getClassLoader(), DEFAULT_STRATEGYFACTORY_CLASS);
-                }
-                factory = 
this.getCamelContext().getClassResolver().resolveClass(DEFAULT_STRATEGYFACTORY_CLASS,
 this.getClass().getClassLoader());
-            } catch (Exception e) {
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace("Cannot load class: {} using classloader: " + 
this.getClass().getClassLoader(), DEFAULT_STRATEGYFACTORY_CLASS, e);
-                }
-            }
-
-            if (factory == null) {
-                throw new 
TypeNotPresentException(DEFAULT_STRATEGYFACTORY_CLASS + " class not found", 
null);
-            }
-        }
-
-        try {
-            Method factoryMethod = 
factory.getMethod("createGenericFileProcessStrategy", CamelContext.class, 
Map.class);
-            Map<String, Object> params = getParamsAsMap();
-            LOG.debug("Parameters for Generic file process strategy {}", 
params);
-            return 
(GenericFileProcessStrategy<T>)ObjectHelper.invokeMethod(factoryMethod, null, 
getCamelContext(), params);
-        } catch (NoSuchMethodException e) {
-            throw new TypeNotPresentException(factory.getSimpleName() + 
".createGenericFileProcessStrategy method not found", e);
-        }
-    }
+    protected abstract GenericFileProcessStrategy<T> 
createGenericFileStrategy();
 
     public boolean isNoop() {
         return noop;
diff --git 
a/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/SubServiceFactory.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileProcessStrategyFactory.java
similarity index 68%
rename from 
core/camel-api/src/generated/java/org/apache/camel/spi/annotations/SubServiceFactory.java
rename to 
components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileProcessStrategyFactory.java
index ec16498..7d6f7d1 100644
--- 
a/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/SubServiceFactory.java
+++ 
b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileProcessStrategyFactory.java
@@ -14,19 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.spi.annotations;
+package org.apache.camel.component.file;
 
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
+import java.util.Map;
 
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Target({ElementType.TYPE })
-public @interface SubServiceFactory {
+import org.apache.camel.CamelContext;
 
-    String value();
+/**
+ * Factory to create {@link GenericFileProcessStrategy}
+ */
+public interface GenericFileProcessStrategyFactory<T> {
+
+    GenericFileProcessStrategy<T> 
createGenericFileProcessStrategy(CamelContext context, Map<String, Object> 
params);
 
 }
diff --git 
a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java
index ba4d062..a21d52b 100644
--- 
a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java
+++ 
b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java
@@ -25,16 +25,14 @@ import org.apache.camel.Expression;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy;
 import org.apache.camel.component.file.GenericFileProcessStrategy;
+import org.apache.camel.component.file.GenericFileProcessStrategyFactory;
 import org.apache.camel.spi.IdempotentRepository;
 import org.apache.camel.spi.Language;
 import org.apache.camel.util.ObjectHelper;
 
-public final class FileProcessStrategyFactory {
+public final class FileProcessStrategyFactory implements 
GenericFileProcessStrategyFactory<File> {
 
-    private FileProcessStrategyFactory() {
-    }
-
-    public static GenericFileProcessStrategy<File> 
createGenericFileProcessStrategy(CamelContext context, Map<String, Object> 
params) {
+    public GenericFileProcessStrategy<File> 
createGenericFileProcessStrategy(CamelContext context, Map<String, Object> 
params) {
 
         // We assume a value is present only if its value not null for String
         // and 'true' for boolean
diff --git 
a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileProcessStrategyFactory.java
 
b/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileProcessStrategyFactory.java
deleted file mode 100644
index 34fb672..0000000
--- 
a/components/camel-file/src/main/java/org/apache/camel/component/file/strategy/GenericFileProcessStrategyFactory.java
+++ /dev/null
@@ -1,115 +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.file.strategy;
-
-import java.util.Map;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Expression;
-import org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy;
-import org.apache.camel.component.file.GenericFileProcessStrategy;
-import org.apache.camel.util.ObjectHelper;
-
-public final class GenericFileProcessStrategyFactory {
-
-    private GenericFileProcessStrategyFactory() {
-    }
-
-    @SuppressWarnings("unchecked")
-    public static <T> GenericFileProcessStrategy<T> 
createGenericFileProcessStrategy(CamelContext context, Map<String, Object> 
params) {
-
-        // We assume a value is present only if its value not null for String
-        // and 'true' for boolean
-        Expression moveExpression = (Expression)params.get("move");
-        Expression moveFailedExpression = (Expression)params.get("moveFailed");
-        Expression preMoveExpression = (Expression)params.get("preMove");
-        boolean isNoop = params.get("noop") != null;
-        boolean isDelete = params.get("delete") != null;
-        boolean isMove = moveExpression != null || preMoveExpression != null 
|| moveFailedExpression != null;
-
-        if (isDelete) {
-            GenericFileDeleteProcessStrategy<T> strategy = new 
GenericFileDeleteProcessStrategy<>();
-            
strategy.setExclusiveReadLockStrategy((GenericFileExclusiveReadLockStrategy<T>)getExclusiveReadLockStrategy(params));
-            if (preMoveExpression != null) {
-                GenericFileExpressionRenamer<T> renamer = new 
GenericFileExpressionRenamer<>();
-                renamer.setExpression(preMoveExpression);
-                strategy.setBeginRenamer(renamer);
-            }
-            if (moveFailedExpression != null) {
-                GenericFileExpressionRenamer<T> renamer = new 
GenericFileExpressionRenamer<>();
-                renamer.setExpression(moveFailedExpression);
-                strategy.setFailureRenamer(renamer);
-            }
-            return strategy;
-        } else if (isMove || isNoop) {
-            GenericFileRenameProcessStrategy<T> strategy = new 
GenericFileRenameProcessStrategy<>();
-            
strategy.setExclusiveReadLockStrategy((GenericFileExclusiveReadLockStrategy<T>)getExclusiveReadLockStrategy(params));
-            if (!isNoop && moveExpression != null) {
-                // move on commit is only possible if not noop
-                GenericFileExpressionRenamer<T> renamer = new 
GenericFileExpressionRenamer<>();
-                renamer.setExpression(moveExpression);
-                strategy.setCommitRenamer(renamer);
-            }
-            // both move and noop supports pre move
-            if (moveFailedExpression != null) {
-                GenericFileExpressionRenamer<T> renamer = new 
GenericFileExpressionRenamer<>();
-                renamer.setExpression(moveFailedExpression);
-                strategy.setFailureRenamer(renamer);
-            }
-            // both move and noop supports pre move
-            if (preMoveExpression != null) {
-                GenericFileExpressionRenamer<T> renamer = new 
GenericFileExpressionRenamer<>();
-                renamer.setExpression(preMoveExpression);
-                strategy.setBeginRenamer(renamer);
-            }
-            return strategy;
-        } else {
-            // default strategy will do nothing
-            GenericFileNoOpProcessStrategy<T> strategy = new 
GenericFileNoOpProcessStrategy<>();
-            
strategy.setExclusiveReadLockStrategy((GenericFileExclusiveReadLockStrategy<T>)getExclusiveReadLockStrategy(params));
-            return strategy;
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private static <T> GenericFileExclusiveReadLockStrategy<T> 
getExclusiveReadLockStrategy(Map<String, Object> params) {
-        GenericFileExclusiveReadLockStrategy<T> strategy = 
(GenericFileExclusiveReadLockStrategy<T>)params.get("exclusiveReadLockStrategy");
-        if (strategy != null) {
-            return strategy;
-        }
-
-        // no explicit strategy set then fallback to readLock option
-        String readLock = (String)params.get("readLock");
-        if (ObjectHelper.isNotEmpty(readLock)) {
-            if ("none".equals(readLock) || "false".equals(readLock)) {
-                return null;
-            } else if ("rename".equals(readLock)) {
-                GenericFileRenameExclusiveReadLockStrategy<T> readLockStrategy 
= new GenericFileRenameExclusiveReadLockStrategy<>();
-                Long timeout = (Long)params.get("readLockTimeout");
-                if (timeout != null) {
-                    readLockStrategy.setTimeout(timeout);
-                }
-                Boolean readLockMarkerFile = 
(Boolean)params.get("readLockMarkerFile");
-                if (readLockMarkerFile != null) {
-                    readLockStrategy.setMarkerFiler(readLockMarkerFile);
-                }
-                return readLockStrategy;
-            }
-        }
-        return null;
-    }
-}
diff --git 
a/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/ftp
 
b/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/ftp
index 0814c77..a2dbec7 100644
--- 
a/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/ftp
+++ 
b/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/ftp
@@ -1,3 +1,2 @@
 # Generated by camel build tools - do NOT edit this file!
 class=org.apache.camel.component.file.remote.FtpComponent
-strategy.factory.class=org.apache.camel.component.file.remote.strategy.FtpProcessStrategyFactory
diff --git 
a/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/ftps
 
b/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/ftps
index 2c2d90b..fd09875 100644
--- 
a/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/ftps
+++ 
b/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/ftps
@@ -1,3 +1,2 @@
 # Generated by camel build tools - do NOT edit this file!
 class=org.apache.camel.component.file.remote.FtpsComponent
-strategy.factory.class=org.apache.camel.component.file.remote.strategy.FtpProcessStrategyFactory
diff --git 
a/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/sftp
 
b/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/sftp
index 6d33bb2..5801d4a 100644
--- 
a/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/sftp
+++ 
b/components/camel-ftp/src/generated/resources/META-INF/services/org/apache/camel/component/sftp
@@ -1,3 +1,2 @@
 # Generated by camel build tools - do NOT edit this file!
 class=org.apache.camel.component.file.remote.SftpComponent
-strategy.factory.class=org.apache.camel.component.file.remote.strategy.SftpProcessStrategyFactory
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java
index c0b4dbb..16e23f4 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpComponent.java
@@ -21,9 +21,7 @@ import java.util.Map;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.component.file.FileProcessStrategy;
 import org.apache.camel.component.file.GenericFileEndpoint;
-import 
org.apache.camel.component.file.remote.strategy.FtpProcessStrategyFactory;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.support.EndpointHelper;
 import org.apache.camel.support.component.PropertyConfigurerSupport;
@@ -34,7 +32,6 @@ import org.apache.commons.net.ftp.FTPFile;
  * FTP Component
  */
 @Component("ftp")
-@FileProcessStrategy(FtpProcessStrategyFactory.class)
 public class FtpComponent extends RemoteFileComponent<FTPFile> {
 
     public FtpComponent() {
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
index 0e762b4..ec2b6b0 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
@@ -26,8 +26,10 @@ import org.apache.camel.Processor;
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedResource;
 import org.apache.camel.component.file.GenericFileConfiguration;
+import org.apache.camel.component.file.GenericFileProcessStrategy;
 import org.apache.camel.component.file.GenericFileProducer;
 import 
org.apache.camel.component.file.remote.RemoteFileConfiguration.PathSeparator;
+import 
org.apache.camel.component.file.remote.strategy.FtpProcessStrategyFactory;
 import org.apache.camel.component.file.strategy.FileMoveExistingStrategy;
 import org.apache.camel.spi.ClassResolver;
 import org.apache.camel.spi.Metadata;
@@ -134,6 +136,11 @@ public class FtpEndpoint<T extends FTPFile> extends 
RemoteFileEndpoint<FTPFile>
     }
 
     @Override
+    protected GenericFileProcessStrategy<FTPFile> createGenericFileStrategy() {
+        return new 
FtpProcessStrategyFactory().createGenericFileProcessStrategy(getCamelContext(), 
getParamsAsMap());
+    }
+
+    @Override
     public RemoteFileOperations<FTPFile> createRemoteFileOperations() throws 
Exception {
         // configure ftp client
         FTPClient client = ftpClient;
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsComponent.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsComponent.java
index caeaa8e..f14e413 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsComponent.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsComponent.java
@@ -21,9 +21,7 @@ import java.util.Map;
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.SSLContextParametersAware;
-import org.apache.camel.component.file.FileProcessStrategy;
 import org.apache.camel.component.file.GenericFileEndpoint;
-import 
org.apache.camel.component.file.remote.strategy.FtpProcessStrategyFactory;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.annotations.Component;
 import org.apache.camel.util.PropertiesHelper;
@@ -36,7 +34,6 @@ import org.apache.commons.net.ftp.FTPFile;
  * see wire-level SSL details.
  */
 @Component("ftps")
-@FileProcessStrategy(FtpProcessStrategyFactory.class)
 public class FtpsComponent extends FtpComponent implements 
SSLContextParametersAware {
 
     @Metadata(label = "security", defaultValue = "false")
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java
index d3fd36d..803b694 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpComponent.java
@@ -20,16 +20,13 @@ import java.net.URI;
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.component.file.FileProcessStrategy;
 import org.apache.camel.component.file.GenericFileEndpoint;
-import 
org.apache.camel.component.file.remote.strategy.SftpProcessStrategyFactory;
 import org.apache.camel.spi.annotations.Component;
 
 /**
  * Secure FTP Component
  */
 @Component("sftp")
-@FileProcessStrategy(SftpProcessStrategyFactory.class)
 public class SftpComponent extends RemoteFileComponent<SftpRemoteFile> {
 
     public SftpComponent() {
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
index c27b990..9b4377f 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
@@ -16,14 +16,19 @@
  */
 package org.apache.camel.component.file.remote;
 
+import com.jcraft.jsch.ChannelSftp;
 import com.jcraft.jsch.Proxy;
 import org.apache.camel.Processor;
 import org.apache.camel.component.file.GenericFileConfiguration;
+import org.apache.camel.component.file.GenericFileProcessStrategy;
 import org.apache.camel.component.file.GenericFileProducer;
+import 
org.apache.camel.component.file.remote.strategy.FtpProcessStrategyFactory;
+import 
org.apache.camel.component.file.remote.strategy.SftpProcessStrategyFactory;
 import org.apache.camel.component.file.strategy.FileMoveExistingStrategy;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
+import org.apache.commons.net.ftp.FTPFile;
 
 /**
  * The sftp (FTP over SSH) component is used for uploading or downloading files
@@ -87,6 +92,11 @@ public class SftpEndpoint extends 
RemoteFileEndpoint<SftpRemoteFile> {
     }
 
     @Override
+    protected GenericFileProcessStrategy<SftpRemoteFile> 
createGenericFileStrategy() {
+        return new 
SftpProcessStrategyFactory().createGenericFileProcessStrategy(getCamelContext(),
 getParamsAsMap());
+    }
+
+    @Override
     public RemoteFileOperations<SftpRemoteFile> createRemoteFileOperations() {
         SftpOperations operations = new SftpOperations(proxy);
         operations.setEndpoint(this);
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpProcessStrategyFactory.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpProcessStrategyFactory.java
index 5503b36..f6109f7 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpProcessStrategyFactory.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/FtpProcessStrategyFactory.java
@@ -23,6 +23,7 @@ import org.apache.camel.Expression;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy;
 import org.apache.camel.component.file.GenericFileProcessStrategy;
+import org.apache.camel.component.file.GenericFileProcessStrategyFactory;
 import 
org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy;
 import org.apache.camel.component.file.strategy.GenericFileExpressionRenamer;
 import org.apache.camel.component.file.strategy.GenericFileNoOpProcessStrategy;
@@ -31,12 +32,10 @@ import 
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy
 import org.apache.camel.util.ObjectHelper;
 import org.apache.commons.net.ftp.FTPFile;
 
-public final class FtpProcessStrategyFactory {
+public final class FtpProcessStrategyFactory implements 
GenericFileProcessStrategyFactory<FTPFile> {
 
-    private FtpProcessStrategyFactory() {
-    }
-
-    public static GenericFileProcessStrategy<FTPFile> 
createGenericFileProcessStrategy(CamelContext context, Map<String, Object> 
params) {
+    @Override
+    public GenericFileProcessStrategy<FTPFile> 
createGenericFileProcessStrategy(CamelContext context, Map<String, Object> 
params) {
 
         // We assume a value is present only if its value not null for String
         // and 'true' for boolean
diff --git 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpProcessStrategyFactory.java
 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpProcessStrategyFactory.java
index 97eb5e7..013a07f 100644
--- 
a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpProcessStrategyFactory.java
+++ 
b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/SftpProcessStrategyFactory.java
@@ -18,12 +18,13 @@ package org.apache.camel.component.file.remote.strategy;
 
 import java.util.Map;
 
-import com.jcraft.jsch.ChannelSftp;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Expression;
 import org.apache.camel.LoggingLevel;
 import org.apache.camel.component.file.GenericFileExclusiveReadLockStrategy;
 import org.apache.camel.component.file.GenericFileProcessStrategy;
+import org.apache.camel.component.file.GenericFileProcessStrategyFactory;
+import org.apache.camel.component.file.remote.SftpRemoteFile;
 import 
org.apache.camel.component.file.strategy.GenericFileDeleteProcessStrategy;
 import org.apache.camel.component.file.strategy.GenericFileExpressionRenamer;
 import org.apache.camel.component.file.strategy.GenericFileNoOpProcessStrategy;
@@ -31,12 +32,10 @@ import 
org.apache.camel.component.file.strategy.GenericFileRenameExclusiveReadLo
 import 
org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy;
 import org.apache.camel.util.ObjectHelper;
 
-public final class SftpProcessStrategyFactory {
+public final class SftpProcessStrategyFactory implements 
GenericFileProcessStrategyFactory<SftpRemoteFile> {
 
-    private SftpProcessStrategyFactory() {
-    }
-
-    public static GenericFileProcessStrategy<ChannelSftp.LsEntry> 
createGenericFileProcessStrategy(CamelContext context, Map<String, Object> 
params) {
+    @Override
+    public GenericFileProcessStrategy<SftpRemoteFile> 
createGenericFileProcessStrategy(CamelContext context, Map<String, Object> 
params) {
 
         // We assume a value is present only if its value not null for String
         // and 'true' for boolean
@@ -48,52 +47,52 @@ public final class SftpProcessStrategyFactory {
         boolean isMove = moveExpression != null || preMoveExpression != null 
|| moveFailedExpression != null;
 
         if (isDelete) {
-            GenericFileDeleteProcessStrategy<ChannelSftp.LsEntry> strategy = 
new GenericFileDeleteProcessStrategy<>();
+            GenericFileDeleteProcessStrategy<SftpRemoteFile> strategy = new 
GenericFileDeleteProcessStrategy<>();
             
strategy.setExclusiveReadLockStrategy(getExclusiveReadLockStrategy(params));
             if (preMoveExpression != null) {
-                GenericFileExpressionRenamer<ChannelSftp.LsEntry> renamer = 
new GenericFileExpressionRenamer<>();
+                GenericFileExpressionRenamer<SftpRemoteFile> renamer = new 
GenericFileExpressionRenamer<>();
                 renamer.setExpression(preMoveExpression);
                 strategy.setBeginRenamer(renamer);
             }
             if (moveFailedExpression != null) {
-                GenericFileExpressionRenamer<ChannelSftp.LsEntry> renamer = 
new GenericFileExpressionRenamer<>();
+                GenericFileExpressionRenamer<SftpRemoteFile> renamer = new 
GenericFileExpressionRenamer<>();
                 renamer.setExpression(moveFailedExpression);
                 strategy.setFailureRenamer(renamer);
             }
             return strategy;
         } else if (isMove || isNoop) {
-            GenericFileRenameProcessStrategy<ChannelSftp.LsEntry> strategy = 
new GenericFileRenameProcessStrategy<>();
+            GenericFileRenameProcessStrategy<SftpRemoteFile> strategy = new 
GenericFileRenameProcessStrategy<>();
             
strategy.setExclusiveReadLockStrategy(getExclusiveReadLockStrategy(params));
             if (!isNoop && moveExpression != null) {
                 // move on commit is only possible if not noop
-                GenericFileExpressionRenamer<ChannelSftp.LsEntry> renamer = 
new GenericFileExpressionRenamer<>();
+                GenericFileExpressionRenamer<SftpRemoteFile> renamer = new 
GenericFileExpressionRenamer<>();
                 renamer.setExpression(moveExpression);
                 strategy.setCommitRenamer(renamer);
             }
             // both move and noop supports pre move
             if (moveFailedExpression != null) {
-                GenericFileExpressionRenamer<ChannelSftp.LsEntry> renamer = 
new GenericFileExpressionRenamer<>();
+                GenericFileExpressionRenamer<SftpRemoteFile> renamer = new 
GenericFileExpressionRenamer<>();
                 renamer.setExpression(moveFailedExpression);
                 strategy.setFailureRenamer(renamer);
             }
             // both move and noop supports pre move
             if (preMoveExpression != null) {
-                GenericFileExpressionRenamer<ChannelSftp.LsEntry> renamer = 
new GenericFileExpressionRenamer<>();
+                GenericFileExpressionRenamer<SftpRemoteFile> renamer = new 
GenericFileExpressionRenamer<>();
                 renamer.setExpression(preMoveExpression);
                 strategy.setBeginRenamer(renamer);
             }
             return strategy;
         } else {
             // default strategy will do nothing
-            GenericFileNoOpProcessStrategy<ChannelSftp.LsEntry> strategy = new 
GenericFileNoOpProcessStrategy<>();
+            GenericFileNoOpProcessStrategy<SftpRemoteFile> strategy = new 
GenericFileNoOpProcessStrategy<>();
             
strategy.setExclusiveReadLockStrategy(getExclusiveReadLockStrategy(params));
             return strategy;
         }
     }
 
     @SuppressWarnings("unchecked")
-    private static GenericFileExclusiveReadLockStrategy<ChannelSftp.LsEntry> 
getExclusiveReadLockStrategy(Map<String, Object> params) {
-        GenericFileExclusiveReadLockStrategy<ChannelSftp.LsEntry> strategy = 
(GenericFileExclusiveReadLockStrategy<ChannelSftp.LsEntry>)params.get("exclusiveReadLockStrategy");
+    private static GenericFileExclusiveReadLockStrategy 
getExclusiveReadLockStrategy(Map<String, Object> params) {
+        GenericFileExclusiveReadLockStrategy strategy = 
(GenericFileExclusiveReadLockStrategy) params.get("exclusiveReadLockStrategy");
         if (strategy != null) {
             return strategy;
         }
@@ -104,7 +103,7 @@ public final class SftpProcessStrategyFactory {
             if ("none".equals(readLock) || "false".equals(readLock)) {
                 return null;
             } else if ("rename".equals(readLock)) {
-                
GenericFileRenameExclusiveReadLockStrategy<ChannelSftp.LsEntry> 
readLockStrategy = new GenericFileRenameExclusiveReadLockStrategy<>();
+                GenericFileRenameExclusiveReadLockStrategy<SftpRemoteFile> 
readLockStrategy = new GenericFileRenameExclusiveReadLockStrategy<>();
                 Long timeout = (Long)params.get("readLockTimeout");
                 if (timeout != null) {
                     readLockStrategy.setTimeout(timeout);
@@ -113,6 +112,10 @@ public final class SftpProcessStrategyFactory {
                 if (checkInterval != null) {
                     readLockStrategy.setCheckInterval(checkInterval);
                 }
+                Boolean readLockMarkerFile = 
(Boolean)params.get("readLockMarkerFile");
+                if (readLockMarkerFile != null) {
+                    readLockStrategy.setMarkerFiler(readLockMarkerFile);
+                }
                 LoggingLevel readLockLoggingLevel = 
(LoggingLevel)params.get("readLockLoggingLevel");
                 if (readLockLoggingLevel != null) {
                     
readLockStrategy.setReadLockLoggingLevel(readLockLoggingLevel);
@@ -140,6 +143,10 @@ public final class SftpProcessStrategyFactory {
                 if (fastExistsCheck != null) {
                     readLockStrategy.setFastExistsCheck(fastExistsCheck);
                 }
+                Boolean readLockMarkerFile = 
(Boolean)params.get("readLockMarkerFile");
+                if (readLockMarkerFile != null) {
+                    readLockStrategy.setMarkerFiler(readLockMarkerFile);
+                }
                 LoggingLevel readLockLoggingLevel = 
(LoggingLevel)params.get("readLockLoggingLevel");
                 if (readLockLoggingLevel != null) {
                     
readLockStrategy.setReadLockLoggingLevel(readLockLoggingLevel);
@@ -150,5 +157,4 @@ public final class SftpProcessStrategyFactory {
 
         return null;
     }
-
 }
diff --git 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileIgnoreDoPollErrorTest.java
 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileIgnoreDoPollErrorTest.java
index 345b9f8..68bde8c 100644
--- 
a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileIgnoreDoPollErrorTest.java
+++ 
b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/RemoteFileIgnoreDoPollErrorTest.java
@@ -24,6 +24,7 @@ import org.apache.camel.Message;
 import org.apache.camel.Processor;
 import org.apache.camel.component.file.GenericFile;
 import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.apache.camel.component.file.GenericFileProcessStrategy;
 import org.apache.camel.component.file.GenericFileProducer;
 import org.junit.jupiter.api.Test;
 
@@ -53,6 +54,11 @@ public class RemoteFileIgnoreDoPollErrorTest {
         public String getScheme() {
             return null;
         }
+
+        @Override
+        protected GenericFileProcessStrategy<Object> 
createGenericFileStrategy() {
+            return null;
+        }
     };
 
     @Test
diff --git 
a/core/camel-api/src/main/java/org/apache/camel/spi/FactoryFinder.java 
b/core/camel-api/src/main/java/org/apache/camel/spi/FactoryFinder.java
index 6e5e584..d832b8c 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/FactoryFinder.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/FactoryFinder.java
@@ -58,31 +58,11 @@ public interface FactoryFinder {
     Optional<Class<?>> findClass(String key);
 
     /**
-     * Finds the given factory class using the key to lookup.
-     *
-     * @param key is the key to add to the path to find a text file containing 
the factory name
-     * @param propertyPrefix prefix on key
-     * @return the factory class
-     */
-    Optional<Class<?>> findClass(String key, String propertyPrefix);
-
-    /**
-     * Finds the given factory class using the key to lookup.
-     *
-     * @param key is the key to add to the path to find a text file containing 
the factory name
-     * @param propertyPrefix prefix on key
-     * @param clazz the class which is used for checking compatible
-     * @return the factory class
-     */
-    Optional<Class<?>> findClass(String key, String propertyPrefix, Class<?> 
clazz);
-
-    /**
      * Finds the optional factory class using the key to lookup.
      *
      * @param key is the key to add to the path to find a text file containing 
the factory name
-     * @param propertyPrefix prefix on key
      * @return the factory class if found, or <tt>null</tt> if no class existed
      */
-    Optional<Class<?>> findOptionalClass(String key, String propertyPrefix);
+    Optional<Class<?>> findOptionalClass(String key);
 
 }
diff --git 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultFactoryFinder.java
 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultFactoryFinder.java
index 800f463..d1ecced 100644
--- 
a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultFactoryFinder.java
+++ 
b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultFactoryFinder.java
@@ -52,29 +52,23 @@ public class DefaultFactoryFinder implements FactoryFinder {
 
     @Override
     public Optional<Object> newInstance(String key) {
-        return Optional.ofNullable(doNewInstance(key, null));
+        return Optional.ofNullable(doNewInstance(key));
     }
 
     @Override
     public <T> Optional<T> newInstance(String key, Class<T> type) {
-        Object obj = doNewInstance(key, null);
+        Object obj = doNewInstance(key);
         return Optional.ofNullable(type.cast(obj));
     }
 
     @Override
     public Optional<Class<?>> findClass(String key) {
-        return findClass(key, null);
-    }
-
-    @Override
-    public Optional<Class<?>> findClass(String key, String propertyPrefix) {
-        final String prefix = propertyPrefix != null ? propertyPrefix : "";
-        final String classKey = prefix + key;
+        final String classKey = key;
 
         Class<?> clazz = addToClassMap(classKey, () -> {
             Properties prop = doFindFactoryProperties(key);
             if (prop != null) {
-                return doNewInstance(prop, prefix, true).orElse(null);
+                return doNewInstance(prop, true).orElse(null);
             } else {
                 return null;
             }
@@ -83,20 +77,13 @@ public class DefaultFactoryFinder implements FactoryFinder {
     }
 
     @Override
-    public Optional<Class<?>> findClass(String key, String propertyPrefix, 
Class<?> clazz) {
-        // Just ignore clazz which is only useful for OSGiFactoryFinder
-        return findClass(key, propertyPrefix);
-    }
-
-    @Override
-    public Optional<Class<?>> findOptionalClass(String key, String 
propertyPrefix) {
-        final String prefix = propertyPrefix != null ? propertyPrefix : "";
-        final String classKey = prefix + key;
+    public Optional<Class<?>> findOptionalClass(String key) {
+        final String classKey = key;
 
         Class<?> clazz = addToClassMap(classKey, () -> {
             Properties prop = doFindFactoryProperties(key);
             if (prop != null) {
-                return doNewInstance(prop, prefix, false).orElse(null);
+                return doNewInstance(prop, false).orElse(null);
             } else {
                 return null;
             }
@@ -104,15 +91,15 @@ public class DefaultFactoryFinder implements FactoryFinder 
{
         return Optional.ofNullable(clazz);
     }
 
-    private Object doNewInstance(String key, String propertyPrefix) {
-        Optional<Class<?>> clazz = findClass(key, propertyPrefix);
+    private Object doNewInstance(String key) {
+        Optional<Class<?>> clazz = findClass(key);
         return clazz.map(ObjectHelper::newInstance).orElse(null);
     }
 
-    private Optional<Class<?>> doNewInstance(Properties properties, String 
propertyPrefix, boolean mandatory) throws IOException {
-        String className = properties.getProperty(propertyPrefix + "class");
+    private Optional<Class<?>> doNewInstance(Properties properties, boolean 
mandatory) throws IOException {
+        String className = properties.getProperty("class");
         if (className == null && mandatory) {
-            throw new IOException("Expected property is missing: " + 
propertyPrefix + "class");
+            throw new IOException("Expected property is missing: class");
         } else if (className == null) {
             return Optional.empty();
         }
diff --git 
a/core/camel-core/src/test/java/org/apache/camel/impl/engine/DefaultFactoryFinderTest.java
 
b/core/camel-core/src/test/java/org/apache/camel/impl/engine/DefaultFactoryFinderTest.java
index adf198c..443b88b 100644
--- 
a/core/camel-core/src/test/java/org/apache/camel/impl/engine/DefaultFactoryFinderTest.java
+++ 
b/core/camel-core/src/test/java/org/apache/camel/impl/engine/DefaultFactoryFinderTest.java
@@ -60,7 +60,7 @@ public class DefaultFactoryFinderTest {
 
         final DefaultFactoryFinder factoryFinder = new 
DefaultFactoryFinder(classResolver, TEST_RESOURCE_PATH);
 
-        assertFalse(factoryFinder.findClass("TestImplA", null).isPresent());
+        assertFalse(factoryFinder.findClass("TestImplA").isPresent());
     }
 
     @Test
@@ -107,30 +107,6 @@ public class DefaultFactoryFinderTest {
         assertEquals(TestImplA.class, clazz);
     }
 
-    @Test
-    public void shouldFindSingleClassFromClassMap() throws 
ClassNotFoundException, IOException {
-        final DefaultFactoryFinder factoryFinder = new 
DefaultFactoryFinder(null, null);
-        factoryFinder.addToClassMap("prefixkey", () -> TestImplA.class);
-
-        final Class<?> clazz = factoryFinder.findClass("key", 
"prefix").orElse(null);
-
-        assertEquals(TestImplA.class, clazz);
-    }
-
-    @Test
-    public void shouldFindSingleClassWithPropertyPrefix() throws 
ClassNotFoundException, IOException {
-        final Class<?> clazz = factoryFinder.findClass("TestImplA", 
"prefix.").orElse(null);
-
-        assertEquals(TestImplA.class, clazz);
-    }
-
-    @Test
-    public void shouldFindSingleClassWithPropertyPrefixAndExpectedType() 
throws ClassNotFoundException, IOException {
-        final Class<?> clazz = factoryFinder.findClass("TestImplA", "prefix.", 
TestType.class).orElse(null);
-
-        assertEquals(TestImplA.class, clazz);
-    }
-
     URL urlFor(final Class<?> clazz) {
         final String resourceName = clazz.getPackage().getName().replace('.', 
'/') + "/" + clazz.getSimpleName() + ".properties";
         final ClassLoader classLoader = clazz.getClassLoader();
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpiGeneratorMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpiGeneratorMojo.java
index de40309..14c3c60 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpiGeneratorMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpiGeneratorMojo.java
@@ -33,7 +33,6 @@ import java.util.stream.Collectors;
 
 import org.apache.camel.spi.annotations.ConstantProvider;
 import org.apache.camel.spi.annotations.ServiceFactory;
-import org.apache.camel.spi.annotations.SubServiceFactory;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
@@ -53,7 +52,6 @@ import org.jboss.jandex.Indexer;
 public class SpiGeneratorMojo extends AbstractGeneratorMojo {
 
     public static final DotName SERVICE_FACTORY = 
DotName.createSimple(ServiceFactory.class.getName());
-    public static final DotName SUB_SERVICE_FACTORY = 
DotName.createSimple(SubServiceFactory.class.getName());
     public static final DotName CONSTANT_PROVIDER = 
DotName.createSimple(ConstantProvider.class.getName());
 
     @Parameter(defaultValue = "${project.build.outputDirectory}")
@@ -144,12 +142,6 @@ public class SpiGeneratorMojo extends 
AbstractGeneratorMojo {
                     } else {
                         StringBuilder sb = new StringBuilder();
                         sb.append("# " + GENERATED_MSG + NL + 
"class=").append(className).append(NL);
-                        for (AnnotationInstance ai : 
annotation.target().asClass().classAnnotations()) {
-                            AnnotationInstance ssf = 
index.getClassByName(ai.name()).classAnnotation(SUB_SERVICE_FACTORY);
-                            if (ssf != null) {
-                                
sb.append(ssf.value().asString()).append(".class=").append(ai.value().asString()).append(NL);
-                            }
-                        }
                         updateResource(resourcesOutputDir.toPath(),
                                 "META-INF/services/org/apache/camel/" + 
sfa.value().asString() + "/" + pval,
                                 sb.toString());
diff --git 
a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/SubServiceFactory.java
 
b/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/SubServiceFactory.java
deleted file mode 100644
index ec16498..0000000
--- 
a/tooling/spi-annotations/src/main/java/org/apache/camel/spi/annotations/SubServiceFactory.java
+++ /dev/null
@@ -1,32 +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.spi.annotations;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-@Target({ElementType.TYPE })
-public @interface SubServiceFactory {
-
-    String value();
-
-}

Reply via email to