You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/04/02 10:23:50 UTC
[camel] branch master updated (2a8c10b -> c985778)
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.
from 2a8c10b Regen
new 862e80e CAMEL-14829: camel-api - Make ModelJAXBContextFactory generic without JAXB api
new c985778 CAMEL-14829: camel-util - Remove dependency on JAXB API. Make the enum just a string type in the XML DSL as we have done for others.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../apache/camel/spi/ModelJAXBContextFactory.java | 13 +++++-------
.../xml/AbstractCamelThreadPoolFactoryBean.java | 17 ++++++++-------
.../CamelContextAddRestDefinitionsFromXmlTest.java | 2 +-
...CamelContextAddRouteDefinitionsFromXmlTest.java | 2 +-
core/camel-util/pom.xml | 8 --------
.../util/concurrent/ThreadPoolRejectedPolicy.java | 5 -----
.../apache/camel/util/concurrent/package-info.java | 24 ----------------------
.../camel/xml/jaxb/JaxbModelToXMLDumper.java | 4 ++--
.../xml/jaxb/JaxbXMLRoutesDefinitionLoader.java | 4 ++--
9 files changed, 19 insertions(+), 60 deletions(-)
delete mode 100644 core/camel-util/src/main/java/org/apache/camel/util/concurrent/package-info.java
[camel] 02/02: CAMEL-14829: camel-util - Remove dependency on JAXB
API. Make the enum just a string type in the XML DSL as we have done for
others.
Posted by da...@apache.org.
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 c98577804e693738883489b940b402bacba241dc
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Apr 2 12:02:48 2020 +0200
CAMEL-14829: camel-util - Remove dependency on JAXB API. Make the enum just a string type in the XML DSL as we have done for others.
---
.../xml/AbstractCamelThreadPoolFactoryBean.java | 17 ++++++++-------
core/camel-util/pom.xml | 8 --------
.../util/concurrent/ThreadPoolRejectedPolicy.java | 5 -----
.../apache/camel/util/concurrent/package-info.java | 24 ----------------------
4 files changed, 8 insertions(+), 46 deletions(-)
diff --git a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
index c7c4343..ee302a0 100644
--- a/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
+++ b/core/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelThreadPoolFactoryBean.java
@@ -55,8 +55,10 @@ public abstract class AbstractCamelThreadPoolFactoryBean extends AbstractCamelFa
@Metadata(description = "Sets whether to allow core threads to timeout")
private String allowCoreThreadTimeOut;
@XmlAttribute
- @Metadata(description = "Sets the handler for tasks which cannot be executed by the thread pool.", defaultValue = "CallerRuns")
- private ThreadPoolRejectedPolicy rejectedPolicy = ThreadPoolRejectedPolicy.CallerRuns;
+ @Metadata(description = "Sets the handler for tasks which cannot be executed by the thread pool.",
+ defaultValue = "CallerRuns", javaType = "org.apache.camel.util.concurrent.ThreadPoolRejectedPolicy",
+ enums = "Abort,CallerRuns,DiscardOldest,Discard")
+ private String rejectedPolicy = ThreadPoolRejectedPolicy.CallerRuns.name();
@XmlAttribute(required = true)
@Metadata(description = "To use a custom thread name / pattern")
private String threadName;
@@ -70,27 +72,24 @@ public abstract class AbstractCamelThreadPoolFactoryBean extends AbstractCamelFa
if (size <= 0) {
throw new IllegalArgumentException("PoolSize must be a positive number");
}
-
int max = size;
if (maxPoolSize != null) {
max = CamelContextHelper.parseInteger(getCamelContext(), maxPoolSize);
}
-
long keepAlive = 60;
if (keepAliveTime != null) {
keepAlive = CamelContextHelper.parseLong(getCamelContext(), keepAliveTime);
}
-
int queueSize = -1;
if (maxQueueSize != null) {
queueSize = CamelContextHelper.parseInteger(getCamelContext(), maxQueueSize);
}
-
boolean allow = false;
if (allowCoreThreadTimeOut != null) {
allow = CamelContextHelper.parseBoolean(getCamelContext(), allowCoreThreadTimeOut);
}
TimeUnit tu = CamelContextHelper.parse(getCamelContext(), TimeUnit.class, timeUnit);
+ ThreadPoolRejectedPolicy tp = CamelContextHelper.parse(getCamelContext(), ThreadPoolRejectedPolicy.class, rejectedPolicy);
ThreadPoolProfile profile = new ThreadPoolProfileBuilder(getId())
.poolSize(size)
@@ -98,7 +97,7 @@ public abstract class AbstractCamelThreadPoolFactoryBean extends AbstractCamelFa
.keepAliveTime(keepAlive, tu)
.maxQueueSize(queueSize)
.allowCoreThreadTimeOut(allow)
- .rejectedPolicy(rejectedPolicy)
+ .rejectedPolicy(tp)
.build();
ExecutorService answer;
@@ -163,11 +162,11 @@ public abstract class AbstractCamelThreadPoolFactoryBean extends AbstractCamelFa
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
}
- public ThreadPoolRejectedPolicy getRejectedPolicy() {
+ public String getRejectedPolicy() {
return rejectedPolicy;
}
- public void setRejectedPolicy(ThreadPoolRejectedPolicy rejectedPolicy) {
+ public void setRejectedPolicy(String rejectedPolicy) {
this.rejectedPolicy = rejectedPolicy;
}
diff --git a/core/camel-util/pom.xml b/core/camel-util/pom.xml
index ef9eee4..48741d0 100644
--- a/core/camel-util/pom.xml
+++ b/core/camel-util/pom.xml
@@ -33,13 +33,6 @@
<name>Camel :: Util</name>
<description>The Camel Utilities</description>
- <properties>
- <camel.osgi.import>
- javax.xml.bind*;version="[2.2,3.0)",
- *
- </camel.osgi.import>
- </properties>
-
<dependencies>
<!-- required dependencies by camel-util -->
@@ -100,7 +93,6 @@
<scope>test</scope>
</dependency>
-
</dependencies>
<reporting>
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/concurrent/ThreadPoolRejectedPolicy.java b/core/camel-util/src/main/java/org/apache/camel/util/concurrent/ThreadPoolRejectedPolicy.java
index 507a5de..d41e6a0 100644
--- a/core/camel-util/src/main/java/org/apache/camel/util/concurrent/ThreadPoolRejectedPolicy.java
+++ b/core/camel-util/src/main/java/org/apache/camel/util/concurrent/ThreadPoolRejectedPolicy.java
@@ -20,9 +20,6 @@ import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ThreadPoolExecutor;
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
/**
* Represent the kinds of options for rejection handlers for thread pools.
* <p/>
@@ -32,8 +29,6 @@ import javax.xml.bind.annotation.XmlType;
* <p/>
* Camel will by default use <tt>CallerRuns</tt>.
*/
-@XmlType
-@XmlEnum
public enum ThreadPoolRejectedPolicy {
Abort, CallerRuns, DiscardOldest, Discard;
diff --git a/core/camel-util/src/main/java/org/apache/camel/util/concurrent/package-info.java b/core/camel-util/src/main/java/org/apache/camel/util/concurrent/package-info.java
deleted file mode 100644
index 0404703..0000000
--- a/core/camel-util/src/main/java/org/apache/camel/util/concurrent/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-/**
- * The JAXB POJOs for the
- * <a href="http://camel.apache.org/xml-configuration.html">XML Configuration</a>
- * of the routing rules.
- */
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://camel.apache.org/schema/spring", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.apache.camel.util.concurrent;
-
[camel] 01/02: CAMEL-14829: camel-api - Make
ModelJAXBContextFactory generic without JAXB api
Posted by da...@apache.org.
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 862e80e3ee39ac92ad0778371b803095724b0472
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Apr 2 11:29:13 2020 +0200
CAMEL-14829: camel-api - Make ModelJAXBContextFactory generic without JAXB api
---
.../java/org/apache/camel/spi/ModelJAXBContextFactory.java | 13 +++++--------
.../impl/CamelContextAddRestDefinitionsFromXmlTest.java | 2 +-
.../impl/CamelContextAddRouteDefinitionsFromXmlTest.java | 2 +-
.../org/apache/camel/xml/jaxb/JaxbModelToXMLDumper.java | 4 ++--
.../camel/xml/jaxb/JaxbXMLRoutesDefinitionLoader.java | 4 ++--
5 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/core/camel-api/src/main/java/org/apache/camel/spi/ModelJAXBContextFactory.java b/core/camel-api/src/main/java/org/apache/camel/spi/ModelJAXBContextFactory.java
index 7098c51..71f1316 100644
--- a/core/camel-api/src/main/java/org/apache/camel/spi/ModelJAXBContextFactory.java
+++ b/core/camel-api/src/main/java/org/apache/camel/spi/ModelJAXBContextFactory.java
@@ -16,11 +16,8 @@
*/
package org.apache.camel.spi;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
/**
- * Factory to abstract the creation of the Model's JAXBContext.
+ * Factory to abstract the creation of the Model's javax.xml.bind.JAXBContext.
*/
public interface ModelJAXBContextFactory {
@@ -30,11 +27,11 @@ public interface ModelJAXBContextFactory {
String FACTORY = "model-jaxbcontext-factory";
/**
- * Creates a new {@link javax.xml.bind.JAXBContext} used for loading the Camel model
+ * Creates a new javax.xml.bind.JAXBContext used for loading the Camel model
*
- * @return a new JAXBContext
- * @throws JAXBException is thrown if error creating the JAXBContext
+ * @return a new javax.xml.bind.JAXBContext
+ * @throws Exception is thrown if error creating the JAXBContext
*/
- JAXBContext newJAXBContext() throws JAXBException;
+ Object newJAXBContext() throws Exception;
}
\ No newline at end of file
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRestDefinitionsFromXmlTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRestDefinitionsFromXmlTest.java
index 328b89c..ba14a6f 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRestDefinitionsFromXmlTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRestDefinitionsFromXmlTest.java
@@ -50,7 +50,7 @@ public class CamelContextAddRestDefinitionsFromXmlTest extends ContextTestSuppor
@Before
public void setUp() throws Exception {
super.setUp();
- jaxbContext = context.adapt(ExtendedCamelContext.class).getModelJAXBContextFactory().newJAXBContext();
+ jaxbContext = (JAXBContext) context.adapt(ExtendedCamelContext.class).getModelJAXBContextFactory().newJAXBContext();
}
protected Object parseUri(String uri) throws JAXBException {
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRouteDefinitionsFromXmlTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRouteDefinitionsFromXmlTest.java
index b0f366b..bbc4eeb 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRouteDefinitionsFromXmlTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/CamelContextAddRouteDefinitionsFromXmlTest.java
@@ -39,7 +39,7 @@ public class CamelContextAddRouteDefinitionsFromXmlTest extends ContextTestSuppo
@Before
public void setUp() throws Exception {
super.setUp();
- jaxbContext = context.adapt(ExtendedCamelContext.class).getModelJAXBContextFactory().newJAXBContext();
+ jaxbContext = (JAXBContext) context.adapt(ExtendedCamelContext.class).getModelJAXBContextFactory().newJAXBContext();
}
protected Object parseUri(String uri) throws JAXBException {
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 005050c..3eb87fb 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
@@ -181,9 +181,9 @@ public class JaxbModelToXMLDumper implements ModelToXMLDumper {
return xml;
}
- private static JAXBContext getJAXBContext(CamelContext context) throws JAXBException {
+ private static JAXBContext getJAXBContext(CamelContext context) throws Exception {
ModelJAXBContextFactory factory = context.adapt(ExtendedCamelContext.class).getModelJAXBContextFactory();
- return factory.newJAXBContext();
+ return (JAXBContext) factory.newJAXBContext();
}
/**
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 ab5e84b..a29e625 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
@@ -131,9 +131,9 @@ public class JaxbXMLRoutesDefinitionLoader implements XMLRoutesDefinitionLoader
return "camel-xml-jaxb";
}
- private static JAXBContext getJAXBContext(CamelContext context) throws JAXBException {
+ private static JAXBContext getJAXBContext(CamelContext context) throws Exception {
ModelJAXBContextFactory factory = context.adapt(ExtendedCamelContext.class).getModelJAXBContextFactory();
- return factory.newJAXBContext();
+ return (JAXBContext) factory.newJAXBContext();
}
/**