You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2020/03/25 15:23:05 UTC

[camel] 07/11: Rename immutable -> lightweight to be more coherent and descriptive

This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 73915938ec6bab235d22473d3f74ee8b7d33c542
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Mar 18 18:45:25 2020 +0100

    Rename immutable -> lightweight to be more coherent and descriptive
---
 ...amelContext.java => LightweightCamelContext.java} | 16 ++++++++--------
 ...text.java => LightweightRuntimeCamelContext.java} |  6 +++---
 .../java/org/apache/camel/ContextTestSupport.java    | 20 ++++++++++----------
 ...eContextTest.java => LightweightContextTest.java} |  4 ++--
 .../camel/impl/lw/SplitterLightweightTest.java       |  3 +--
 .../apache/camel/ExtendedCamelContextConfigurer.java |  4 ----
 .../main/MainConfigurationPropertiesConfigurer.java  |  6 ++----
 .../src/main/java/org/apache/camel/main/Main.java    |  4 ++--
 8 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/ImmutableCamelContext.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
similarity index 98%
rename from core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/ImmutableCamelContext.java
rename to core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
index 36cd754..5a0a9f5 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/ImmutableCamelContext.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightCamelContext.java
@@ -132,11 +132,11 @@ import org.apache.camel.support.DefaultRegistry;
 import org.apache.camel.support.jsse.SSLContextParameters;
 
 @Experimental
