You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2011/09/19 23:04:02 UTC

svn commit: r1172817 - in /camel/branches/camel-2.8.x: ./ components/camel-nagios/src/main/java/org/apache/camel/component/nagios/ components/camel-nagios/src/test/java/org/apache/camel/component/nagios/

Author: dkulp
Date: Mon Sep 19 21:04:02 2011
New Revision: 1172817

URL: http://svn.apache.org/viewvc?rev=1172817&view=rev
Log:
Merged revisions 1159127 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1159127 | davsclaus | 2011-08-18 06:04:47 -0400 (Thu, 18 Aug 2011) | 1 line
  
  CAMEL-4349: Added encryptionMode option to camel-nagios.
........

Added:
    camel/branches/camel-2.8.x/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosEncryptionMethod.java
      - copied unchanged from r1159127, camel/trunk/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosEncryptionMethod.java
    camel/branches/camel-2.8.x/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
      - copied unchanged from r1159127, camel/trunk/components/camel-nagios/src/test/java/org/apache/camel/component/nagios/NagiosXorEncryptionTest.java
Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java?rev=1172817&r1=1172816&r2=1172817&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java (original)
+++ camel/branches/camel-2.8.x/components/camel-nagios/src/main/java/org/apache/camel/component/nagios/NagiosConfiguration.java Mon Sep 19 21:04:02 2011
@@ -18,6 +18,7 @@ package org.apache.camel.component.nagio
 
 import java.net.URI;
 
+import com.googlecode.jsendnsca.core.Encryption;
 import com.googlecode.jsendnsca.core.NagiosSettings;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.ObjectHelper;
@@ -33,7 +34,7 @@ public class NagiosConfiguration impleme
     private int connectionTimeout = 5000;
     private int timeout = 5000;
     private String password;
-
+    private NagiosEncryptionMethod encryptionMethod;
 
     /**
      * Returns a copy of this configuration
@@ -74,6 +75,18 @@ public class NagiosConfiguration impleme
             nagiosSettings.setNagiosHost(getHost());
             nagiosSettings.setPort(getPort());
             nagiosSettings.setPassword(getPassword());
+
+            if (encryptionMethod != null) {
+                if (NagiosEncryptionMethod.No == encryptionMethod) {
+                    nagiosSettings.setEncryptionMethod(Encryption.NO_ENCRYPTION);
+                } else if (NagiosEncryptionMethod.Xor == encryptionMethod) {
+                    nagiosSettings.setEncryptionMethod(Encryption.XOR_ENCRYPTION);
+                } else if (NagiosEncryptionMethod.TripeDes == encryptionMethod) {
+                    nagiosSettings.setEncryptionMethod(Encryption.TRIPLE_DES_ENCRYPTION);
+                } else {
+                    throw new IllegalArgumentException("Unknown encryption method: " + encryptionMethod);
+                }
+            }
         }
 
         return nagiosSettings;
@@ -123,9 +136,18 @@ public class NagiosConfiguration impleme
         this.password = password;
     }
 
+    public NagiosEncryptionMethod getEncryptionMethod() {
+        return encryptionMethod;
+    }
+
+    public void setEncryptionMethod(NagiosEncryptionMethod encryptionMethod) {
+        this.encryptionMethod = encryptionMethod;
+    }
+
     @Override
     public String toString() {
-        return "NagiosConfiguration[host=" + host + ":" + port + ", connectionTimeout=" + connectionTimeout + ", timeout=" + timeout;
+        return "NagiosConfiguration[host=" + host + ":" + port + ", connectionTimeout=" + connectionTimeout
+                + ", timeout=" + timeout + ", encryptionMethod=" + encryptionMethod + "]";
     }
 
 }