camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/8] camel git commit: CAMEL-10937: Camel components - Configured using setters should support property placeholders
Date Sat, 04 Mar 2017 14:57:43 GMT
Repository: camel
Updated Branches:
  refs/heads/master cc2ff1185 -> bf1b57ca2


http://git-wip-us.apache.org/repos/asf/camel/blob/bf1b57ca/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
index 7094d9e..e54a49e 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/SpringBootAutoConfigurationMojo.java
@@ -205,7 +205,8 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
                 ComponentModel model = compModels.get(0); // They should be equivalent
                 List<String> aliases = compModels.stream().map(ComponentModel::getScheme).sorted().collect(Collectors.toList());
 
-                boolean hasOptions = !model.getComponentOptions().isEmpty();
+                // resolvePropertyPlaceholders is an option which only make sense to use
if the component has other options
+                boolean hasOptions = model.getComponentOptions().stream().anyMatch(o ->
!o.getName().equals("resolvePropertyPlaceholders"));
 
                 // use springboot as sub package name so the code is not in normal
                 // package so the Spring Boot JARs can be optional at runtime

http://git-wip-us.apache.org/repos/asf/camel/blob/bf1b57ca/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
index fe97744..7112e88 100644
--- a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
+++ b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/UpdateReadmeMojo.java
@@ -147,15 +147,18 @@ public class UpdateReadmeMojo extends AbstractMojo {
                     updated = updateTitles(file, model.getTitle() + " Component");
                     updated |= updateAvailableFrom(file, model.getFirstVersion());
 
-                    if (model.getComponentOptions() != null) {
-                        String options = templateComponentOptions(model);
-                        updated |= updateComponentOptions(file, options);
-                    }
-                    if (model.getEndpointOptions() != null) {
-                        String options = templateEndpointOptions(model);
-                        updated |= updateEndpointOptions(file, options);
+                    // resolvePropertyPlaceholders is an option which only make sense to
use if the component has other options
+                    boolean hasOptions = model.getComponentOptions().stream().anyMatch(o
-> !o.getName().equals("resolvePropertyPlaceholders"));
+                    if (!hasOptions) {
+                        model.getComponentOptions().clear();
                     }
 
+                    String options = templateComponentOptions(model);
+                    updated |= updateComponentOptions(file, options);
+
+                    options = templateEndpointOptions(model);
+                    updated |= updateEndpointOptions(file, options);
+
                     if (updated) {
                         getLog().info("Updated doc file: " + file);
                     } else if (exists) {
@@ -199,10 +202,8 @@ public class UpdateReadmeMojo extends AbstractMojo {
                     updated = updateTitles(file, model.getTitle() + " DataFormat");
                     updated |= updateAvailableFrom(file, model.getFirstVersion());
 
-                    if (model.getDataFormatOptions() != null) {
-                        String options = templateDataFormatOptions(model);
-                        updated |= updateDataFormatOptions(file, options);
-                    }
+                    String options = templateDataFormatOptions(model);
+                    updated |= updateDataFormatOptions(file, options);
 
                     if (updated) {
                         getLog().info("Updated doc file: " + file);
@@ -251,10 +252,8 @@ public class UpdateReadmeMojo extends AbstractMojo {
                     updated = updateTitles(file, model.getTitle() + " Language");
                     updated |= updateAvailableFrom(file, model.getFirstVersion());
 
-                    if (model.getLanguageOptions() != null) {
-                        String options = templateLanguageOptions(model);
-                        updated |= updateLanguageOptions(file, options);
-                    }
+                    String options = templateLanguageOptions(model);
+                    updated |= updateLanguageOptions(file, options);
 
                     if (updated) {
                         getLog().info("Updated doc file: " + file);
@@ -293,7 +292,6 @@ public class UpdateReadmeMojo extends AbstractMojo {
             for (File jsonFile : jsonFiles) {
                 String json = loadEipJson(jsonFile);
                 if (json != null) {
-
                     EipModel model = generateEipModel(json);
                     String title = asEipTitle(model.getName(), model.getTitle());
                     model.setTitle(title);
@@ -312,10 +310,8 @@ public class UpdateReadmeMojo extends AbstractMojo {
 
                     updated = updateTitles(file, model.getTitle() + " EIP");
 
-                    if (model.getEipOptions() != null) {
-                        String options = templateEipOptions(model);
-                        updated |= updateEipOptions(file, options);
-                    }
+                    String options = templateEipOptions(model);
+                    updated |= updateEipOptions(file, options);
 
                     if (updated) {
                         getLog().info("Updated doc file: " + file);
@@ -375,10 +371,9 @@ public class UpdateReadmeMojo extends AbstractMojo {
         boolean updated = false;
 
         try {
-            String text = loadText(new FileInputStream(file));
-
             List<String> newLines = new ArrayList<>();
 
+            String text = loadText(new FileInputStream(file));
             String[] lines = text.split("\n");
             for (int i = 0; i < lines.length; i++) {
                 String line = lines[i];


Mime
View raw message