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 2019/06/06 11:57:39 UTC

[camel] branch master updated (b7e39c8 -> 6c1186e)

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 b7e39c8  Updating Rome dependency
     new 38145ab  CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core
     new 5978cf5  CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core
     new 6c1186e  CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core

The 3 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:
 MIGRATION.md                                       |  2 ++
 .../camel/spring/boot/CamelAutoConfiguration.java  |  2 +-
 .../camel/impl/engine/DefaultProcessorFactory.java |  5 +++++
 .../java/org/apache/camel/main/MainSupport.java    |  5 ++---
 .../FileWatcherReloadStrategy.java                 | 22 ++++++++++++++++++----
 .../{impl => reload}/ReloadStrategySupport.java    |  2 +-
 .../impl/model/FileWatcherReloadStrategyTest.java  |  2 +-
 .../ManagedFileWatcherReloadStrategyTest.java      |  2 +-
 8 files changed, 31 insertions(+), 11 deletions(-)
 rename core/camel-core/src/main/java/org/apache/camel/{impl => reload}/FileWatcherReloadStrategy.java (85%)
 rename core/camel-core/src/main/java/org/apache/camel/{impl => reload}/ReloadStrategySupport.java (99%)


[camel] 01/03: CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core

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 38145ab8bd1722d0d21b8733b4030e031a919174
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Jun 6 13:11:32 2019 +0200

    CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core
---
 .../camel/impl/engine/DefaultProcessorFactory.java   |  5 +++++
 .../apache/camel/impl/FileWatcherReloadStrategy.java | 20 +++++++++++++++++---
 2 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultProcessorFactory.java b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultProcessorFactory.java
index 69e93a0..f31e7a2 100644
--- a/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultProcessorFactory.java
+++ b/core/camel-base/src/main/java/org/apache/camel/impl/engine/DefaultProcessorFactory.java
@@ -25,7 +25,9 @@ import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.NamedNode;
 import org.apache.camel.NoFactoryAvailableException;
 import org.apache.camel.Processor;
+import org.apache.camel.Producer;
 import org.apache.camel.processor.SendDynamicProcessor;
+import org.apache.camel.processor.UnitOfWorkProducer;
 import org.apache.camel.spi.FactoryFinder;
 import org.apache.camel.spi.ProcessorFactory;
 import org.apache.camel.spi.RouteContext;
@@ -96,6 +98,9 @@ public class DefaultProcessorFactory implements ProcessorFactory {
             if (exchangePattern != null) {
                 answer.setPattern(exchangePattern);
             }
+        } else if ("UnitOfWorkProducer".equals(definitionName)) {
+            Producer producer = (Producer) args.get("producer");
+            return new UnitOfWorkProducer(producer);
         }
 
         return answer;
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java b/core/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
index 2a3fabb..e027286 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
+++ b/core/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
@@ -18,14 +18,17 @@ package org.apache.camel.impl;
 
 import java.io.File;
 import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
 
+import org.apache.camel.Component;
 import org.apache.camel.Consumer;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.Processor;
 import org.apache.camel.api.management.ManagedAttribute;
 import org.apache.camel.api.management.ManagedResource;
-import org.apache.camel.processor.UnitOfWorkProducer;
 import org.apache.camel.support.DefaultProducer;
 import org.apache.camel.support.service.ServiceHelper;
 import org.apache.camel.util.IOHelper;
