camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/4] camel git commit: CAMEL-10209: spring boot - Auto configuration for languages
Date Mon, 01 Aug 2016 08:16:19 GMT
Repository: camel
Updated Branches:
  refs/heads/master 077a15d37 -> aa4bdf651


CAMEL-10209: spring boot - Auto configuration for languages


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/aa4bdf65
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/aa4bdf65
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/aa4bdf65

Branch: refs/heads/master
Commit: aa4bdf651c750ffa3f789ea4f69fbb88308e010b
Parents: 53eba31
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Mon Aug 1 10:14:27 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon Aug 1 10:16:12 2016 +0200

----------------------------------------------------------------------
 .../springboot/BeanLanguageConfiguration.java   |  53 ---------
 .../TokenizeLanguageConfiguration.java          | 115 -------------------
 .../XMLTokenizeLanguageConfiguration.java       |  24 ----
 .../springboot/XPathLanguageConfiguration.java  |  12 --
 .../springboot/XQueryLanguageConfiguration.java |  12 --
 .../SpringBootAutoConfigurationMojo.java        |  33 +++++-
 6 files changed, 31 insertions(+), 218 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/aa4bdf65/camel-core/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageConfiguration.java
b/camel-core/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageConfiguration.java
index 6fbb0c6..b39a7ac 100644
--- a/camel-core/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/language/bean/springboot/BeanLanguageConfiguration.java
@@ -17,7 +17,6 @@
 package org.apache.camel.language.bean.springboot;
 
 import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
 
 /**
  * For expressions and predicates using a java bean (aka method call)
@@ -28,63 +27,11 @@ import org.springframework.boot.context.properties.DeprecatedConfigurationProper
 public class BeanLanguageConfiguration {
 
     /**
-     * Either a reference or a class name of the bean to use
-     */
-    @Deprecated
-    private String bean;
-    /**
-     * Reference to bean to lookup in the registry
-     */
-    private String ref;
-    /**
-     * Name of method to call
-     */
-    private String method;
-    /**
-     * Class name of the bean to use
-     */
-    private String beanType;
-    /**
      * Whether to trim the value to remove leading and trailing whitespaces and
      * line breaks
      */
     private Boolean trim = true;
 
