Skip to content

Commit

Permalink
Use CamelContextCustomizer from camel-api
Browse files Browse the repository at this point in the history
Fixes #2637
  • Loading branch information
jamesnetherton committed May 20, 2021
1 parent ca40252 commit 92f2254
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class CamelContextProcessor {
* @param modelJAXBContextFactory a list of known {@link ModelJAXBContextFactory}.
* @param modelDumper a list of known {@link CamelModelToXMLDumperBuildItem}.
* @param factoryFinderResolver a list of known {@link org.apache.camel.spi.FactoryFinderResolver}.
* @param customizers a list of {@link org.apache.camel.quarkus.core.CamelContextCustomizer} used to
* @param customizers a list of {@link org.apache.camel.spi.CamelContextCustomizer} used to
* customize the {@link CamelContext} at {@link ExecutionTime#STATIC_INIT}.
* @return a build item holding an instance of a {@link CamelContext}
*/
Expand Down Expand Up @@ -113,7 +113,7 @@ CamelContextBuildItem context(
* those known by the CDI container.
* @param recorder the recorder
* @param context a build item providing an augmented {@link org.apache.camel.CamelContext} instance.
* @param customizers a list of {@link org.apache.camel.quarkus.core.CamelContextCustomizer} used to customize
* @param customizers a list of {@link org.apache.camel.spi.CamelContextCustomizer} used to customize
* the {@link CamelContext} at {@link ExecutionTime#RUNTIME_INIT}.
* @param routesBuilderClasses a list of known {@link org.apache.camel.RoutesBuilder} classes.
* @param runtimeTasks a placeholder to ensure all the runtime task are properly are done.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ CamelMainBuildItem main(
* @param beanContainer a reference to a fully initialized CDI bean container
* @param recorder the recorder.
* @param main a reference to a {@link CamelMain}.
* @param customizers a list of {@link org.apache.camel.quarkus.core.CamelContextCustomizer} that will be
* @param customizers a list of {@link org.apache.camel.spi.CamelContextCustomizer} that will be
* executed before starting the {@link CamelContext} at {@link ExecutionTime#RUNTIME_INIT}.
* @param runtimeTasks a placeholder to ensure all the runtime task are properly are done.
* @param camelMainConfig a {@link CamelMainConfig}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import io.quarkus.builder.item.MultiBuildItem;
import io.quarkus.runtime.RuntimeValue;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;

/**
* A {@link MultiBuildItem} holding the {@link CamelContextCustomizer} {@link RuntimeValue} and could be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import io.quarkus.builder.item.MultiBuildItem;
import io.quarkus.runtime.RuntimeValue;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;

/**
* A {@link MultiBuildItem} holding the {@link CamelContextCustomizer} {@link RuntimeValue} and could be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.test.QuarkusUnitTest;
import org.apache.camel.CamelContext;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.quarkus.core.deployment.spi.CamelContextCustomizerBuildItem;
import org.apache.camel.spi.CamelContextCustomizer;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
package org.apache.camel.quarkus.core.deployment;

import org.apache.camel.CamelContext;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;
import org.apache.camel.spi.RestConfiguration;

public class RestConfigurationCustomizer implements CamelContextCustomizer {

@Override
public void customize(CamelContext context) {
public void configure(CamelContext context) {
RestConfiguration restConfiguration = new RestConfiguration();
restConfiguration.setApiContextPath("/example");

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.camel.builder.LambdaRouteBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.catalog.RuntimeCamelCatalog;
import org.apache.camel.spi.CamelContextCustomizer;
import org.apache.camel.spi.FactoryFinderResolver;
import org.apache.camel.spi.ModelJAXBContextFactory;
import org.apache.camel.spi.ModelToXMLDumper;
Expand Down Expand Up @@ -67,7 +68,7 @@ public RuntimeValue<CamelContext> createContext(
}

public void customize(RuntimeValue<CamelContext> context, RuntimeValue<CamelContextCustomizer> contextCustomizer) {
contextCustomizer.getValue().customize(context.getValue());
contextCustomizer.getValue().configure(context.getValue());
}

public RuntimeValue<CamelRuntime> createRuntime(BeanContainer beanContainer, RuntimeValue<CamelContext> context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
import org.apache.camel.main.MainListenerSupport;
import org.apache.camel.main.RoutesCollector;
import org.apache.camel.quarkus.core.CamelConfig.FailureRemedy;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.quarkus.core.CamelProducers;
import org.apache.camel.quarkus.core.CamelRuntime;
import org.apache.camel.quarkus.core.RegistryRoutesLoader;
import org.apache.camel.spi.CamelContextCustomizer;

@Recorder
public class CamelMainRecorder {
Expand Down Expand Up @@ -78,7 +78,7 @@ public void customizeContext(RuntimeValue<CamelMain> main, List<RuntimeValue<Cam
@Override
public void afterConfigure(BaseMainSupport main) {
for (RuntimeValue<CamelContextCustomizer> customizer : contextCustomizers) {
customizer.getValue().customize(main.getCamelContext());
customizer.getValue().configure(main.getCamelContext());
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import io.vertx.core.Vertx;
import org.apache.camel.CamelContext;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.reactive.vertx.VertXReactiveExecutor;
import org.apache.camel.spi.CamelContextCustomizer;

@Recorder
public class ReactiveExecutorRecorder {
public RuntimeValue<CamelContextCustomizer> createReactiveExecutorCustomizer(RuntimeValue<Vertx> vertx) {
return new RuntimeValue<>(new CamelContextCustomizer() {
@Override
public void customize(CamelContext context) {
public void configure(CamelContext context) {
VertXReactiveExecutor executor = new VertXReactiveExecutor();
executor.setVertx(vertx.getValue());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import io.vertx.core.Vertx;
import org.apache.camel.CamelContext;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.reactive.vertx.VertXThreadPoolFactory;
import org.apache.camel.spi.CamelContextCustomizer;

@Recorder
public class ThreadPoolFactoryVertxRecorder {
public RuntimeValue<CamelContextCustomizer> createThreadPoolFactoryCustomizer(RuntimeValue<Vertx> vertx) {
return new RuntimeValue<>(new CamelContextCustomizer() {
@Override
public void customize(CamelContext context) {
public void configure(CamelContext context) {
VertXThreadPoolFactory threadPoolFactory = new VertXThreadPoolFactory();
threadPoolFactory.setVertx(vertx.getValue());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
import org.apache.camel.CamelContext;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;

@Recorder
public class CamelManagementRecorder {
Expand All @@ -31,7 +31,7 @@ public RuntimeValue<CamelContextCustomizer> createContextCustomizer() {
private static final class CamelManagementCustomizer implements CamelContextCustomizer {

@Override
public void customize(CamelContext context) {
public void configure(CamelContext context) {
context.setManagementName(context.getName());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import org.apache.camel.CamelContext;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.component.headersmap.FastHeadersMapFactory;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;

@Recorder
public class CamelHeadersmapRecorder {

public RuntimeValue<CamelContextCustomizer> createFastHeadersMapFactory() {
return new RuntimeValue<>(new CamelContextCustomizer() {
@Override
public void customize(CamelContext context) {
public void configure(CamelContext context) {
context.adapt(ExtendedCamelContext.class).setHeadersMapFactory(new FastHeadersMapFactory());
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import io.quarkus.runtime.annotations.Recorder;
import org.apache.camel.ExtendedCamelContext;
import org.apache.camel.converter.jaxb.JaxbRestBindingJaxbDataFormatFactory;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;

@Recorder
public class JaxbRecorder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.camel.component.micrometer.eventnotifier.MicrometerRouteEventNotifier;
import org.apache.camel.component.micrometer.messagehistory.MicrometerMessageHistoryFactory;
import org.apache.camel.component.micrometer.routepolicy.MicrometerRoutePolicyFactory;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;
import org.apache.camel.spi.ManagementStrategy;

@Recorder
Expand All @@ -45,7 +45,7 @@ public MicrometerContextCustomizer(CamelMicrometerConfig config) {
}

@Override
public void customize(CamelContext camelContext) {
public void configure(CamelContext camelContext) {
if (config.enableRoutePolicy) {
camelContext.addRoutePolicyFactory(new MicrometerRoutePolicyFactory());
}
Expand All @@ -69,7 +69,7 @@ public MicrometerRuntimeContextCustomizer(CamelMicrometerConfig config) {
}

@Override
public void customize(CamelContext camelContext) {
public void configure(CamelContext camelContext) {
if (!config.enableMessageHistory) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.apache.camel.component.microprofile.metrics.event.notifier.route.MicroProfileMetricsRouteEventNotifier;
import org.apache.camel.component.microprofile.metrics.message.history.MicroProfileMetricsMessageHistoryFactory;
import org.apache.camel.component.microprofile.metrics.route.policy.MicroProfileMetricsRoutePolicyFactory;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;
import org.apache.camel.spi.ManagementStrategy;
import org.eclipse.microprofile.metrics.MetricRegistry;
import org.jboss.logging.Logger;
Expand Down Expand Up @@ -53,7 +53,7 @@ public MicroProfileMetricsContextCustomizer(CamelMicroProfileMetricsConfig confi
}

@Override
public void customize(CamelContext camelContext) {
public void configure(CamelContext camelContext) {
if (config.enableRoutePolicy) {
camelContext.addRoutePolicyFactory(new MicroProfileMetricsRoutePolicyFactory());
}
Expand Down Expand Up @@ -82,7 +82,7 @@ public MicroProfileMetricsRuntimeContextCustomizer(CamelMicroProfileMetricsConfi
}

@Override
public void customize(CamelContext camelContext) {
public void configure(CamelContext camelContext) {
if (!config.enableMessageHistory) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import io.quarkus.runtime.annotations.Recorder;
import org.apache.camel.CamelContext;
import org.apache.camel.component.platform.http.PlatformHttpConstants;
import org.apache.camel.quarkus.core.CamelContextCustomizer;
import org.apache.camel.spi.CamelContextCustomizer;
import org.jboss.logging.Logger;

@Recorder
Expand All @@ -31,7 +31,7 @@ public RuntimeValue<CamelContextCustomizer> customizeCamelContext() {

private static class RestCamelContextCustomizer implements CamelContextCustomizer {
@Override
public void customize(CamelContext context) {
public void configure(CamelContext context) {
String component = context.getRestConfiguration().getComponent();
if (component == null) {
Logger.getLogger(RestCamelContextCustomizer.class).debugf(
Expand Down

0 comments on commit 92f2254

Please sign in to comment.