@@ -97,11 +100,22 @@ public class FileWatcherReloadStrategy extends ReloadStrategySupport {
         if (dir.exists() && dir.isDirectory()) {
             log.info("Starting ReloadStrategy to watch directory: {}", dir);
 
+            // must have camel-file on classpath
+            Component file = getCamelContext().getComponent("file", true);
+            if (file == null) {
+                throw new IllegalArgumentException("FileWatcherReloadStrategy requires camel-file JAR to be on the classpath");
+            }
+
             // only include xml files
             endpoint = getCamelContext().getEndpoint("file:" + dir + "?delay=" + delay + "&recursive=" + isRecursive
                 + "&include=.*xml$&readLock=none&noop=true&idempotentKey=${file:name}-${file:modified}");
-            // must wrap in unit of work
-            task = new UnitOfWorkProducer(new UpdatedFileProcessor(endpoint));
+
+            // must wrap in unit of work producer
+            Map<String, Object> args = new HashMap<>(1);
+            args.put("producer", new UpdatedFileProcessor(endpoint));
+            task = getCamelContext().adapt(ExtendedCamelContext.class).getProcessorFactory()
+                    .createProcessor(getCamelContext(), "UnitOfWorkProducer", args);
+
             consumer = endpoint.createConsumer(task);
 
             ServiceHelper.startService(endpoint);


[camel] 02/03: CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core

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 5978cf5cab600dfb541a6b59f226aed2651d2c5d
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Jun 6 13:18:40 2019 +0200

    CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core
---
 MIGRATION.md                                                            | 2 ++
 .../main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java  | 2 +-
 core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java    | 2 +-
 .../org/apache/camel/{impl => reload}/FileWatcherReloadStrategy.java    | 2 +-
 .../java/org/apache/camel/{impl => reload}/ReloadStrategySupport.java   | 2 +-
 .../java/org/apache/camel/impl/model/FileWatcherReloadStrategyTest.java | 2 +-
 .../apache/camel/management/ManagedFileWatcherReloadStrategyTest.java   | 2 +-
 7 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/MIGRATION.md b/MIGRATION.md
index 84c6ddd..a8e3279 100644
--- a/MIGRATION.md
+++ b/MIGRATION.md
@@ -255,6 +255,8 @@ The annotation `org.apache.camel.language.SpEL` has been moved to `org.apache.ca
 
 Rename various APIs in camel-core to fix the typo `chiper` to `cipher`.
 
+The classes `ReloadStrategySupport` and `FileWatcherReloadStrategy` has been moved from package `org.apache.camel.impl` to `org.apache.camel.reload`.
+
 #### camel-test
 
 If you are using camel-test and override the `createRegistry` method, for example to register beans from the `JndiRegisty` class, then this is no longer necessary, and instead
diff --git a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
index a3c4c85..5085eff 100644
--- a/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
+++ b/components/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/CamelAutoConfiguration.java
@@ -39,10 +39,10 @@ import org.apache.camel.component.properties.PropertiesParser;
 import org.apache.camel.health.HealthCheckRegistry;
 import org.apache.camel.health.HealthCheckRepository;
 import org.apache.camel.health.HealthCheckService;
-import org.apache.camel.impl.FileWatcherReloadStrategy;
 import org.apache.camel.model.Model;
 import org.apache.camel.processor.interceptor.BacklogTracer;
 import org.apache.camel.processor.interceptor.HandleFault;
+import org.apache.camel.reload.FileWatcherReloadStrategy;
 import org.apache.camel.spi.AsyncProcessorAwaitManager;
 import org.apache.camel.spi.BeanRepository;
 import org.apache.camel.spi.EndpointStrategy;
diff --git a/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
index dd0b85b..7394bb5 100644
--- a/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
@@ -49,7 +49,7 @@ import org.apache.camel.health.HealthCheckRegistry;
 import org.apache.camel.health.HealthCheckRepository;
 import org.apache.camel.health.HealthCheckService;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.FileWatcherReloadStrategy;
+import org.apache.camel.reload.FileWatcherReloadStrategy;
 import org.apache.camel.model.Model;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.processor.interceptor.BacklogTracer;
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java b/core/camel-core/src/main/java/org/apache/camel/reload/FileWatcherReloadStrategy.java
similarity index 99%
rename from core/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
rename to core/camel-core/src/main/java/org/apache/camel/reload/FileWatcherReloadStrategy.java
index e027286..ca10bcc 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/FileWatcherReloadStrategy.java
+++ b/core/camel-core/src/main/java/org/apache/camel/reload/FileWatcherReloadStrategy.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.impl;
+package org.apache.camel.reload;
 
 import java.io.File;
 import java.io.InputStream;
diff --git a/core/camel-core/src/main/java/org/apache/camel/impl/ReloadStrategySupport.java b/core/camel-core/src/main/java/org/apache/camel/reload/ReloadStrategySupport.java
similarity index 99%
rename from core/camel-core/src/main/java/org/apache/camel/impl/ReloadStrategySupport.java
rename to core/camel-core/src/main/java/org/apache/camel/reload/ReloadStrategySupport.java
index 7fe59a0..49d548e 100644
--- a/core/camel-core/src/main/java/org/apache/camel/impl/ReloadStrategySupport.java
+++ b/core/camel-core/src/main/java/org/apache/camel/reload/ReloadStrategySupport.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.impl;
+package org.apache.camel.reload;
 
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/model/FileWatcherReloadStrategyTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/model/FileWatcherReloadStrategyTest.java
index d6b7b60..402dede 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/model/FileWatcherReloadStrategyTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/model/FileWatcherReloadStrategyTest.java
@@ -23,7 +23,7 @@ import java.util.concurrent.TimeUnit;
 import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.FileWatcherReloadStrategy;
+import org.apache.camel.reload.FileWatcherReloadStrategy;
 import org.apache.camel.spi.CamelEvent;
 import org.apache.camel.spi.CamelEvent.RouteAddedEvent;
 import org.apache.camel.support.EventNotifierSupport;
diff --git a/core/camel-management-impl/src/test/java/org/apache/camel/management/ManagedFileWatcherReloadStrategyTest.java b/core/camel-management-impl/src/test/java/org/apache/camel/management/ManagedFileWatcherReloadStrategyTest.java
index f41ea73..377fe5d 100644
--- a/core/camel-management-impl/src/test/java/org/apache/camel/management/ManagedFileWatcherReloadStrategyTest.java
+++ b/core/camel-management-impl/src/test/java/org/apache/camel/management/ManagedFileWatcherReloadStrategyTest.java
@@ -20,7 +20,7 @@ import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.FileWatcherReloadStrategy;
+import org.apache.camel.reload.FileWatcherReloadStrategy;
 import org.junit.Test;
 
 public class ManagedFileWatcherReloadStrategyTest extends ManagementTestSupport {


[camel] 03/03: CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core

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 6c1186e0869799e5ce28a0ba7304f5ad60a80175
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Jun 6 13:56:04 2019 +0200

    CAMEL-13618: camel3 - Move FileWatcherReloadStrategy out of camel-core
---
 core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java b/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
index 7394bb5..ab5fc17 100644
--- a/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
+++ b/core/camel-core/src/main/java/org/apache/camel/main/MainSupport.java
@@ -48,12 +48,11 @@ import org.apache.camel.cluster.CamelClusterService;
 import org.apache.camel.health.HealthCheckRegistry;
 import org.apache.camel.health.HealthCheckRepository;
 import org.apache.camel.health.HealthCheckService;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.reload.FileWatcherReloadStrategy;
 import org.apache.camel.model.Model;
 import org.apache.camel.model.RouteDefinition;
 import org.apache.camel.processor.interceptor.BacklogTracer;
 import org.apache.camel.processor.interceptor.HandleFault;
+import org.apache.camel.reload.FileWatcherReloadStrategy;
 import org.apache.camel.spi.AsyncProcessorAwaitManager;
 import org.apache.camel.spi.CamelBeanPostProcessor;
 import org.apache.camel.spi.DataFormat;
@@ -909,7 +908,7 @@ public abstract class MainSupport extends ServiceSupport {
         }
 
         if (config.getName() != null) {
-            ((DefaultCamelContext) camelContext).setName(config.getName());
+            camelContext.adapt(ExtendedCamelContext.class).setName(config.getName());
         }
 
         if (config.getShutdownTimeout() > 0) {