-    @Deprecated
-    @DeprecatedConfigurationProperty
-    public String getBean() {
-        return bean;
-    }
-
-    @Deprecated
-    public void setBean(String bean) {
-        this.bean = bean;
-    }
-
-    public String getRef() {
-        return ref;
-    }
-
-    public void setRef(String ref) {
-        this.ref = ref;
-    }
-
-    public String getMethod() {
-        return method;
-    }
-
-    public void setMethod(String method) {
-        this.method = method;
-    }
-
-    public String getBeanType() {
-        return beanType;
-    }
-
-    public void setBeanType(String beanType) {
-        this.beanType = beanType;
-    }
-
     public Boolean getTrim() {
         return trim;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/aa4bdf65/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageConfiguration.java
b/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageConfiguration.java
index 099015a..8d0632e 100644
--- a/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/TokenizeLanguageConfiguration.java
@@ -27,126 +27,11 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
 public class TokenizeLanguageConfiguration {
 
     /**
-     * The (start) token to use as tokenizer for example \n for a new line
-     * token. You can use simple language as the token to support dynamic
-     * tokens.
-     */
-    private String token;
-    /**
-     * The end token to use as tokenizer if using start/end token pairs. You can
-     * use simple language as the token to support dynamic tokens.
-     */
-    private String endToken;
-    /**
-     * To inherit namespaces from a root/parent tag name when using XML You can
-     * use simple language as the tag name to support dynamic names.
-     */
-    private String inheritNamespaceTagName;
-    /**
-     * Name of header to tokenize instead of using the message body.
-     */
-    private String headerName;
-    /**
-     * If the token is a regular expression pattern. The default value is false
-     */
-    private Boolean regex = false;
-    /**
-     * Whether the input is XML messages. This option must be set to true if
-     * working with XML payloads.
-     */
-    private Boolean xml = false;
-    /**
-     * Whether to include the tokens in the parts when using pairs The default
-     * value is false
-     */
-    private Boolean includeTokens = false;
-    /**
-     * To group N parts together for example to split big files into chunks of
-     * 1000 lines.
-     */
-    private Integer group;
-    /**
-     * To skip the very first element
-     */
-    private Boolean skipFirst = false;
-    /**
      * Whether to trim the value to remove leading and trailing whitespaces and
      * line breaks
      */
     private Boolean trim = true;
 
-    public String getToken() {
-        return token;
-    }
-
-    public void setToken(String token) {
-        this.token = token;
-    }
-
-    public String getEndToken() {
-        return endToken;
-    }
-
-    public void setEndToken(String endToken) {
-        this.endToken = endToken;
-    }
-
-    public String getInheritNamespaceTagName() {
-        return inheritNamespaceTagName;
-    }
-
-    public void setInheritNamespaceTagName(String inheritNamespaceTagName) {
-        this.inheritNamespaceTagName = inheritNamespaceTagName;
-    }
-
-    public String getHeaderName() {
-        return headerName;
-    }
-
-    public void setHeaderName(String headerName) {
-        this.headerName = headerName;
-    }
-
-    public Boolean getRegex() {
-        return regex;
-    }
-
-    public void setRegex(Boolean regex) {
-        this.regex = regex;
-    }
-
-    public Boolean getXml() {
-        return xml;
-    }
-
-    public void setXml(Boolean xml) {
-        this.xml = xml;
-    }
-
-    public Boolean getIncludeTokens() {
-        return includeTokens;
-    }
-
-    public void setIncludeTokens(Boolean includeTokens) {
-        this.includeTokens = includeTokens;
-    }
-
-    public Integer getGroup() {
-        return group;
-    }
-
-    public void setGroup(Integer group) {
-        this.group = group;
-    }
-
-    public Boolean getSkipFirst() {
-        return skipFirst;
-    }
-
-    public void setSkipFirst(Boolean skipFirst) {
-        this.skipFirst = skipFirst;
-    }
-
     public Boolean getTrim() {
         return trim;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/aa4bdf65/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageConfiguration.java
b/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageConfiguration.java
index 00d591e..a245dc4 100644
--- a/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/language/tokenizer/springboot/XMLTokenizeLanguageConfiguration.java
@@ -27,10 +27,6 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
 public class XMLTokenizeLanguageConfiguration {
 
     /**
-     * Name of header to tokenize instead of using the message body.
-     */
-    private String headerName;
-    /**
      * The extraction mode. The available extraction modes are: i - injecting
      * the contextual namespace bindings into the extracted token (default) w -
      * wrapping the extracted token in its ancestor context u - unwrapping the
@@ -39,23 +35,11 @@ public class XMLTokenizeLanguageConfiguration {
      */
     private String mode;
     /**
-     * To group N parts together
-     */
-    private Integer group;
-    /**
      * Whether to trim the value to remove leading and trailing whitespaces and
      * line breaks
      */
     private Boolean trim = true;
 
-    public String getHeaderName() {
-        return headerName;
-    }
-
-    public void setHeaderName(String headerName) {
-        this.headerName = headerName;
-    }
-
     public String getMode() {
         return mode;
     }
@@ -64,14 +48,6 @@ public class XMLTokenizeLanguageConfiguration {
         this.mode = mode;
     }
 
-    public Integer getGroup() {
-        return group;
-    }
-
-    public void setGroup(Integer group) {
-        this.group = group;
-    }
-
     public Boolean getTrim() {
         return trim;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/aa4bdf65/camel-core/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageConfiguration.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageConfiguration.java
b/camel-core/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageConfiguration.java
index ea54a32..efa0046 100644
--- a/camel-core/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageConfiguration.java
+++ b/camel-core/src/main/java/org/apache/camel/language/xpath/springboot/XPathLanguageConfiguration.java
@@ -47,10 +47,6 @@ public class XPathLanguageConfiguration {
      */
     private Boolean logNamespaces = false;
     /**
-     * Name of header to use as input instead of the message body
-     */
-    private String headerName;
-    /**
      * Whether to trim the value to remove leading and trailing whitespaces and
      * line breaks
      */
@@ -96,14 +92,6 @@ public class XPathLanguageConfiguration {
         this.logNamespaces = logNamespaces;
     }
 
-    public String getHeaderName() {
-        return headerName;
-    }
-
-    public void setHeaderName(String headerName) {
-        this.headerName = headerName;
-    }
-
     public Boolean getTrim() {
         return trim;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/aa4bdf65/components/camel-saxon/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-saxon/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageConfiguration.java
b/components/camel-saxon/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageConfiguration.java
index fda83c3..d45e4c4 100644
--- a/components/camel-saxon/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageConfiguration.java
+++ b/components/camel-saxon/src/main/java/org/apache/camel/language/xquery/springboot/XQueryLanguageConfiguration.java
@@ -32,10 +32,6 @@ public class XQueryLanguageConfiguration {
      */
     private String type;
     /**
-     * Name of header to use as input instead of the message body
-     */
-    private String headerName;
-    /**
      * Whether to trim the value to remove leading and trailing whitespaces and
      * line breaks
      */
@@ -49,14 +45,6 @@ public class XQueryLanguageConfiguration {
         this.type = type;
     }
 
-    public String getHeaderName() {
-        return headerName;
-    }
-
-    public void setHeaderName(String headerName) {
-        this.headerName = headerName;
-    }
-
     public Boolean getTrim() {
         return trim;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/aa4bdf65/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 85cd583..92e85b4 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
@@ -251,7 +251,7 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
 
                     String overrideLanguageName = null;
                     if (aliases.size() > 1) {
-                        // determine component name when there are multiple ones
+                        // determine language name when there are multiple ones
                         overrideLanguageName = model.getArtifactId().replace("camel-", "");
                     }
 
@@ -469,10 +469,39 @@ public class SpringBootAutoConfigurationMojo extends AbstractMojo {
         javaClass.addAnnotation("org.springframework.boot.context.properties.ConfigurationProperties").setStringValue("prefix",
prefix);
 
         for (LanguageOptionModel option : model.getLanguageOptions()) {
-            // skip option with name id, expression, or resultType in language as we do not
need that
+            // skip option with name id, or expression in language as we do not need that
and skip resultType as they are not global options
             if ("id".equals(option.getName()) || "expression".equals(option.getName()) ||
"resultType".equals(option.getName())) {
                 continue;
             }
+            if ("bean".equals(model.getName())) {
+                // and skip following as they are not global options
+                if ("bean".equals(option.getName()) || "ref".equals(option.getName()) ||
"method".equals(option.getName()) || "beanType".equals(option.getName())) {
+                    continue;
+                }
+            } else if ("tokenize".equals(model.getName())) {
+                // and skip following as they are not global options
+                if ("token".equals(option.getName()) || "endToken".equals(option.getName())
|| "inheritNamespaceTagName".equals(option.getName())
+                        || "headerName".equals(option.getName()) || "regex".equals(option.getName())
|| "xml".equals(option.getName())
+                        || "includeTokens".equals(option.getName()) || "group".equals(option.getName())
|| "skipFirst".equals(option.getName())) {
+                    continue;
+                }
+            } else if ("xtokenize".equals(model.getName())) {
+                // and skip following as they are not global options
+                if ("headerName".equals(option.getName()) || "group".equals(option.getName()))
{
+                    continue;
+                }
+            } else if ("xpath".equals(model.getName())) {
+                // and skip following as they are not global options
+                if ("headerName".equals(option.getName())) {
+                    continue;
+                }
+            } else if ("xquery".equals(model.getName())) {
+                // and skip following as they are not global options
+                if ("headerName".equals(option.getName())) {
+                    continue;
+                }
+            }
+
             // remove <?> as generic type as Roaster (Eclipse JDT) cannot use that
             String type = option.getJavaType();
             type = type.replaceAll("\\<\\?\\>", "");


Mime
View raw message