Skip to content

Commit

Permalink
Upgrade Camel to 4.0.0-M3
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnetherton committed May 2, 2023
1 parent 7c818d4 commit 2473ded
Show file tree
Hide file tree
Showing 100 changed files with 2,177 additions and 4,104 deletions.
26 changes: 0 additions & 26 deletions catalog/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3321,19 +3321,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-solr</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-splunk</artifactId>
Expand Down Expand Up @@ -3984,19 +3971,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-vm</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-weather</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion docs/antora.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ asciidoc:
requires: "'util=camel-website-util,quarkus=xref:js/quarkus.js'"

# Project versions
camel-version: 4.0.0-M2 # replace ${camel.version}
camel-version: 4.0.0-M3 # replace ${camel.version}
camel-docs-version: ""
quarkus-version: 3.0.1.Final # replace ${quarkus.version}
graalvm-version: 22.3.0 # replace ${graalvm.version}
Expand Down
2 changes: 1 addition & 1 deletion docs/modules/ROOT/examples/components/http.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ cqJvmSince: 1.0.0
cqNativeSince: 1.0.0
cqCamelPartName: http
cqCamelPartTitle: HTTP
cqCamelPartDescription: Send requests to external HTTP servers using Apache HTTP Client 4.x.
cqCamelPartDescription: Send requests to external HTTP servers using Apache HTTP Client 5.x.
cqExtensionPageTitle: HTTP
13 changes: 0 additions & 13 deletions docs/modules/ROOT/examples/components/solr.yml

This file was deleted.

13 changes: 0 additions & 13 deletions docs/modules/ROOT/examples/components/vm.yml

This file was deleted.

2 changes: 0 additions & 2 deletions docs/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@
*** xref:reference/extensions/huaweicloud-smn.adoc[SimpleNotification]
*** xref:reference/extensions/slack.adoc[Slack]
*** xref:reference/extensions/snakeyaml.adoc[SnakeYAML]
*** xref:reference/extensions/solr.adoc[Solr]
*** xref:reference/extensions/splunk.adoc[Splunk]
*** xref:reference/extensions/splunk-hec.adoc[Splunk HEC]
*** xref:reference/extensions/spring-rabbitmq.adoc[Spring RabbitMQ]
Expand All @@ -287,7 +286,6 @@
*** xref:reference/extensions/timer.adoc[Timer]
*** xref:reference/extensions/twilio.adoc[Twilio]
*** xref:reference/extensions/twitter.adoc[Twitter]
*** xref:reference/extensions/vm.adoc[VM]
*** xref:reference/extensions/validator.adoc[Validator]
*** xref:reference/extensions/velocity.adoc[Velocity]
*** xref:reference/extensions/vertx.adoc[Vert.x]
Expand Down
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/reference/extensions/http.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Send requests to external HTTP servers using Apache HTTP Client 4.x.
:cq-description: Send requests to external HTTP servers using Apache HTTP Client 5.x.
:cq-deprecated: false
:cq-jvm-since: 1.0.0
:cq-native-since: 1.0.0
Expand All @@ -18,7 +18,7 @@ ifeval::[{doc-show-badges} == true]
[.badge-key]##JVM since##[.badge-supported]##1.0.0## [.badge-key]##Native since##[.badge-supported]##1.0.0##
endif::[]

Send requests to external HTTP servers using Apache HTTP Client 4.x.
Send requests to external HTTP servers using Apache HTTP Client 5.x.

[id="extensions-http-whats-inside"]
== What's inside
Expand Down
54 changes: 0 additions & 54 deletions docs/modules/ROOT/pages/reference/extensions/solr.adoc

This file was deleted.

