This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 937aaf7608163bf0e1ec6826f76c502d0f504628 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Tue Mar 3 17:22:10 2020 +0100 Use @JdkService annotation to generate META-INF services files for FactoryFinder --- .../services/org/apache/camel/bean-processor-factory | 2 ++ .../services/org/apache/camel/bean-proxy-factory | 2 ++ .../component/bean/DefaultBeanProcessorFactory.java | 2 ++ .../camel/component/bean/DefaultBeanProxyFactory.java | 2 ++ .../services/org/apache/camel/bean-processor-factory | 18 ------------------ .../services/org/apache/camel/bean-proxy-factory | 18 ------------------ .../services/org/apache/camel/reactive-executor | 2 ++ .../camel/reactive/vertx/VertXReactiveExecutor.java | 2 ++ .../services/org/apache/camel/reactive-executor | 18 ------------------ .../camel/spring/spi/SpringTransactionPolicy.java | 2 -- .../org/apache/camel/spi/annotations/JdkService.java | 2 +- .../org/apache/camel/catalog/RuntimeCamelCatalog.java | 5 +++++ .../org/apache/camel/spi/BeanProcessorFactory.java | 5 +++++ .../java/org/apache/camel/spi/BeanProxyFactory.java | 5 +++++ .../java/org/apache/camel/spi/HeadersMapFactory.java | 7 ++++++- .../java/org/apache/camel/spi/ModelToXMLDumper.java | 5 +++++ .../java/org/apache/camel/spi/PropertiesComponent.java | 5 +++++ .../java/org/apache/camel/spi/ReactiveExecutor.java | 5 +++++ .../java/org/apache/camel/spi/RestRegistryFactory.java | 5 +++++ .../apache/camel/spi/XMLRoutesDefinitionLoader.java | 5 +++++ .../org/apache/camel/properties-component-factory | 2 ++ .../component/properties/PropertiesComponent.java | 2 ++ .../impl/engine/BeanProcessorFactoryResolver.java | 2 +- .../camel/impl/engine/BeanProxyFactoryResolver.java | 2 +- .../camel/impl/engine/HeadersMapFactoryResolver.java | 2 +- .../engine/PropertiesComponentFactoryResolver.java | 2 +- .../camel/impl/engine/ReactiveExecutorResolver.java | 2 +- .../camel/impl/engine/RestRegistryFactoryResolver.java | 2 +- .../camel/impl/engine/RuntimeCamelCatalogResolver.java | 2 +- .../org/apache/camel/properties-component-factory | 18 ------------------ .../services/org/apache/camel/runtime-camelcatalog | 2 ++ .../camel/catalog/impl/DefaultRuntimeCamelCatalog.java | 2 ++ .../services/org/apache/camel/runtime-camelcatalog | 18 ------------------ .../apache/camel/impl/ModelToXMLDumperResolver.java | 2 +- .../camel/impl/XMLRoutesDefinitionLoaderResolver.java | 2 +- .../services/org/apache/camel/headers-map-factory | 2 ++ .../component/headersmap/FastHeadersMapFactory.java | 2 ++ .../services/org/apache/camel/headers-map-factory | 18 ------------------ .../services/org/apache/camel/xmlroutes-loader | 2 ++ .../xml/in/ModelParserXMLRoutesDefinitionLoader.java | 2 ++ .../services/org/apache/camel/xmlroutes-loader | 18 ------------------ .../META-INF/services/org/apache/camel/modelxml-dumper | 2 ++ .../services/org/apache/camel/xmlroutes-loader | 2 ++ .../apache/camel/xml/jaxb/JaxbModelToXMLDumper.java | 2 ++ .../camel/xml/jaxb/JaxbXMLRoutesDefinitionLoader.java | 2 ++ .../META-INF/services/org/apache/camel/modelxml-dumper | 18 ------------------ .../services/org/apache/camel/xmlroutes-loader | 18 ------------------ .../apache/camel/maven/packaging/SpiGeneratorMojo.java | 2 +- 48 files changed, 93 insertions(+), 176 deletions(-) diff --git a/components/camel-bean/src/generated/resources/META-INF/services/org/apache/camel/bean-processor-factory b/components/camel-bean/src/generated/resources/META-INF/services/org/apache/camel/bean-processor-factory new file mode 100644 index 0000000..42c40f5 --- /dev/null +++ b/components/camel-bean/src/generated/resources/META-INF/services/org/apache/camel/bean-processor-factory @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.bean.DefaultBeanProcessorFactory diff --git a/components/camel-bean/src/generated/resources/META-INF/services/org/apache/camel/bean-proxy-factory b/components/camel-bean/src/generated/resources/META-INF/services/org/apache/camel/bean-proxy-factory new file mode 100644 index 0000000..f8a9acd --- /dev/null +++ b/components/camel-bean/src/generated/resources/META-INF/services/org/apache/camel/bean-proxy-factory @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.bean.DefaultBeanProxyFactory diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/DefaultBeanProcessorFactory.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/DefaultBeanProcessorFactory.java index f5748bd..a56edc2 100644 --- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/DefaultBeanProcessorFactory.java +++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/DefaultBeanProcessorFactory.java @@ -23,11 +23,13 @@ import org.apache.camel.CamelContext; import org.apache.camel.Processor; import org.apache.camel.RuntimeCamelException; import org.apache.camel.spi.BeanProcessorFactory; +import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.support.CamelContextHelper; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@JdkService(BeanProcessorFactory.FACTORY) public final class DefaultBeanProcessorFactory implements BeanProcessorFactory { private static final Logger LOG = LoggerFactory.getLogger(DefaultBeanProcessorFactory.class); diff --git a/components/camel-bean/src/main/java/org/apache/camel/component/bean/DefaultBeanProxyFactory.java b/components/camel-bean/src/main/java/org/apache/camel/component/bean/DefaultBeanProxyFactory.java index b2eeaa6..d88ed0c 100644 --- a/components/camel-bean/src/main/java/org/apache/camel/component/bean/DefaultBeanProxyFactory.java +++ b/components/camel-bean/src/main/java/org/apache/camel/component/bean/DefaultBeanProxyFactory.java @@ -18,7 +18,9 @@ package org.apache.camel.component.bean; import org.apache.camel.Endpoint; import org.apache.camel.spi.BeanProxyFactory; +import org.apache.camel.spi.annotations.JdkService; +@JdkService(BeanProxyFactory.FACTORY) public final class DefaultBeanProxyFactory implements BeanProxyFactory { public DefaultBeanProxyFactory() { diff --git a/components/camel-bean/src/main/resources/META-INF/services/org/apache/camel/bean-processor-factory b/components/camel-bean/src/main/resources/META-INF/services/org/apache/camel/bean-processor-factory deleted file mode 100644 index 289a548..0000000 --- a/components/camel-bean/src/main/resources/META-INF/services/org/apache/camel/bean-processor-factory +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.component.bean.DefaultBeanProcessorFactory diff --git a/components/camel-bean/src/main/resources/META-INF/services/org/apache/camel/bean-proxy-factory b/components/camel-bean/src/main/resources/META-INF/services/org/apache/camel/bean-proxy-factory deleted file mode 100644 index 58e2e9a..0000000 --- a/components/camel-bean/src/main/resources/META-INF/services/org/apache/camel/bean-proxy-factory +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.component.bean.DefaultBeanProxyFactory diff --git a/components/camel-reactive-executor-vertx/src/generated/resources/META-INF/services/org/apache/camel/reactive-executor b/components/camel-reactive-executor-vertx/src/generated/resources/META-INF/services/org/apache/camel/reactive-executor new file mode 100644 index 0000000..1e1e324 --- /dev/null +++ b/components/camel-reactive-executor-vertx/src/generated/resources/META-INF/services/org/apache/camel/reactive-executor @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.reactive.vertx.VertXReactiveExecutor diff --git a/components/camel-reactive-executor-vertx/src/main/java/org/apache/camel/reactive/vertx/VertXReactiveExecutor.java b/components/camel-reactive-executor-vertx/src/main/java/org/apache/camel/reactive/vertx/VertXReactiveExecutor.java index bdaac55..9fe72ec 100644 --- a/components/camel-reactive-executor-vertx/src/main/java/org/apache/camel/reactive/vertx/VertXReactiveExecutor.java +++ b/components/camel-reactive-executor-vertx/src/main/java/org/apache/camel/reactive/vertx/VertXReactiveExecutor.java @@ -20,6 +20,7 @@ import io.vertx.core.Vertx; import org.apache.camel.Experimental; import org.apache.camel.StaticService; import org.apache.camel.spi.ReactiveExecutor; +import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.support.service.ServiceSupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,6 +31,7 @@ import org.slf4j.LoggerFactory; * NOTE: This is an experimental implementation (use with care) */ @Experimental +@JdkService(ReactiveExecutor.FACTORY) public class VertXReactiveExecutor extends ServiceSupport implements ReactiveExecutor, StaticService { private static final Logger LOG = LoggerFactory.getLogger(VertXReactiveExecutor.class); diff --git a/components/camel-reactive-executor-vertx/src/main/resources/META-INF/services/org/apache/camel/reactive-executor b/components/camel-reactive-executor-vertx/src/main/resources/META-INF/services/org/apache/camel/reactive-executor deleted file mode 100644 index 554c5d6..0000000 --- a/components/camel-reactive-executor-vertx/src/main/resources/META-INF/services/org/apache/camel/reactive-executor +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.reactive.vertx.VertXReactiveExecutor diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java index 4681af6..1226359 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/spi/SpringTransactionPolicy.java @@ -25,7 +25,6 @@ import org.apache.camel.model.RouteDefinition; import org.apache.camel.reifier.errorhandler.ErrorHandlerReifier; import org.apache.camel.Route; import org.apache.camel.spi.TransactedPolicy; -import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.util.ObjectHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,7 +34,6 @@ import org.springframework.transaction.support.TransactionTemplate; /** * Wraps the processor in a Spring transaction */ -@JdkService(TransactedPolicy.class) public class SpringTransactionPolicy implements TransactedPolicy { private static final Logger LOG = LoggerFactory.getLogger(SpringTransactionPolicy.class); private TransactionTemplate template; diff --git a/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/JdkService.java b/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/JdkService.java index 35f9489..f26b68f 100644 --- a/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/JdkService.java +++ b/core/camel-api/src/generated/java/org/apache/camel/spi/annotations/JdkService.java @@ -28,6 +28,6 @@ import java.lang.annotation.Target; @ServiceFactory(ServiceFactory.JDK_SERVICE) public @interface JdkService { - Class value(); + String value(); } diff --git a/core/camel-api/src/main/java/org/apache/camel/catalog/RuntimeCamelCatalog.java b/core/camel-api/src/main/java/org/apache/camel/catalog/RuntimeCamelCatalog.java index cfc23e6..5a29b86 100644 --- a/core/camel-api/src/main/java/org/apache/camel/catalog/RuntimeCamelCatalog.java +++ b/core/camel-api/src/main/java/org/apache/camel/catalog/RuntimeCamelCatalog.java @@ -31,6 +31,11 @@ import org.apache.camel.spi.SendDynamicAware; public interface RuntimeCamelCatalog extends StaticService, CamelContextAware { /** + * Service factory key. + */ + String FACTORY = "runtime-camelcatalog"; + + /** * Returns the component information as JSon format. * <p/> * This API is needed by {@link ComponentVerifierExtension}. diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/BeanProcessorFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/BeanProcessorFactory.java index 256d1ae..f453785 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/BeanProcessorFactory.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/BeanProcessorFactory.java @@ -31,6 +31,11 @@ import org.apache.camel.Processor; public interface BeanProcessorFactory { /** + * Service factory key. + */ + String FACTORY = "bean-processor-factory"; + + /** * Creates the bean processor from the existing bean instance * * @param camelContext the camel context diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/BeanProxyFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/BeanProxyFactory.java index 2878ef0..4feb071 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/BeanProxyFactory.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/BeanProxyFactory.java @@ -26,6 +26,11 @@ import org.apache.camel.Endpoint; public interface BeanProxyFactory { /** + * Service factory key. + */ + String FACTORY = "bean-proxy-factory"; + + /** * Creates a proxy bean facaded with the interfaces that when invoked will send the data as a message to a Camel endpoint. * * @param endpoint the endpoint to send to when the proxy is invoked diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/HeadersMapFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/HeadersMapFactory.java index b3f52ec..025abcf 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/HeadersMapFactory.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/HeadersMapFactory.java @@ -23,11 +23,16 @@ import org.apache.camel.Message; /** * Factory to create the {@link Map} implementation to use for storing headers on {@link Message}. * - * @see org.apache.camel.impl.DefaultHeadersMapFactory + * @see org.apache.camel.impl.engine.DefaultHeadersMapFactory */ public interface HeadersMapFactory { /** + * Service factory key. + */ + String FACTORY = "headers-map-factory"; + + /** * Creates a new empty {@link Map} * * @return new empty map diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ModelToXMLDumper.java b/core/camel-api/src/main/java/org/apache/camel/spi/ModelToXMLDumper.java index ff7ffc6..40f383d 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/ModelToXMLDumper.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/ModelToXMLDumper.java @@ -25,6 +25,11 @@ import org.apache.camel.NamedNode; public interface ModelToXMLDumper { /** + * Service factory key. + */ + String FACTORY = "modelxml-dumper"; + + /** * Dumps the definition as XML * * @param context the CamelContext diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesComponent.java b/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesComponent.java index 72ec892..ff73a77 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesComponent.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/PropertiesComponent.java @@ -30,6 +30,11 @@ import org.apache.camel.StaticService; public interface PropertiesComponent extends StaticService { /** + * Service factory key. + */ + String FACTORY = "properties-component-factory"; + + /** * The prefix token. */ String PREFIX_TOKEN = "{{"; diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ReactiveExecutor.java b/core/camel-api/src/main/java/org/apache/camel/spi/ReactiveExecutor.java index 56630ea..3de9d65 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/ReactiveExecutor.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/ReactiveExecutor.java @@ -22,6 +22,11 @@ package org.apache.camel.spi; public interface ReactiveExecutor { /** + * Service factory key. + */ + String FACTORY = "reactive-executor"; + + /** * Schedules the task to be run * * @param runnable the task diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/RestRegistryFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/RestRegistryFactory.java index 1f12319..bdebd28 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/RestRegistryFactory.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/RestRegistryFactory.java @@ -22,6 +22,11 @@ package org.apache.camel.spi; public interface RestRegistryFactory { /** + * Service factory key. + */ + String FACTORY = "rest-registry-factory"; + + /** * Create a new {@link RestRegistry}. */ RestRegistry createRegistry(); diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/XMLRoutesDefinitionLoader.java b/core/camel-api/src/main/java/org/apache/camel/spi/XMLRoutesDefinitionLoader.java index 2a3a741..bc01a2d 100644 --- a/core/camel-api/src/main/java/org/apache/camel/spi/XMLRoutesDefinitionLoader.java +++ b/core/camel-api/src/main/java/org/apache/camel/spi/XMLRoutesDefinitionLoader.java @@ -28,6 +28,11 @@ import org.apache.camel.NamedNode; public interface XMLRoutesDefinitionLoader { /** + * Service factory key. + */ + String FACTORY = "xmlroutes-loader"; + + /** * Loads from XML into routes. */ Object loadRoutesDefinition(CamelContext context, InputStream inputStream) throws Exception; diff --git a/core/camel-base/src/generated/resources/META-INF/services/org/apache/camel/properties-component-factory b/core/camel-base/src/generated/resources/META-INF/services/org/apache/camel/properties-component-factory new file mode 100644 index 0000000..106f5da --- /dev/null +++ b/core/camel-base/src/generated/resources/META-INF/services/org/apache/camel/properties-component-factory @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.properties.PropertiesComponent diff --git a/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java b/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java index c971694..a3c50db 100644 --- a/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java +++ b/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java @@ -37,6 +37,7 @@ import org.apache.camel.api.management.ManagedResource; import org.apache.camel.spi.FactoryFinder; import org.apache.camel.spi.LoadablePropertiesSource; import org.apache.camel.spi.PropertiesSource; +import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.support.OrderedComparator; import org.apache.camel.support.service.ServiceHelper; import org.apache.camel.support.service.ServiceSupport; @@ -50,6 +51,7 @@ import org.slf4j.LoggerFactory; * The properties component allows you to use property placeholders in Camel. */ @ManagedResource(description = "Managed PropertiesComponent") +@JdkService(org.apache.camel.spi.PropertiesComponent.FACTORY) public class PropertiesComponent extends ServiceSupport implements org.apache.camel.spi.PropertiesComponent, StaticService, CamelContextAware { /** diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/BeanProcessorFactoryResolver.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/BeanProcessorFactoryResolver.java index f0e1c91..df2945d 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/BeanProcessorFactoryResolver.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/BeanProcessorFactoryResolver.java @@ -40,7 +40,7 @@ public class BeanProcessorFactoryResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("bean-processor-factory", context); + type = findFactory(BeanProcessorFactory.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/BeanProxyFactoryResolver.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/BeanProxyFactoryResolver.java index 6fda9ed..78a9a98 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/BeanProxyFactoryResolver.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/BeanProxyFactoryResolver.java @@ -40,7 +40,7 @@ public class BeanProxyFactoryResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("bean-proxy-factory", context); + type = findFactory(BeanProxyFactory.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/HeadersMapFactoryResolver.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/HeadersMapFactoryResolver.java index 116077d..a2059bb 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/HeadersMapFactoryResolver.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/HeadersMapFactoryResolver.java @@ -42,7 +42,7 @@ public class HeadersMapFactoryResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("headers-map-factory", context); + type = findFactory(HeadersMapFactory.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/PropertiesComponentFactoryResolver.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/PropertiesComponentFactoryResolver.java index e9beb5b..1da4e68 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/PropertiesComponentFactoryResolver.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/PropertiesComponentFactoryResolver.java @@ -40,7 +40,7 @@ public class PropertiesComponentFactoryResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("properties-component-factory", context); + type = findFactory(PropertiesComponent.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/ReactiveExecutorResolver.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/ReactiveExecutorResolver.java index c26bda1..563c803 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/ReactiveExecutorResolver.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/ReactiveExecutorResolver.java @@ -40,7 +40,7 @@ public class ReactiveExecutorResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("reactive-executor", context); + type = findFactory(ReactiveExecutor.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/RestRegistryFactoryResolver.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/RestRegistryFactoryResolver.java index 162f9e5..2726bca 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/RestRegistryFactoryResolver.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/RestRegistryFactoryResolver.java @@ -42,7 +42,7 @@ public class RestRegistryFactoryResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("rest-registry-factory", context); + type = findFactory(RestRegistryFactory.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/RuntimeCamelCatalogResolver.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/RuntimeCamelCatalogResolver.java index afd1ba3..8c97cf0 100644 --- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/RuntimeCamelCatalogResolver.java +++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/RuntimeCamelCatalogResolver.java @@ -42,7 +42,7 @@ public class RuntimeCamelCatalogResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("runtime-camelcatalog", context); + type = findFactory(RuntimeCamelCatalog.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-base/src/main/resources/META-INF/services/org/apache/camel/properties-component-factory b/core/camel-base/src/main/resources/META-INF/services/org/apache/camel/properties-component-factory deleted file mode 100644 index 9f34c8f..0000000 --- a/core/camel-base/src/main/resources/META-INF/services/org/apache/camel/properties-component-factory +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.component.properties.PropertiesComponent diff --git a/core/camel-core-catalog/src/generated/resources/META-INF/services/org/apache/camel/runtime-camelcatalog b/core/camel-core-catalog/src/generated/resources/META-INF/services/org/apache/camel/runtime-camelcatalog new file mode 100644 index 0000000..9cc33e0 --- /dev/null +++ b/core/camel-core-catalog/src/generated/resources/META-INF/services/org/apache/camel/runtime-camelcatalog @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.catalog.impl.DefaultRuntimeCamelCatalog diff --git a/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/DefaultRuntimeCamelCatalog.java b/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/DefaultRuntimeCamelCatalog.java index 3c7e904..89c821f 100644 --- a/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/DefaultRuntimeCamelCatalog.java +++ b/core/camel-core-catalog/src/main/java/org/apache/camel/catalog/impl/DefaultRuntimeCamelCatalog.java @@ -22,6 +22,7 @@ import java.util.function.Function; import org.apache.camel.CamelContext; import org.apache.camel.catalog.RuntimeCamelCatalog; +import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.tooling.model.ComponentModel; import org.apache.camel.tooling.model.DataFormatModel; import org.apache.camel.tooling.model.EipModel; @@ -32,6 +33,7 @@ import org.apache.camel.tooling.model.OtherModel; /** * Default {@link RuntimeCamelCatalog}. */ +@JdkService(RuntimeCamelCatalog.FACTORY) public class DefaultRuntimeCamelCatalog extends AbstractCamelCatalog implements RuntimeCamelCatalog { private CamelContext camelContext; diff --git a/core/camel-core-catalog/src/main/resources/META-INF/services/org/apache/camel/runtime-camelcatalog b/core/camel-core-catalog/src/main/resources/META-INF/services/org/apache/camel/runtime-camelcatalog deleted file mode 100644 index 7cf9492..0000000 --- a/core/camel-core-catalog/src/main/resources/META-INF/services/org/apache/camel/runtime-camelcatalog +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.catalog.impl.DefaultRuntimeCamelCatalog diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/ModelToXMLDumperResolver.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/ModelToXMLDumperResolver.java index 6441a1c..57ac62f 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/ModelToXMLDumperResolver.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/ModelToXMLDumperResolver.java @@ -43,7 +43,7 @@ public class ModelToXMLDumperResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("modelxml-dumper", context); + type = findFactory(ModelToXMLDumper.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/XMLRoutesDefinitionLoaderResolver.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/XMLRoutesDefinitionLoaderResolver.java index 822be8c..000c7cb 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/XMLRoutesDefinitionLoaderResolver.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/XMLRoutesDefinitionLoaderResolver.java @@ -44,7 +44,7 @@ public class XMLRoutesDefinitionLoaderResolver { // use factory finder to find a custom implementations Class<?> type = null; try { - type = findFactory("xmlroutes-loader", context); + type = findFactory(XMLRoutesDefinitionLoader.FACTORY, context); } catch (Exception e) { // ignore } diff --git a/core/camel-headersmap/src/generated/resources/META-INF/services/org/apache/camel/headers-map-factory b/core/camel-headersmap/src/generated/resources/META-INF/services/org/apache/camel/headers-map-factory new file mode 100644 index 0000000..8acf6f8 --- /dev/null +++ b/core/camel-headersmap/src/generated/resources/META-INF/services/org/apache/camel/headers-map-factory @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.component.headersmap.FastHeadersMapFactory diff --git a/core/camel-headersmap/src/main/java/org/apache/camel/component/headersmap/FastHeadersMapFactory.java b/core/camel-headersmap/src/main/java/org/apache/camel/component/headersmap/FastHeadersMapFactory.java index b71ec3e..57ce38a2 100644 --- a/core/camel-headersmap/src/main/java/org/apache/camel/component/headersmap/FastHeadersMapFactory.java +++ b/core/camel-headersmap/src/main/java/org/apache/camel/component/headersmap/FastHeadersMapFactory.java @@ -20,10 +20,12 @@ import java.util.Map; import com.cedarsoftware.util.CaseInsensitiveMap; import org.apache.camel.spi.HeadersMapFactory; +import org.apache.camel.spi.annotations.JdkService; /** * A faster {@link HeadersMapFactory} which is using the {@link com.cedarsoftware.util.CaseInsensitiveMap} map implementation. */ +@JdkService(HeadersMapFactory.FACTORY) public class FastHeadersMapFactory implements HeadersMapFactory { @Override diff --git a/core/camel-headersmap/src/main/resources/META-INF/services/org/apache/camel/headers-map-factory b/core/camel-headersmap/src/main/resources/META-INF/services/org/apache/camel/headers-map-factory deleted file mode 100644 index 1526408..0000000 --- a/core/camel-headersmap/src/main/resources/META-INF/services/org/apache/camel/headers-map-factory +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.component.headersmap.FastHeadersMapFactory diff --git a/core/camel-xml-io/src/generated/resources/META-INF/services/org/apache/camel/xmlroutes-loader b/core/camel-xml-io/src/generated/resources/META-INF/services/org/apache/camel/xmlroutes-loader new file mode 100644 index 0000000..bfd59e0 --- /dev/null +++ b/core/camel-xml-io/src/generated/resources/META-INF/services/org/apache/camel/xmlroutes-loader @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.xml.in.ModelParserXMLRoutesDefinitionLoader diff --git a/core/camel-xml-io/src/main/java/org/apache/camel/xml/in/ModelParserXMLRoutesDefinitionLoader.java b/core/camel-xml-io/src/main/java/org/apache/camel/xml/in/ModelParserXMLRoutesDefinitionLoader.java index e166c52..037300c 100644 --- a/core/camel-xml-io/src/main/java/org/apache/camel/xml/in/ModelParserXMLRoutesDefinitionLoader.java +++ b/core/camel-xml-io/src/main/java/org/apache/camel/xml/in/ModelParserXMLRoutesDefinitionLoader.java @@ -21,11 +21,13 @@ import java.io.InputStream; import org.apache.camel.CamelContext; import org.apache.camel.NamedNode; import org.apache.camel.spi.XMLRoutesDefinitionLoader; +import org.apache.camel.spi.annotations.JdkService; /** * {@link XMLRoutesDefinitionLoader} that uses {@link ModelParser} to load and parse the routes from XML * which is fast and light-weight compared to the default that uses JAXB. */ +@JdkService(XMLRoutesDefinitionLoader.FACTORY) public class ModelParserXMLRoutesDefinitionLoader implements XMLRoutesDefinitionLoader { public static final String NAMESPACE = "http://camel.apache.org/schema/spring"; diff --git a/core/camel-xml-io/src/main/resources/META-INF/services/org/apache/camel/xmlroutes-loader b/core/camel-xml-io/src/main/resources/META-INF/services/org/apache/camel/xmlroutes-loader deleted file mode 100644 index 9ef5255..0000000 --- a/core/camel-xml-io/src/main/resources/META-INF/services/org/apache/camel/xmlroutes-loader +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.xml.in.ModelParserXMLRoutesDefinitionLoader diff --git a/core/camel-xml-jaxb/src/generated/resources/META-INF/services/org/apache/camel/modelxml-dumper b/core/camel-xml-jaxb/src/generated/resources/META-INF/services/org/apache/camel/modelxml-dumper new file mode 100644 index 0000000..1285809 --- /dev/null +++ b/core/camel-xml-jaxb/src/generated/resources/META-INF/services/org/apache/camel/modelxml-dumper @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.xml.jaxb.JaxbModelToXMLDumper diff --git a/core/camel-xml-jaxb/src/generated/resources/META-INF/services/org/apache/camel/xmlroutes-loader b/core/camel-xml-jaxb/src/generated/resources/META-INF/services/org/apache/camel/xmlroutes-loader new file mode 100644 index 0000000..f0e0768 --- /dev/null +++ b/core/camel-xml-jaxb/src/generated/resources/META-INF/services/org/apache/camel/xmlroutes-loader @@ -0,0 +1,2 @@ +# Generated by camel build tools - do NOT edit this file! +class=org.apache.camel.xml.jaxb.JaxbXMLRoutesDefinitionLoader diff --git a/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java b/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java index 921c8a2..95fafa0 100644 --- a/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java +++ b/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java @@ -55,6 +55,7 @@ import org.apache.camel.spi.ModelJAXBContextFactory; import org.apache.camel.spi.ModelToXMLDumper; import org.apache.camel.spi.NamespaceAware; import org.apache.camel.spi.TypeConverterRegistry; +import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.util.xml.XmlLineNumberParser; import static org.apache.camel.model.ProcessorDefinitionHelper.filterTypeInOutputs; @@ -62,6 +63,7 @@ import static org.apache.camel.model.ProcessorDefinitionHelper.filterTypeInOutpu /** * JAXB based {@link ModelToXMLDumper}. */ +@JdkService(ModelToXMLDumper.FACTORY) public class JaxbModelToXMLDumper implements ModelToXMLDumper { @Override diff --git a/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbXMLRoutesDefinitionLoader.java b/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbXMLRoutesDefinitionLoader.java index 45c7c07..ab5e84b 100644 --- a/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbXMLRoutesDefinitionLoader.java +++ b/core/camel-xml-jaxb/src/main/java/org/apache/camel/xml/jaxb/JaxbXMLRoutesDefinitionLoader.java @@ -48,6 +48,7 @@ import org.apache.camel.spi.ModelJAXBContextFactory; import org.apache.camel.spi.NamespaceAware; import org.apache.camel.spi.TypeConverterRegistry; import org.apache.camel.spi.XMLRoutesDefinitionLoader; +import org.apache.camel.spi.annotations.JdkService; import org.apache.camel.util.ObjectHelper; import static org.apache.camel.model.ProcessorDefinitionHelper.filterTypeInOutputs; @@ -56,6 +57,7 @@ import static org.apache.camel.model.ProcessorDefinitionHelper.filterTypeInOutpu * JAXB based {@link XMLRoutesDefinitionLoader}. This is the default loader used historically by Camel. * The camel-xml-io parser is a light-weight alternative. */ +@JdkService(XMLRoutesDefinitionLoader.FACTORY) public class JaxbXMLRoutesDefinitionLoader implements XMLRoutesDefinitionLoader { @Override diff --git a/core/camel-xml-jaxb/src/main/resources/META-INF/services/org/apache/camel/modelxml-dumper b/core/camel-xml-jaxb/src/main/resources/META-INF/services/org/apache/camel/modelxml-dumper deleted file mode 100644 index b654d72..0000000 --- a/core/camel-xml-jaxb/src/main/resources/META-INF/services/org/apache/camel/modelxml-dumper +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.xml.jaxb.JaxbModelToXMLDumper diff --git a/core/camel-xml-jaxb/src/main/resources/META-INF/services/org/apache/camel/xmlroutes-loader b/core/camel-xml-jaxb/src/main/resources/META-INF/services/org/apache/camel/xmlroutes-loader deleted file mode 100644 index 47af26b..0000000 --- a/core/camel-xml-jaxb/src/main/resources/META-INF/services/org/apache/camel/xmlroutes-loader +++ /dev/null @@ -1,18 +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. -# - -class=org.apache.camel.xml.jaxb.JaxbXMLRoutesDefinitionLoader 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 f59317e..4da6d7e 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 @@ -142,7 +142,7 @@ public class SpiGeneratorMojo extends AbstractGeneratorMojo { for (String pval : pvals.split(",")) { if (ServiceFactory.JDK_SERVICE.equals(sfa.value().asString())) { updateResource(resourcesOutputDir.toPath(), - "META-INF/services/" + pval.replace('.', '/'), + "META-INF/services/org/apache/camel/" + pval, "# " + GENERATED_MSG + NL + "class=" + className + NL); } else { StringBuilder sb = new StringBuilder();