Skip to content

Commit

Permalink
Upgrade to camel 3.0.0 apache#469
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Nov 25, 2019
1 parent ef45ab7 commit 02ecdb8
Show file tree
Hide file tree
Showing 16 changed files with 138 additions and 61 deletions.
4 changes: 2 additions & 2 deletions docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ Number of Camel components: 44 in 37 JAR artifacts (0 deprecated)
| Component | Since | Description

| link:https://camel.apache.org/components/latest/aws-ecs-component.html[AWS ECS] (camel-quarkus-aws-ecs) +
`aws-ecs:label` | 0.5 | The aws-kms is used for managing Amazon ECS
`aws-ecs:label` | 0.5 | The aws-ecs is used for managing Amazon ECS

| link:https://camel.apache.org/components/latest/aws-eks-component.html[AWS EKS] (camel-quarkus-aws-eks) +
`aws-eks:label` | 0.2 | The aws-kms is used for managing Amazon EKS
`aws-eks:label` | 0.2 | The aws-eks is used for managing Amazon EKS

| link:https://camel.apache.org/components/latest/aws-kms-component.html[AWS KMS] (camel-quarkus-aws-kms) +
`aws-kms:label` | 0.5 | The aws-kms is used for managing Amazon KMS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.camel.model.Model;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.ProcessorDefinitionHelper;
import org.apache.camel.model.Resilience4jConfigurationDefinition;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.RouteDefinitionHelper;
import org.apache.camel.model.RouteFilters;
Expand All @@ -53,6 +54,7 @@ public abstract class BaseModel implements Model {
private List<ValidatorDefinition> validators = new ArrayList<>();
private Map<String, ServiceCallConfigurationDefinition> serviceCallConfigurations = new ConcurrentHashMap<>();
private Map<String, HystrixConfigurationDefinition> hystrixConfigurations = new ConcurrentHashMap<>();
private Map<String, Resilience4jConfigurationDefinition> resilience4jConfigurations = new ConcurrentHashMap<>();
private Function<RouteDefinition, Boolean> routeFilter;

public BaseModel(CamelContext camelContext) {
Expand Down Expand Up @@ -200,6 +202,34 @@ public void addHystrixConfiguration(String id, HystrixConfigurationDefinition co
hystrixConfigurations.put(id, configuration);
}

@Override
public Resilience4jConfigurationDefinition getResilience4jConfiguration(String id) {
if (id == null) {
id = "";
}

return resilience4jConfigurations.get(id);
}

@Override
public void setResilience4jConfiguration(Resilience4jConfigurationDefinition configuration) {
resilience4jConfigurations.put("", configuration);
}

@Override
public void setResilience4jConfigurations(List<Resilience4jConfigurationDefinition> configurations) {
if (configurations != null) {
for (Resilience4jConfigurationDefinition configuration : configurations) {
resilience4jConfigurations.put(configuration.getId(), configuration);
}
}
}

@Override
public void addResilience4jConfiguration(String id, Resilience4jConfigurationDefinition configuration) {
resilience4jConfigurations.put(id, configuration);
}

@Override
public DataFormatDefinition resolveDataFormatDefinition(String name) {
// lookup type and create the data format from it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import org.apache.camel.impl.engine.DefaultMessageHistoryFactory;
import org.apache.camel.impl.engine.DefaultNodeIdFactory;
import org.apache.camel.impl.engine.DefaultPackageScanClassResolver;
import org.apache.camel.impl.engine.DefaultPackageScanResourceResolver;
import org.apache.camel.impl.engine.DefaultProcessorFactory;
import org.apache.camel.impl.engine.DefaultReactiveExecutor;
import org.apache.camel.impl.engine.DefaultRouteController;
Expand Down Expand Up @@ -88,6 +89,7 @@
import org.apache.camel.spi.ModelJAXBContextFactory;
import org.apache.camel.spi.NodeIdFactory;
import org.apache.camel.spi.PackageScanClassResolver;
import org.apache.camel.spi.PackageScanResourceResolver;
import org.apache.camel.spi.ProcessorFactory;
import org.apache.camel.spi.PropertiesComponent;
import org.apache.camel.spi.ReactiveExecutor;
Expand Down Expand Up @@ -319,6 +321,11 @@ protected PropertiesComponent createPropertiesComponent() {
return pc;
}

@Override
protected PackageScanResourceResolver createPackageScanResourceResolver() {
return new DefaultPackageScanResourceResolver();
}

@Override
protected Tracer createTracer() {
Tracer tracer = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
package org.apache.camel.quarkus.core;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -28,7 +27,6 @@
import org.apache.camel.Processor;
import org.apache.camel.Route;
import org.apache.camel.Service;
import org.apache.camel.impl.DefaultModel;
import org.apache.camel.impl.engine.AbstractCamelContext;
import org.apache.camel.impl.engine.BaseRouteService;
import org.apache.camel.impl.engine.DefaultRouteContext;
Expand All @@ -37,8 +35,6 @@
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.model.RouteDefinition;
import org.apache.camel.model.RouteDefinitionHelper;
import org.apache.camel.model.RoutesDefinition;
import org.apache.camel.model.rest.RestsDefinition;
import org.apache.camel.processor.channel.DefaultChannel;
import org.apache.camel.reifier.RouteReifier;
import org.apache.camel.support.CamelContextHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,20 +95,11 @@ NativeImageResourceBundleBuildItem hapiMessages() {
return new NativeImageResourceBundleBuildItem("ca.uhn.fhir.i18n.hapi-messages");
}

@BuildStep
ReflectiveClassBuildItem xmlOutputFactory() {
return new ReflectiveClassBuildItem(false, false,
"com.sun.xml.internal.stream.XMLOutputFactoryImpl");
}

@BuildStep(applicationArchiveMarkers = { "org/hl7/fhir", "ca/uhn/fhir" })
void processFhir(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
Set<String> classes = new HashSet<>();
classes.add(SchematronBaseValidator.class.getCanonicalName());
classes.add(DependencyLogImpl.class.getCanonicalName());
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, true, classes.toArray(new String[0])));
reflectiveClass
.produce(new ReflectiveClassBuildItem(true, true, true, ApacheRestfulClientFactory.class.getCanonicalName()));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, true, SchematronBaseValidator.class));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, true, DependencyLogImpl.class));
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, true, ApacheRestfulClientFactory.class));
}