-public class ImmutableCamelContext implements ExtendedCamelContext, CatalogCamelContext, ModelCamelContext {
+public class LightweightCamelContext implements ExtendedCamelContext, CatalogCamelContext, ModelCamelContext {
 
     protected volatile CamelContext delegate;
 
-    protected ImmutableCamelContext(CamelContext delegate) {
+    protected LightweightCamelContext(CamelContext delegate) {
         this.delegate = delegate;
     }
 
@@ -146,11 +146,11 @@ public class ImmutableCamelContext implements ExtendedCamelContext, CatalogCamel
      * <p/>
      * Use one of the other constructors to force use an explicit registry.
      */
-    public ImmutableCamelContext() {
+    public LightweightCamelContext() {
         delegate = new DefaultCamelContext(false) {
             @Override
             public CamelContext getCamelContextReference() {
-                return ImmutableCamelContext.this;
+                return LightweightCamelContext.this;
             }
         };
     }
@@ -163,7 +163,7 @@ public class ImmutableCamelContext implements ExtendedCamelContext, CatalogCamel
      *
      * @param repository the bean repository.
      */
-    public ImmutableCamelContext(BeanRepository repository) {
+    public LightweightCamelContext(BeanRepository repository) {
         this(new DefaultRegistry(repository));
     }
 
@@ -172,7 +172,7 @@ public class ImmutableCamelContext implements ExtendedCamelContext, CatalogCamel
      *
      * @param registry the registry
      */
-    public ImmutableCamelContext(Registry registry) {
+    public LightweightCamelContext(Registry registry) {
         this();
         setRegistry(registry);
     }
@@ -1652,7 +1652,7 @@ public class ImmutableCamelContext implements ExtendedCamelContext, CatalogCamel
     //
 
     public void makeImmutable() {
-        if (delegate instanceof RuntimeImmutableCamelContext) {
+        if (delegate instanceof LightweightRuntimeCamelContext) {
             throw new IllegalStateException();
         }
         delegate.setAutoStartup(false);
@@ -1660,7 +1660,7 @@ public class ImmutableCamelContext implements ExtendedCamelContext, CatalogCamel
         for (Route route : delegate.getRoutes()) {
             clearModelReferences(route);
         }
-        delegate = new RuntimeImmutableCamelContext(this, delegate);
+        delegate = new LightweightRuntimeCamelContext(this, delegate);
     }
 
     private void clearModelReferences(Route r) {
diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/RuntimeImmutableCamelContext.java b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightRuntimeCamelContext.java
similarity index 99%
rename from core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/RuntimeImmutableCamelContext.java
rename to core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightRuntimeCamelContext.java
index 3de7132..8971d9c 100644
--- a/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/RuntimeImmutableCamelContext.java
+++ b/core/camel-core-engine/src/main/java/org/apache/camel/impl/lw/LightweightRuntimeCamelContext.java
@@ -136,9 +136,9 @@ import org.apache.camel.util.URISupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class RuntimeImmutableCamelContext implements ExtendedCamelContext, CatalogCamelContext {
+public class LightweightRuntimeCamelContext implements ExtendedCamelContext, CatalogCamelContext {
 
-    private static final Logger LOG = LoggerFactory.getLogger(RuntimeImmutableCamelContext.class);
+    private static final Logger LOG = LoggerFactory.getLogger(LightweightRuntimeCamelContext.class);
 
     private final CamelContext reference;
     private final Registry registry;
@@ -180,7 +180,7 @@ public class RuntimeImmutableCamelContext implements ExtendedCamelContext, Catal
     private final String version;
     private Date startDate;
 
-    RuntimeImmutableCamelContext(CamelContext reference, CamelContext context) {
+    LightweightRuntimeCamelContext(CamelContext reference, CamelContext context) {
         this.reference = reference;
         registry = context.getRegistry();
         typeConverter = new CoreTypeConverterRegistry(context.getTypeConverterRegistry());
diff --git a/core/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java b/core/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
index a5e1560..d641d62 100644
--- a/core/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
+++ b/core/camel-core/src/test/java/org/apache/camel/ContextTestSupport.java
@@ -24,7 +24,7 @@ import org.apache.camel.builder.NotifyBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.lw.ImmutableCamelContext;
+import org.apache.camel.impl.lw.LightweightCamelContext;
 import org.apache.camel.model.ModelCamelContext;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.Registry;
@@ -44,7 +44,7 @@ public abstract class ContextTestSupport extends TestSupport {
     protected volatile ConsumerTemplate consumer;
     protected volatile NotifyBuilder oneExchangeDone;
     private boolean useRouteBuilder = true;
-    private boolean useImmutableContext;
+    private boolean useLightweightContext;
     private Service camelContextService;
 
     /**
@@ -62,12 +62,12 @@ public abstract class ContextTestSupport extends TestSupport {
         this.useRouteBuilder = useRouteBuilder;
     }
 
-    public boolean isUseImmutableContext() {
-        return useImmutableContext;
+    public boolean isUseLightweightContext() {
+        return useLightweightContext;
     }
 
-    public void setUseImmutableContext(boolean useImmutableContext) {
-        this.useImmutableContext = useImmutableContext;
+    public void setUseLightweightContext(boolean useLightweightContext) {
+        this.useLightweightContext = useLightweightContext;
     }
 
     public Service getCamelContextService() {
@@ -180,8 +180,8 @@ public abstract class ContextTestSupport extends TestSupport {
         if (camelContextService != null) {
             camelContextService.start();
         } else {
-            if (context instanceof ImmutableCamelContext) {
-                ImmutableCamelContext ctx = (ImmutableCamelContext) context;
+            if (context instanceof LightweightCamelContext) {
+                LightweightCamelContext ctx = (LightweightCamelContext) context;
                 Boolean autoStartup = ctx.isAutoStartup();
                 ctx.setAutoStartup(false);
                 ctx.start();
@@ -197,8 +197,8 @@ public abstract class ContextTestSupport extends TestSupport {
 
     protected CamelContext createCamelContext() throws Exception {
         CamelContext context;
-        if (useImmutableContext) {
-            ImmutableCamelContext ctx = new ImmutableCamelContext();
+        if (useLightweightContext) {
+            LightweightCamelContext ctx = new LightweightCamelContext();
             ctx.setRegistry(createRegistry());
             context = ctx;
         } else {
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/lw/ImmutableContextTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/lw/LightweightContextTest.java
similarity index 96%
rename from core/camel-core/src/test/java/org/apache/camel/impl/lw/ImmutableContextTest.java
rename to core/camel-core/src/test/java/org/apache/camel/impl/lw/LightweightContextTest.java
index f4b3082..b2110bd 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/lw/ImmutableContextTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/lw/LightweightContextTest.java
@@ -21,12 +21,12 @@ import org.apache.camel.builder.RouteBuilder;
 import org.junit.Before;
 import org.junit.Test;
 
-public class ImmutableContextTest extends ContextTestSupport {
+public class LightweightContextTest extends ContextTestSupport {
 
     @Override
     @Before
     public void setUp() throws Exception {
-        setUseImmutableContext(true);
+        setUseLightweightContext(true);
         super.setUp();
     }
 
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/lw/SplitterLightweightTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/lw/SplitterLightweightTest.java
index d458707..466938a 100644
--- a/core/camel-core/src/test/java/org/apache/camel/impl/lw/SplitterLightweightTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/impl/lw/SplitterLightweightTest.java
@@ -35,7 +35,6 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.processor.MyAggregationStrategy;
 import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class SplitterLightweightTest extends ContextTestSupport {
@@ -43,7 +42,7 @@ public class SplitterLightweightTest extends ContextTestSupport {
     @Override
     @Before
     public void setUp() throws Exception {
-        setUseImmutableContext(true);
+        setUseLightweightContext(true);
         super.setUp();
     }
 
diff --git a/core/camel-main/src/generated/java/org/apache/camel/ExtendedCamelContextConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/ExtendedCamelContextConfigurer.java
index 77383e9..54bd9ff 100644
--- a/core/camel-main/src/generated/java/org/apache/camel/ExtendedCamelContextConfigurer.java
+++ b/core/camel-main/src/generated/java/org/apache/camel/ExtendedCamelContextConfigurer.java
@@ -15,8 +15,6 @@ public class ExtendedCamelContextConfigurer extends org.apache.camel.support.com
     public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
         org.apache.camel.ExtendedCamelContext target = (org.apache.camel.ExtendedCamelContext) obj;
         switch (ignoreCase ? name.toLowerCase() : name) {
-        case "allowaddingnewroutes":
-        case "AllowAddingNewRoutes": target.setAllowAddingNewRoutes(property(camelContext, boolean.class, value)); return true;
         case "allowuseoriginalmessage":
         case "AllowUseOriginalMessage": target.setAllowUseOriginalMessage(property(camelContext, java.lang.Boolean.class, value)); return true;
         case "applicationcontextclassloader":
@@ -33,8 +31,6 @@ public class ExtendedCamelContextConfigurer extends org.apache.camel.support.com
         case "CaseInsensitiveHeaders": target.setCaseInsensitiveHeaders(property(camelContext, java.lang.Boolean.class, value)); return true;
         case "classresolver":
         case "ClassResolver": target.setClassResolver(property(camelContext, org.apache.camel.spi.ClassResolver.class, value)); return true;
-        case "clearmodelreferences":
-        case "ClearModelReferences": target.setClearModelReferences(property(camelContext, boolean.class, value)); return true;
         case "componentnameresolver":
         case "ComponentNameResolver": target.setComponentNameResolver(property(camelContext, org.apache.camel.spi.ComponentNameResolver.class, value)); return true;
         case "componentresolver":
diff --git a/core/camel-main/src/generated/java/org/apache/camel/main/MainConfigurationPropertiesConfigurer.java b/core/camel-main/src/generated/java/org/apache/camel/main/MainConfigurationPropertiesConfigurer.java
index 94897c4..bc8ee06 100644
--- a/core/camel-main/src/generated/java/org/apache/camel/main/MainConfigurationPropertiesConfigurer.java
+++ b/core/camel-main/src/generated/java/org/apache/camel/main/MainConfigurationPropertiesConfigurer.java
@@ -15,8 +15,6 @@ public class MainConfigurationPropertiesConfigurer extends org.apache.camel.supp
     public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
         org.apache.camel.main.MainConfigurationProperties target = (org.apache.camel.main.MainConfigurationProperties) obj;
         switch (ignoreCase ? name.toLowerCase() : name) {
-        case "allowaddingnewroutes":
-        case "AllowAddingNewRoutes": target.setAllowAddingNewRoutes(property(camelContext, boolean.class, value)); return true;
         case "allowuseoriginalmessage":
         case "AllowUseOriginalMessage": target.setAllowUseOriginalMessage(property(camelContext, boolean.class, value)); return true;
         case "autoconfigurationenabled":
@@ -45,8 +43,6 @@ public class MainConfigurationPropertiesConfigurer extends org.apache.camel.supp
         case "BeanIntrospectionLoggingLevel": target.setBeanIntrospectionLoggingLevel(property(camelContext, org.apache.camel.LoggingLevel.class, value)); return true;
         case "caseinsensitiveheaders":
         case "CaseInsensitiveHeaders": target.setCaseInsensitiveHeaders(property(camelContext, boolean.class, value)); return true;
-        case "clearmodelreferences":
-        case "ClearModelReferences": target.setClearModelReferences(property(camelContext, boolean.class, value)); return true;
         case "consumertemplatecachesize":
         case "ConsumerTemplateCacheSize": target.setConsumerTemplateCacheSize(property(camelContext, int.class, value)); return true;
         case "durationhitexitcode":
@@ -83,6 +79,8 @@ public class MainConfigurationPropertiesConfigurer extends org.apache.camel.supp
         case "JmxManagementNamePattern": target.setJmxManagementNamePattern(property(camelContext, java.lang.String.class, value)); return true;
         case "jmxmanagementstatisticslevel":
         case "JmxManagementStatisticsLevel": target.setJmxManagementStatisticsLevel(property(camelContext, org.apache.camel.ManagementStatisticsLevel.class, value)); return true;
+        case "lightweight":
+        case "Lightweight": target.setLightweight(property(camelContext, boolean.class, value)); return true;
         case "loadtypeconverters":
         case "LoadTypeConverters": target.setLoadTypeConverters(property(camelContext, boolean.class, value)); return true;
         case "logdebugmaxchars":
diff --git a/core/camel-main/src/main/java/org/apache/camel/main/Main.java b/core/camel-main/src/main/java/org/apache/camel/main/Main.java
index 8721427..c846850 100644
--- a/core/camel-main/src/main/java/org/apache/camel/main/Main.java
+++ b/core/camel-main/src/main/java/org/apache/camel/main/Main.java
@@ -21,7 +21,7 @@ import java.util.Map;
 import org.apache.camel.CamelContext;
 import org.apache.camel.ProducerTemplate;
 import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.impl.lw.ImmutableCamelContext;
+import org.apache.camel.impl.lw.LightweightCamelContext;
 import org.apache.camel.spi.Registry;
 
 /**
@@ -144,7 +144,7 @@ public class Main extends MainCommandLineSupport {
     @Override
     protected CamelContext createCamelContext() {
         if (mainConfigurationProperties.isLightweight()) {
-            return new ImmutableCamelContext(registry);
+            return new LightweightCamelContext(registry);
         } else {
             return new DefaultCamelContext(registry);
         }