You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2017/08/22 06:19:57 UTC

[1/2] camel git commit: Revert "CAMEL-11655 - Camel-Nagios: Use Encryption enum instead of EncryptionMethod"

Repository: camel
Updated Branches:
  refs/heads/master f96385a50 -> 716928ced


Revert "CAMEL-11655 - Camel-Nagios: Use Encryption enum instead of EncryptionMethod"

This reverts commit efee1f707a41f3091955e11beab26d0afbf916cd.


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

Branch: refs/heads/master
Commit: 6e5dce3acaa3e1f6b669362198ae39f2cbd587e9
Parents: f96385a
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Aug 22 08:04:20 2017 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Aug 22 08:04:20 2017 +0200

----------------------------------------------------------------------
 .../src/main/docs/nagios-component.adoc         |  2 +-
 .../component/nagios/NagiosConfiguration.java   | 24 ++++++++++----------
 .../nagios/NagiosXorEncryptionTest.java         |  2 +-
 .../NagiosComponentConfiguration.java           | 12 +++++-----
 4 files changed, 20 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6e5dce3a/components/camel-nagios/src/main/docs/nagios-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-nagios/src/main/docs/nagios-component.adoc b/components/camel-nagios/src/main/docs/nagios-component.adoc
index dd040ac..9bc6501 100644
--- a/components/camel-nagios/src/main/docs/nagios-component.adoc
+++ b/components/camel-nagios/src/main/docs/nagios-component.adoc
@@ -81,7 +81,7 @@ with the following path and query parameters:
 | **sendSync** (producer) | Whether or not to use synchronous when sending a passive check. Setting it to false will allow Camel to continue routing the message and the passive check message will be send asynchronously. | true | boolean
 | **timeout** (producer) | Sending timeout in millis. | 5000 | int
 | **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
-| **encryption** (security) | To specify an encryption method. |  | Encryption
+| **encryptionMethod** (security) | To specify an encryption method. |  | NagiosEncryptionMethod
 | **password** (security) | Password to be authenticated when sending checks to Nagios. |  | String
 |=======================================================================
 // endpoint options: END