@BuildStep(onlyIf = FhirFlags.Dstu2Enabled.class, applicationArchiveMarkers = { "org/hl7/fhir", "ca/uhn/fhir" })
Expand Down
9 changes: 5 additions & 4 deletions extensions/fhir/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-fhir</artifactId>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.xml.bind</groupId>
<artifactId>jboss-jaxb-api_2.3_spec</artifactId>
Expand All @@ -74,6 +70,11 @@
<groupId>org.jboss.logging</groupId>
<artifactId>commons-logging-jboss-logging</artifactId>
</dependency>

<dependency>
<groupId>com.oracle.substratevm</groupId>
<artifactId>svm</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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.quarkus.component.fhir.graal;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.parser.IParser;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;

@TargetClass(FhirContext.class)
final class FhirContextSubstitution {
@Substitute
public IParser newRDFParser() {
throw new UnsupportedOperationException();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
*/
package org.apache.camel.quarkus.component.hystrix.deployment;

import org.apache.camel.model.CircuitBreakerDefinition;
import org.apache.camel.model.HystrixConfigurationCommon;
import org.apache.camel.model.HystrixConfigurationDefinition;
import org.apache.camel.model.OnFallbackDefinition;

import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageSystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;

import org.apache.camel.model.HystrixConfigurationCommon;
import org.apache.camel.model.HystrixConfigurationDefinition;
import org.apache.camel.model.HystrixDefinition;
import org.apache.camel.model.OnFallbackDefinition;

class HystrixProcessor {

private static final String FEATURE = "camel-hystrix";
Expand All @@ -45,10 +45,10 @@ void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveCla
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true,
HystrixConfigurationCommon.class,
HystrixConfigurationDefinition.class,
HystrixDefinition.class,
CircuitBreakerDefinition.class,
OnFallbackDefinition.class));

resource.produce(new NativeImageResourceBuildItem("META-INF/services/org/apache/camel/model/HystrixDefinition"));
resource.produce(new NativeImageResourceBuildItem("META-INF/services/org/apache/camel/model/CircuitBreakerDefinition"));

// Force RxJava to not use Unsafe API
systemProperty.produce(new NativeImageSystemPropertyBuildItem("rx.unsafe-disable", "true"));
Expand Down
4 changes: 2 additions & 2 deletions extensions/readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ Number of Camel components: 44 in 37 JAR artifacts (0 deprecated)
| Component | Since | Description

| link:https://camel.apache.org/components/latest/aws-ecs-component.html[AWS ECS] (camel-quarkus-aws-ecs) +
`aws-ecs:label` | 0.5 | The aws-kms is used for managing Amazon ECS
`aws-ecs:label` | 0.5 | The aws-ecs is used for managing Amazon ECS

| link:https://camel.apache.org/components/latest/aws-eks-component.html[AWS EKS] (camel-quarkus-aws-eks) +
`aws-eks:label` | 0.2 | The aws-kms is used for managing Amazon EKS
`aws-eks:label` | 0.2 | The aws-eks is used for managing Amazon EKS

| link:https://camel.apache.org/components/latest/aws-kms-component.html[AWS KMS] (camel-quarkus-aws-kms) +
`aws-kms:label` | 0.5 | The aws-kms is used for managing Amazon KMS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ void reflective(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
new ReflectiveClassBuildItem(
false,
false,
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl",
"com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl",
"com.sun.org.apache.xerces.internal.parsers.SAXParser",
"com.sun.xml.internal.stream.XMLInputFactoryImpl",
"com.sun.org.apache.xerces.internal.parsers.SAXParser"));
"com.sun.xml.internal.stream.XMLOutputFactoryImpl"));