46 changes: 0 additions & 46 deletions docs/modules/ROOT/pages/reference/extensions/vm.adoc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void execute(BuildContext context) {
@Test
public void findImplementations() {
ExtendedCamelContext ecc = context.getCamelContextExtension();
PackageScanClassResolver resolver = ecc.getPackageScanClassResolver();
PackageScanClassResolver resolver = ecc.getContextPlugin(PackageScanClassResolver.class);
Set<Class<?>> classes = resolver.findImplementations(Animal.class, Animal.class.getPackageName());
assertNotNull(classes);
assertEquals(2, classes.size());
Expand All @@ -76,7 +76,7 @@ public void findImplementations() {
@Test
public void findByFilter() {
ExtendedCamelContext ecc = context.getCamelContextExtension();
PackageScanClassResolver resolver = ecc.getPackageScanClassResolver();
PackageScanClassResolver resolver = ecc.getContextPlugin(PackageScanClassResolver.class);
Set<Class<?>> classes = resolver.findByFilter(Fungi.class::isAssignableFrom, Fungi.class.getPackageName());
assertNotNull(classes);
assertEquals(1, classes.size());
Expand All @@ -86,7 +86,7 @@ public void findByFilter() {
@Test
public void findAnnotated() {
ExtendedCamelContext ecc = context.getCamelContextExtension();
PackageScanClassResolver resolver = ecc.getPackageScanClassResolver();
PackageScanClassResolver resolver = ecc.getContextPlugin(PackageScanClassResolver.class);
Set<Class<?>> classes = resolver.findAnnotated(Singleton.class, Animal.class.getPackageName());
assertNotNull(classes);
assertEquals(1, classes.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,15 @@ public RuntimeValue<CamelContext> createContext(
// Set ClassLoader first as some actions depend on it being available
ExtendedCamelContext extendedCamelContext = context.getCamelContextExtension();
context.setApplicationContextClassLoader(tccl);
context.setDefaultExtension(RuntimeCamelCatalog.class, () -> new CamelRuntimeCatalog(config.runtimeCatalog));
context.getCamelContextExtension().addContextPlugin(RuntimeCamelCatalog.class,
new CamelRuntimeCatalog(config.runtimeCatalog));
extendedCamelContext.setRegistry(registry.getValue());
context.setTypeConverterRegistry(typeConverterRegistry.getValue());
context.setLoadTypeConverters(false);
extendedCamelContext.setModelJAXBContextFactory(contextFactory.getValue());
extendedCamelContext.setPackageScanClassResolver(packageScanClassResolver.getValue());
extendedCamelContext.addContextPlugin(ModelJAXBContextFactory.class, contextFactory.getValue());
extendedCamelContext.addContextPlugin(PackageScanClassResolver.class, packageScanClassResolver.getValue());
context.build();
extendedCamelContext.setComponentNameResolver(componentNameResolver.getValue());
extendedCamelContext.addContextPlugin(ComponentNameResolver.class, componentNameResolver.getValue());

// register to the container
beanContainer.instance(CamelProducers.class).setContext(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.apache.camel.spi.StartupStepRecorder;
import org.apache.camel.spi.TypeConverterLoader;
import org.apache.camel.spi.TypeConverterRegistry;
import org.apache.camel.support.PluginHelper;
import org.apache.camel.support.startup.DefaultStartupStepRecorder;

@Recorder
Expand Down Expand Up @@ -188,7 +189,7 @@ public Supplier<FluentProducerTemplate> createFluentProducerTemplate(String uri)
public Supplier<?> produceProxy(Class<?> clazz, String uri) {
return () -> {
final CamelContext camelContext = Arc.container().instance(CamelContext.class).get();
final BeanProxyFactory factory = camelContext.getCamelContextExtension().getBeanProxyFactory();
final BeanProxyFactory factory = PluginHelper.getBeanProxyFactory(camelContext);
final Endpoint endpoint = camelContext.getEndpoint(uri);
try {
return factory.createProxy(endpoint, true, clazz);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public void addConsumeRoutesToContext(RuntimeValue<CamelContext> camelContext,
try {
final RoutesDefinition routes = routesDefinition.getValue();
routes.setCamelContext(camelContext.getValue());
camelContext.getValue().getExtension(Model.class).addRouteDefinitions(routes.getRoutes());
camelContext.getValue().getCamelContextExtension().getContextPlugin(Model.class)
.addRouteDefinitions(routes.getRoutes());
} catch (Exception e) {
throw new RuntimeException("Could not add routes to context", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public FastCamelContext(FactoryFinderResolver factoryFinderResolver, String vers
this.modelDumper = modelDumper;

ExtendedCamelContext extendedCamelContext = getCamelContextExtension();
extendedCamelContext.setFactoryFinderResolver(factoryFinderResolver);
extendedCamelContext.addContextPlugin(FactoryFinderResolver.class, factoryFinderResolver);
setTracing(Boolean.FALSE);
setDebugging(Boolean.FALSE);
setMessageHistory(Boolean.FALSE);
Expand Down Expand Up @@ -108,7 +108,7 @@ protected ComponentResolver createComponentResolver() {
@Override
protected ComponentNameResolver createComponentNameResolver() {
// Component names are discovered at build time
throw new UnsupportedOperationException();
return null;
}

@Override
Expand All @@ -120,7 +120,7 @@ protected TypeConverter createTypeConverter() {
@Override
protected TypeConverterRegistry createTypeConverterRegistry() {
// TypeConverterRegistry creation is done at build time
throw new UnsupportedOperationException();
return null;
}

@Override
Expand All @@ -133,12 +133,12 @@ protected CamelBeanPostProcessor createBeanPostProcessor() {
@Override
protected ModelJAXBContextFactory createModelJAXBContextFactory() {
// Disabled by default and is provided by the xml-jaxb extension if present on the classpath
return new DisabledModelJAXBContextFactory();
return null;
}

protected FactoryFinderResolver createFactoryFinderResolver() {
throw new UnsupportedOperationException(
"FactoryFinderResolver should have been set in the FastCamelContext constructor");
// FactoryFinderResolver is initialized at build time
return null;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.camel.main.SimpleMainShutdownStrategy;
import org.apache.camel.quarkus.core.CamelConfig.FailureRemedy;
import org.apache.camel.spi.HasCamelContext;
import org.apache.camel.support.PluginHelper;
import org.apache.camel.support.service.ServiceHelper;
import org.apache.camel.util.StringHelper;
import org.slf4j.Logger;
Expand All @@ -60,7 +61,7 @@ protected void configureRoutes(CamelContext camelContext) throws Exception {
configurer.setRoutesCollector(routesCollector);
}

configurer.setBeanPostProcessor(camelContext.getCamelContextExtension().getBeanPostProcessor());
configurer.setBeanPostProcessor(PluginHelper.getBeanPostProcessor(camelContext));
configurer.setRoutesBuilders(mainConfigurationProperties.getRoutesBuilders());
configurer.setRoutesExcludePattern(mainConfigurationProperties.getRoutesExcludePattern());
configurer.setRoutesIncludePattern(mainConfigurationProperties.getRoutesIncludePattern());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
class HttpClientProcessor {
private static final DotName HTTP_REQUEST_BASE_NAME = DotName.createSimple(
"org.apache.http.client.methods.HttpRequestBase");
private static final String NTLM_ENGINE_5x_VERSION = "org.apache.hc.client5.http.impl.auth.NTLMEngineImpl";
private static final String NTLM_ENGINE_4x_VERSION = "org.apache.http.impl.auth.NTLMEngineImpl";

@BuildStep
AdditionalApplicationArchiveMarkerBuildItem markers() {
Expand All @@ -56,7 +58,23 @@ NativeImageResourceBuildItem suffixListResource() {
}

@BuildStep
RuntimeInitializedClassBuildItem runtimeInitializedClasses() {
return new RuntimeInitializedClassBuildItem("org.apache.http.impl.auth.NTLMEngineImpl");
void runtimeInitializedClasses(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClasses) {

if (checkClasspath(NTLM_ENGINE_5x_VERSION)) {
runtimeInitializedClasses.produce(new RuntimeInitializedClassBuildItem(NTLM_ENGINE_5x_VERSION));
}

if (checkClasspath(NTLM_ENGINE_4x_VERSION)) {
runtimeInitializedClasses.produce(new RuntimeInitializedClassBuildItem(NTLM_ENGINE_4x_VERSION));
}
}

private boolean checkClasspath(String className) {
try {
Class.forName(className, true, Thread.currentThread().getContextClassLoader());
return true;
} catch (ClassNotFoundException e) {
return false;
}
}
}
Loading

0 comments on commit 2473ded

Please sign in to comment.