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 4e9acc81442017bd74cbe70b49a5c696df894409 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Wed Aug 26 14:34:54 2020 +0200 CAMEL-15439: configurer: use full qualified class name instead of simple class name in meta-inf marker file --- .../camel/component/hystrix/processor/HystrixReifier.java | 2 +- .../microprofile/faulttolerance/FaultToleranceReifier.java | 2 +- .../org/apache/camel/component/olingo2/Olingo2Endpoint.java | 2 +- .../org/apache/camel/component/olingo4/Olingo4Endpoint.java | 2 +- .../camel/component/resilience4j/ResilienceReifier.java | 2 +- .../src/main/java/org/apache/camel/main/BaseMainSupport.java | 12 ++++++------ .../org/apache/camel/support/PropertyBindingSupport.java | 10 +++++----- .../org/apache/camel/support/PropertyConfigurerHelper.java | 2 +- .../apache/camel/support/component/AbstractApiComponent.java | 4 ++-- .../camel/support/component/ApiMethodPropertiesHelper.java | 6 +++--- .../maven/packaging/AbstractGenerateConfigurerMojo.java | 3 ++- 11 files changed, 24 insertions(+), 23 deletions(-) diff --git a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixReifier.java b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixReifier.java index a1f635e..5c368cb 100644 --- a/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixReifier.java +++ b/components/camel-hystrix/src/main/java/org/apache/camel/component/hystrix/processor/HystrixReifier.java @@ -229,7 +229,7 @@ public class HystrixReifier extends ProcessorReifier<CircuitBreakerDefinition> { final PropertyConfigurer configurer = camelContext.adapt(ExtendedCamelContext.class) .getConfigurerResolver() - .resolvePropertyConfigurer(HystrixConfigurationDefinition.class.getSimpleName(), camelContext); + .resolvePropertyConfigurer(HystrixConfigurationDefinition.class.getName(), camelContext); // Extract properties from default configuration, the one configured on // camel context takes the precedence over those in the registry diff --git a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java b/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java index 1339113..7ba46a9 100644 --- a/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java +++ b/components/camel-microprofile-fault-tolerance/src/main/java/org/apache/camel/component/microprofile/faulttolerance/FaultToleranceReifier.java @@ -135,7 +135,7 @@ public class FaultToleranceReifier extends ProcessorReifier<CircuitBreakerDefini final PropertyConfigurer configurer = camelContext.adapt(ExtendedCamelContext.class) .getConfigurerResolver() - .resolvePropertyConfigurer(FaultToleranceConfigurationDefinition.class.getSimpleName(), camelContext); + .resolvePropertyConfigurer(FaultToleranceConfigurationDefinition.class.getName(), camelContext); // Extract properties from default configuration, the one configured on // camel context takes the precedence over those in the registry diff --git a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java index 502fa38..8b116a5 100644 --- a/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java +++ b/components/camel-olingo2/camel-olingo2-component/src/main/java/org/apache/camel/component/olingo2/Olingo2Endpoint.java @@ -137,7 +137,7 @@ public class Olingo2Endpoint extends AbstractApiEndpoint<Olingo2ApiName, Olingo2 } // configure on configuration first to be reflection free configurer = getCamelContext().adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(configuration.getClass().getSimpleName(), getCamelContext()); + .resolvePropertyConfigurer(configuration.getClass().getName(), getCamelContext()); if (configurer != null) { PropertyBindingSupport.build() .withConfigurer(configurer) diff --git a/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Endpoint.java b/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Endpoint.java index 412cde8..046c2c4 100644 --- a/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Endpoint.java +++ b/components/camel-olingo4/camel-olingo4-component/src/main/java/org/apache/camel/component/olingo4/Olingo4Endpoint.java @@ -137,7 +137,7 @@ public class Olingo4Endpoint extends AbstractApiEndpoint<Olingo4ApiName, Olingo4 } // configure on configuration first to be reflection free configurer = getCamelContext().adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(configuration.getClass().getSimpleName(), getCamelContext()); + .resolvePropertyConfigurer(configuration.getClass().getName(), getCamelContext()); if (configurer != null) { PropertyBindingSupport.build() .withConfigurer(configurer) diff --git a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java index a7a7552..01059b7 100644 --- a/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java +++ b/components/camel-resilience4j/src/main/java/org/apache/camel/component/resilience4j/ResilienceReifier.java @@ -167,7 +167,7 @@ public class ResilienceReifier extends ProcessorReifier<CircuitBreakerDefinition final PropertyConfigurer configurer = camelContext.adapt(ExtendedCamelContext.class) .getConfigurerResolver() - .resolvePropertyConfigurer(Resilience4jConfigurationDefinition.class.getSimpleName(), camelContext); + .resolvePropertyConfigurer(Resilience4jConfigurationDefinition.class.getName(), camelContext); // Extract properties from default configuration, the one configured on // camel context takes the precedence over those in the registry diff --git a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java index 2660558..04625ef 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/BaseMainSupport.java @@ -129,10 +129,10 @@ public abstract class BaseMainSupport extends BaseService { targetConfigurer = ((Component) target).getComponentPropertyConfigurer(); } if (targetConfigurer == null) { - String name = target.getClass().getSimpleName(); + String name = target.getClass().getName(); if (target instanceof ExtendedCamelContext) { // special for camel context itself as we have an extended configurer - name = "ExtendedCamelContext"; + name = ExtendedCamelContext.class.getName(); } // see if there is a configurer for it targetConfigurer = context.adapt(ExtendedCamelContext.class) @@ -146,10 +146,10 @@ public abstract class BaseMainSupport extends BaseService { sourceConfigurer = ((Component) source).getComponentPropertyConfigurer(); } if (sourceConfigurer == null) { - String name = source.getClass().getSimpleName(); + String name = source.getClass().getName(); if (source instanceof ExtendedCamelContext) { // special for camel context itself as we have an extended configurer - name = "ExtendedCamelContext"; + name = ExtendedCamelContext.class.getName(); } // see if there is a configurer for it sourceConfigurer = context.adapt(ExtendedCamelContext.class) @@ -186,10 +186,10 @@ public abstract class BaseMainSupport extends BaseService { } if (configurer == null) { - String name = target.getClass().getSimpleName(); + String name = target.getClass().getName(); if (target instanceof ExtendedCamelContext) { // special for camel context itself as we have an extended configurer - name = "ExtendedCamelContext"; + name = ExtendedCamelContext.class.getName(); } // see if there is a configurer for it diff --git a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java index 2332f1e..fc896bc 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java @@ -399,10 +399,10 @@ public final class PropertyBindingSupport { configurer = ((Component) target).getComponentPropertyConfigurer(); } if (configurer == null) { - String name = target.getClass().getSimpleName(); + String name = target.getClass().getName(); if (target instanceof ExtendedCamelContext) { // special for camel context itself as we have an extended configurer - name = "ExtendedCamelContext"; + name = ExtendedCamelContext.class.getName(); } if (isNotEmpty(name)) { @@ -799,7 +799,7 @@ public final class PropertyBindingSupport { if (configurer == null) { // do we have a configurer by any chance configurer = camelContext.adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(newClass.getSimpleName(), camelContext); + .resolvePropertyConfigurer(newClass.getName(), camelContext); } // we should only walk and create OGNL path for the middle graph @@ -863,10 +863,10 @@ public final class PropertyBindingSupport { .getCollectionValueType(newTarget, undashKey(key), ignoreCase); if (collectionType != null) { configurer = camelContext.adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(collectionType.getSimpleName(), camelContext); + .resolvePropertyConfigurer(collectionType.getName(), camelContext); } else { configurer = camelContext.adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(prop.getClass().getSimpleName(), camelContext); + .resolvePropertyConfigurer(prop.getClass().getName(), camelContext); } } // prepare for next iterator diff --git a/core/camel-support/src/main/java/org/apache/camel/support/PropertyConfigurerHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/PropertyConfigurerHelper.java index 1ac0f7d..97b7ee2 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/PropertyConfigurerHelper.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/PropertyConfigurerHelper.java @@ -45,7 +45,7 @@ public final class PropertyConfigurerHelper { return context.adapt(ExtendedCamelContext.class) .getConfigurerResolver() - .resolvePropertyConfigurer(target.getClass().getSimpleName(), context); + .resolvePropertyConfigurer(target.getClass().getName(), context); } /** diff --git a/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java b/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java index fa36d55..dc19c6e 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/component/AbstractApiComponent.java @@ -109,7 +109,7 @@ public abstract class AbstractApiComponent<E extends Enum<E> & ApiName, T, S ext // copy component configuration, if set if (configuration != null) { PropertyConfigurer configurer = getCamelContext().adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(configuration.getClass().getSimpleName(), getCamelContext()); + .resolvePropertyConfigurer(configuration.getClass().getName(), getCamelContext()); // use reflection free configurer (if possible) if (configurer instanceof PropertyConfigurerGetter) { PropertyConfigurerGetter getter = (PropertyConfigurerGetter) configurer; @@ -128,7 +128,7 @@ public abstract class AbstractApiComponent<E extends Enum<E> & ApiName, T, S ext // create endpoint configuration with component properties final T endpointConfiguration = collection.getEndpointConfiguration(name); PropertyConfigurer configurer = getCamelContext().adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(endpointConfiguration.getClass().getSimpleName(), getCamelContext()); + .resolvePropertyConfigurer(endpointConfiguration.getClass().getName(), getCamelContext()); PropertyBindingSupport.build() .withConfigurer(configurer) .bind(getCamelContext(), endpointConfiguration, componentProperties); diff --git a/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodPropertiesHelper.java b/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodPropertiesHelper.java index 0b08559..a2f4d34 100644 --- a/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodPropertiesHelper.java +++ b/core/camel-support/src/main/java/org/apache/camel/support/component/ApiMethodPropertiesHelper.java @@ -61,7 +61,7 @@ public abstract class ApiMethodPropertiesHelper<C> { // use reflection free configurer (if possible) PropertyConfigurer configurer = context.adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(componentConfiguration.getSimpleName(), context); + .resolvePropertyConfigurer(componentConfiguration.getName(), context); if (configurer instanceof PropertyConfigurerGetter) { PropertyConfigurerGetter getter = (PropertyConfigurerGetter) configurer; Set<String> names = getter.getAllOptions(null).keySet(); @@ -107,7 +107,7 @@ public abstract class ApiMethodPropertiesHelper<C> { public void getEndpointProperties(CamelContext context, Object endpointConfiguration, Map<String, Object> properties) { PropertyConfigurer configurer = context.adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(endpointConfiguration.getClass().getSimpleName(), context); + .resolvePropertyConfigurer(endpointConfiguration.getClass().getName(), context); // use reflection free configurer (if possible) if (configurer instanceof PropertyConfigurerGetter) { PropertyConfigurerGetter getter = (PropertyConfigurerGetter) configurer; @@ -143,7 +143,7 @@ public abstract class ApiMethodPropertiesHelper<C> { Set<String> fields = new HashSet<>(); PropertyConfigurer configurer = context.adapt(ExtendedCamelContext.class).getConfigurerResolver() - .resolvePropertyConfigurer(endpointConfiguration.getClass().getSimpleName(), context); + .resolvePropertyConfigurer(endpointConfiguration.getClass().getName(), context); // use reflection free configurer (if possible) if (configurer instanceof PropertyConfigurerGetter) { PropertyConfigurerGetter getter = (PropertyConfigurerGetter) configurer; diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/AbstractGenerateConfigurerMojo.java b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/AbstractGenerateConfigurerMojo.java index 9503fd0..b6ad8ee 100644 --- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/AbstractGenerateConfigurerMojo.java +++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/AbstractGenerateConfigurerMojo.java @@ -394,10 +394,11 @@ public abstract class AbstractGenerateConfigurerMojo extends AbstractGeneratorMo int pos = name.lastIndexOf('.'); String pn = name.substring(0, pos); String en = name.substring(pos + 1); + String fqn = name; try (Writer w = new StringWriter()) { w.append("# " + GENERATED_MSG + "\n"); w.append("class=").append(pn).append(".").append(en).append("Configurer").append("\n"); - String fileName = "META-INF/services/org/apache/camel/configurer/" + en; + String fileName = "META-INF/services/org/apache/camel/configurer/" + fqn; boolean updated = updateResource(buildContext, resourcesOutputDir.toPath().resolve(fileName), w.toString()); if (updated) { getLog().info("Updated " + fileName);