reflectiveClass.produce(
new ReflectiveClassBuildItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
import org.apache.camel.Endpoint;
import org.apache.camel.component.xslt.XsltComponent;
import org.apache.camel.component.xslt.XsltEndpoint;
import org.apache.camel.quarkus.support.xalan.XalanSupport;
Expand All @@ -33,7 +34,7 @@ public RuntimeValue<XsltComponent> createXsltComponent(CamelXsltConfig config,
}

public RuntimeValue<RuntimeUriResolver.Builder> createRuntimeUriResolverBuilder() {
return new RuntimeValue<RuntimeUriResolver.Builder>(new RuntimeUriResolver.Builder());
return new RuntimeValue<>(new RuntimeUriResolver.Builder());
}

public void addRuntimeUriResolverEntry(RuntimeValue<RuntimeUriResolver.Builder> builder, String templateUri,
Expand All @@ -52,10 +53,11 @@ public QuarkusXsltComponent(CamelXsltConfig config, RuntimeUriResolver uriResolv

@Override
protected void configureEndpoint(
XsltEndpoint endpoint,
Endpoint endpoint,
String remaining,
Map<String, Object> parameters) throws Exception {

final XsltEndpoint xsltEndpoint = (XsltEndpoint) endpoint;
final String className = uriResolver.getTransletClassName(remaining);

TransformerFactory tf = XalanSupport.newTransformerFactoryInstance();
Expand All @@ -64,11 +66,11 @@ protected void configureEndpoint(
tf.setAttribute("package-name", this.config.packageName);
tf.setErrorListener(new CamelXsltErrorListener());

endpoint.setTransformerFactory(tf);
xsltEndpoint.setTransformerFactory(tf);

super.configureEndpoint(endpoint, remaining, parameters);
endpoint.setUriResolver(uriResolver);

xsltEndpoint.setUriResolver(uriResolver);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class HystrixRoutes extends RouteBuilder {
@Override
public void configure() throws Exception {
from("direct:fallback")
.hystrix()
.circuitBreaker()
.hystrixConfiguration()
.executionTimeoutInMilliseconds(100)
.end()
Expand All @@ -33,7 +33,7 @@ public void configure() throws Exception {
.end();

from("direct:fallbackViaNetwork")
.hystrix()
.circuitBreaker()
.throwException(new IllegalStateException("Forced exception"))
.onFallbackViaNetwork()
.to("netty-http:http://localhost:8999/network/fallback")
Expand Down
23 changes: 22 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

<camel.version>3.0.0-RC3</camel.version>
<hapi.version>3.7.0</hapi.version>
<hapi.server.version>4.1.0</hapi.server.version>
<quarkus.version>1.0.0.CR2</quarkus.version>
<jetty.version>9.4.18.v20190429</jetty.version>
<xstream.version>1.4.11</xstream.version>
Expand Down Expand Up @@ -168,6 +167,17 @@
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>apache.staging</id>
<url>https://repository.apache.org/content/repositories/orgapachecamel-1164/</url>
<name>Apache Snapshot Repo</name>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>

<pluginRepositories>
Expand All @@ -181,6 +191,17 @@
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>apache.staging</id>
<url>https://repository.apache.org/content/repositories/orgapachecamel-1164/</url>
<name>Apache Snapshot Repo</name>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>

<build>
Expand Down
15 changes: 0 additions & 15 deletions poms/bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -660,21 +660,6 @@
</dependency>

<!-- Other third party dependencies (in alphabetical order by groupId:artifactId) -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>${hapi.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
Expand Down

0 comments on commit 02ecdb8

Please sign in to comment.