http://git-wip-us.apache.org/repos/asf/camel/blob/6e5dce3a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
index a4b160a..69cdcee 100644
--- a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
+++ b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
@@ -47,7 +47,7 @@ public class NagiosConfiguration implements Cloneable {
     @UriParam(label = "security", secret = true)
     private String password;
     @UriParam(label = "security")
-    private Encryption encryption = Encryption.NONE;
+    private NagiosEncryptionMethod encryptionMethod;
 
     /**
      * Returns a copy of this configuration
@@ -89,19 +89,19 @@ public class NagiosConfiguration implements Cloneable {
             nagiosSettings.setPort(getPort());
             nagiosSettings.setPassword(getPassword());
 
-            if (encryption != null) {
-                if (Encryption.NONE == encryption) {
+            if (encryptionMethod != null) {
+                if (NagiosEncryptionMethod.No == encryptionMethod) {
                     nagiosSettings.setEncryption(Encryption.NONE);
-                } else if (Encryption.XOR == encryption) {
+                } else if (NagiosEncryptionMethod.Xor == encryptionMethod) {
                     nagiosSettings.setEncryption(Encryption.XOR);
-                } else if (Encryption.TRIPLE_DES == encryption) {
+                } else if (NagiosEncryptionMethod.TripleDes == encryptionMethod) {
                     nagiosSettings.setEncryption(Encryption.TRIPLE_DES);
                 } else {
-                    throw new IllegalArgumentException("Unknown encryption method: " + encryption);
+                    throw new IllegalArgumentException("Unknown encryption method: " + encryptionMethod);
                 }
             }
         }
-        
+
         return nagiosSettings;
     }
 
@@ -164,21 +164,21 @@ public class NagiosConfiguration implements Cloneable {
         this.password = password;
     }
 
-    public Encryption getEncryptionMethod() {
-        return encryption;
+    public NagiosEncryptionMethod getEncryptionMethod() {
+        return encryptionMethod;
     }
 
     /**
      * To specify an encryption method.
      */
-    public void setEncryption(Encryption encryptionMethod) {
-        this.encryption = encryption;
+    public void setEncryptionMethod(NagiosEncryptionMethod encryptionMethod) {
+        this.encryptionMethod = encryptionMethod;
     }
 
     @Override
     public String toString() {
         return "NagiosConfiguration[host=" + host + ":" + port + ", connectionTimeout=" + connectionTimeout
-                + ", timeout=" + timeout + ", encryption=" + encryption + "]";
+                + ", timeout=" + timeout + ", encryptionMethod=" + encryptionMethod + "]";
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/6e5dce3a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java b/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
index cf4766c..d9e5346 100644
--- a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
+++ b/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
@@ -72,7 +72,7 @@ public class NagiosXorEncryptionTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String uri = "nagios:127.0.0.1:25664?password=secret&encryption=Xor";
+                String uri = "nagios:127.0.0.1:25664?password=secret&encryptionMethod=Xor";
 
                 NagiosComponent nagiosComponent = new NagiosComponent();
                 nagiosComponent.setCamelContext(context);

http://git-wip-us.apache.org/repos/asf/camel/blob/6e5dce3a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
index bcbb527..cf7611c 100644
--- a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
@@ -18,7 +18,7 @@ package org.apache.camel.component.nagios.springboot;
 
 import javax.annotation.Generated;
 import com.googlecode.jsendnsca.NagiosSettings;
-import com.googlecode.jsendnsca.encryption.Encryption;
+import org.apache.camel.component.nagios.NagiosEncryptionMethod;
 import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.boot.context.properties.NestedConfigurationProperty;
@@ -90,7 +90,7 @@ public class NagiosComponentConfiguration
         /**
          * To specify an encryption method.
          */
-        private Encryption encryption;
+        private NagiosEncryptionMethod encryptionMethod;
 
         public NagiosSettings getNagiosSettings() {
             return nagiosSettings;
@@ -140,12 +140,12 @@ public class NagiosComponentConfiguration
             this.password = password;
         }
 
-        public Encryption getEncryption() {
-            return encryption;
+        public NagiosEncryptionMethod getEncryptionMethod() {
+            return encryptionMethod;
         }
 
-        public void setEncryption(Encryption encryption) {
-            this.encryption = encryption;
+        public void setEncryptionMethod(NagiosEncryptionMethod encryptionMethod) {
+            this.encryptionMethod = encryptionMethod;
         }
     }
 }
\ No newline at end of file


[2/2] camel git commit: CAMEL-11665 - Camel-Nagios: Deprecate EncryptionMethod and use Encryption Enum

Posted by ac...@apache.org.
CAMEL-11665 - Camel-Nagios: Deprecate EncryptionMethod and use Encryption Enum


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

Branch: refs/heads/master
Commit: 716928ced7c2a40d76ffed2b76d011b2e4e2e379
Parents: 6e5dce3
Author: Andrea Cosentino <an...@gmail.com>
Authored: Tue Aug 22 08:19:22 2017 +0200
Committer: Andrea Cosentino <an...@gmail.com>
Committed: Tue Aug 22 08:19:22 2017 +0200

----------------------------------------------------------------------
 .../src/main/docs/nagios-component.adoc         |  5 ++--
 .../component/nagios/NagiosConfiguration.java   | 29 +++++++++++---------
 .../nagios/NagiosXorEncryptionTest.java         |  2 +-
 .../NagiosComponentConfiguration.java           | 18 ++++++++++++
 4 files changed, 38 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/716928ce/components/camel-nagios/src/main/docs/nagios-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-nagios/src/main/docs/nagios-component.adoc b/components/camel-nagios/src/main/docs/nagios-component.adoc
index 9bc6501..eab5a1a 100644
--- a/components/camel-nagios/src/main/docs/nagios-component.adoc
+++ b/components/camel-nagios/src/main/docs/nagios-component.adoc
@@ -72,7 +72,7 @@ with the following path and query parameters:
 | **port** | *Required* The port number of the host. |  | int
 |=======================================================================
 
-#### Query Parameters (6 parameters):
+#### Query Parameters (7 parameters):
 
 [width="100%",cols="2,5,^1,2",options="header"]
 |=======================================================================
@@ -81,7 +81,8 @@ with the following path and query parameters:
 | **sendSync** (producer) | Whether or not to use synchronous when sending a passive check. Setting it to false will allow Camel to continue routing the message and the passive check message will be send asynchronously. | true | boolean
 | **timeout** (producer) | Sending timeout in millis. | 5000 | int
 | **synchronous** (advanced) | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | false | boolean
-| **encryptionMethod** (security) | To specify an encryption method. |  | NagiosEncryptionMethod
+| **encryption** (security) | To specify an encryption method. |  | Encryption
+| **encryptionMethod** (security) | *Deprecated* To specify an encryption method. |  | NagiosEncryptionMethod
 | **password** (security) | Password to be authenticated when sending checks to Nagios. |  | String
 |=======================================================================
 // endpoint options: END

http://git-wip-us.apache.org/repos/asf/camel/blob/716928ce/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
index 69cdcee..f6af113 100644
--- a/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
+++ b/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
@@ -46,8 +46,11 @@ public class NagiosConfiguration implements Cloneable {
     private int timeout = 5000;
     @UriParam(label = "security", secret = true)
     private String password;
+    @Deprecated
     @UriParam(label = "security")
     private NagiosEncryptionMethod encryptionMethod;
+    @UriParam(label = "security")
+    private Encryption encryption = Encryption.NONE;
 
     /**
      * Returns a copy of this configuration
@@ -88,18 +91,7 @@ public class NagiosConfiguration implements Cloneable {
             nagiosSettings.setNagiosHost(getHost());
             nagiosSettings.setPort(getPort());
             nagiosSettings.setPassword(getPassword());
-
-            if (encryptionMethod != null) {
-                if (NagiosEncryptionMethod.No == encryptionMethod) {
-                    nagiosSettings.setEncryption(Encryption.NONE);
-                } else if (NagiosEncryptionMethod.Xor == encryptionMethod) {
-                    nagiosSettings.setEncryption(Encryption.XOR);
-                } else if (NagiosEncryptionMethod.TripleDes == encryptionMethod) {
-                    nagiosSettings.setEncryption(Encryption.TRIPLE_DES);
-                } else {
-                    throw new IllegalArgumentException("Unknown encryption method: " + encryptionMethod);
-                }
-            }
+            nagiosSettings.setEncryption(encryption);
         }
 
         return nagiosSettings;
@@ -175,10 +167,21 @@ public class NagiosConfiguration implements Cloneable {
         this.encryptionMethod = encryptionMethod;
     }
 
+    public Encryption getEncryption() {
+        return encryption;
+    }
+
+    /**
+     * To specify an encryption method.
+     */
+    public void setEncryption(Encryption encryption) {
+        this.encryption = encryption;
+    }
+
     @Override
     public String toString() {
         return "NagiosConfiguration[host=" + host + ":" + port + ", connectionTimeout=" + connectionTimeout
-                + ", timeout=" + timeout + ", encryptionMethod=" + encryptionMethod + "]";
+                + ", timeout=" + timeout + ", encryptionMethod=" + encryptionMethod + ", encryption=" + encryption + "]";
     }
 
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/716928ce/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java b/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
index d9e5346..cf4766c 100644
--- a/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
+++ b/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
@@ -72,7 +72,7 @@ public class NagiosXorEncryptionTest extends CamelTestSupport {
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                String uri = "nagios:127.0.0.1:25664?password=secret&encryptionMethod=Xor";
+                String uri = "nagios:127.0.0.1:25664?password=secret&encryption=Xor";
 
                 NagiosComponent nagiosComponent = new NagiosComponent();
                 nagiosComponent.setCamelContext(context);

http://git-wip-us.apache.org/repos/asf/camel/blob/716928ce/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
----------------------------------------------------------------------
diff --git a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
index cf7611c..e4db515 100644
--- a/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
+++ b/platforms/spring-boot/components-starter/camel-nagios-starter/src/main/java/org/apache/camel/component/nagios/springboot/NagiosComponentConfiguration.java
@@ -18,9 +18,11 @@ package org.apache.camel.component.nagios.springboot;
 
 import javax.annotation.Generated;
 import com.googlecode.jsendnsca.NagiosSettings;
+import com.googlecode.jsendnsca.encryption.Encryption;
 import org.apache.camel.component.nagios.NagiosEncryptionMethod;
 import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon;
 import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.DeprecatedConfigurationProperty;
 import org.springframework.boot.context.properties.NestedConfigurationProperty;
 
 /**
@@ -90,7 +92,12 @@ public class NagiosComponentConfiguration
         /**
          * To specify an encryption method.
          */
+        @Deprecated
         private NagiosEncryptionMethod encryptionMethod;
+        /**
+         * To specify an encryption method.
+         */
+        private Encryption encryption;
 
         public NagiosSettings getNagiosSettings() {
             return nagiosSettings;
@@ -140,12 +147,23 @@ public class NagiosComponentConfiguration
             this.password = password;
         }
 
+        @Deprecated
+        @DeprecatedConfigurationProperty
         public NagiosEncryptionMethod getEncryptionMethod() {
             return encryptionMethod;
         }
 
+        @Deprecated
         public void setEncryptionMethod(NagiosEncryptionMethod encryptionMethod) {
             this.encryptionMethod = encryptionMethod;
         }
+
+        public Encryption getEncryption() {
+            return encryption;
+        }
+
+        public void setEncryption(Encryption encryption) {
+            this.encryption = encryption;
+        }
     }
 }
\ No newline at end of file