You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2013/03/05 09:11:30 UTC

svn commit: r1452690 - in /camel/trunk: components/camel-ssh/ components/camel-ssh/src/main/java/org/apache/camel/component/ssh/ components/camel-ssh/src/test/java/org/apache/camel/component/ssh/ examples/ examples/camel-example-ssh-security/ examples/...

Author: davsclaus
Date: Tue Mar  5 08:11:28 2013
New Revision: 1452690

URL: http://svn.apache.org/r1452690
Log:
CAMEL-6120: camel-ssh easier to load resources. Added new example. Thanks to Scott Cranton for the big patch.

Added:
    camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/ResourceHelperKeyPairProvider.java
    camel/trunk/examples/camel-example-ssh-security/
    camel/trunk/examples/camel-example-ssh-security/README.txt
    camel/trunk/examples/camel-example-ssh-security/pom.xml
    camel/trunk/examples/camel-example-ssh-security/src/
    camel/trunk/examples/camel-example-ssh-security/src/main/
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/LICENSE.txt
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/NOTICE.txt
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/feature/
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/feature/features.xml
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/spring/
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/spring/camelContext.xml
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/log4j.properties
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa
    camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa.pub
    camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/feature/
    camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/feature/features.xml
    camel/trunk/examples/camel-example-ssh/src/main/resources/log4j.properties
Removed:
    camel/trunk/examples/camel-example-ssh/src/main/resources/features.xml
Modified:
    camel/trunk/components/camel-ssh/pom.xml
    camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshComponent.java
    camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
    camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
    camel/trunk/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java
    camel/trunk/examples/camel-example-ssh/pom.xml
    camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/spring/camelContext.xml
    camel/trunk/examples/pom.xml
    camel/trunk/platforms/karaf/features/src/main/resources/features.xml

Modified: camel/trunk/components/camel-ssh/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ssh/pom.xml?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/components/camel-ssh/pom.xml (original)
+++ camel/trunk/components/camel-ssh/pom.xml Tue Mar  5 08:11:28 2013
@@ -15,7 +15,9 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -39,6 +41,7 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.mina</groupId>
       <artifactId>mina-core</artifactId>
@@ -50,22 +53,21 @@
       <version>${sshd-version}</version>
     </dependency>
 
-    <!-- test dependencies -->
-    <dependency>
-      <groupId>org.apache.camel</groupId>
-      <artifactId>camel-test</artifactId>
-      <scope>test</scope>
-    </dependency>
     <dependency>
       <groupId>org.bouncycastle</groupId>
       <artifactId>bcpg-jdk15on</artifactId>
       <version>${bouncycastle-version}</version>
-      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.bouncycastle</groupId>
       <artifactId>bcpkix-jdk15on</artifactId>
       <version>${bouncycastle-version}</version>
+    </dependency>
+
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
       <scope>test</scope>
     </dependency>
     <dependency>

Added: camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/ResourceHelperKeyPairProvider.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/ResourceHelperKeyPairProvider.java?rev=1452690&view=auto
==============================================================================
--- camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/ResourceHelperKeyPairProvider.java (added)
+++ camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/ResourceHelperKeyPairProvider.java Tue Mar  5 08:11:28 2013
@@ -0,0 +1,124 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.ssh;
+
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.security.KeyPair;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.spi.ClassResolver;
+import org.apache.camel.util.ResourceHelper;
+import org.apache.sshd.common.keyprovider.AbstractKeyPairProvider;
+import org.apache.sshd.common.util.IoUtils;
+import org.apache.sshd.common.util.SecurityUtils;
+import org.bouncycastle.openssl.PEMReader;
+import org.bouncycastle.openssl.PasswordFinder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This host key provider loads private keys from the specified resources using
+ * {@link ResourceHelper}, and Camel's resource syntax for file:, classpath:, and http:.
+ * {@link ResourceHelper}, and Camel's resource syntax for file:, classpath:, and http:.
+ *
+ * Note that this class has a direct dependency on BouncyCastle and won't work
+ * unless it has been correctly registered as a security provider.
+ */
+public class ResourceHelperKeyPairProvider extends AbstractKeyPairProvider {
+    protected final transient Logger log = LoggerFactory.getLogger(getClass());
+
+    private ClassResolver classResolver;
+    private String[] resources;
+    private PasswordFinder passwordFinder;
+
+    public ResourceHelperKeyPairProvider() {
+    }
+
+    public ResourceHelperKeyPairProvider(String[] resources,
+                                         ClassResolver classResolver) {
+        this.classResolver = classResolver;
+        this.resources = resources;
+    }
+
+    public ResourceHelperKeyPairProvider(String[] resources,
+                                         PasswordFinder passwordFinder,
+                                         ClassResolver classResolver) {
+        this.classResolver = classResolver;
+        this.resources = resources;
+        this.passwordFinder = passwordFinder;
+    }
+
+    public ClassResolver getClassResolver() {
+        return classResolver;
+    }
+
+    public void setClassResolver(ClassResolver classResolver) {
+        this.classResolver = classResolver;
+    }
+
+    public String[] getResources() {
+        return resources;
+    }
+
+    public void setResources(String[] resources) {
+        this.resources = resources;
+    }
+
+    public PasswordFinder getPasswordFinder() {
+        return passwordFinder;
+    }
+
+    public void setPasswordFinder(PasswordFinder passwordFinder) {
+        this.passwordFinder = passwordFinder;
+    }
+
+    @Override
+    protected KeyPair[] loadKeys() {
+        if (!SecurityUtils.isBouncyCastleRegistered()) {
+            throw new IllegalStateException("BouncyCastle must be registered as a JCE provider");
+        }
+
+        final List<KeyPair> keys =
+                new ArrayList<KeyPair>(this.resources.length);
+
+        for (String resource : resources) {
+            PEMReader r = null;
+            InputStreamReader isr = null;
+            InputStream is = null;
+            try {
+                is = ResourceHelper.resolveMandatoryResourceAsInputStream(classResolver, resource);
+                isr = new InputStreamReader(is);
+                r = new PEMReader(isr, passwordFinder);
+
+                Object o = r.readObject();
+
+                if (o instanceof KeyPair) {
+                    keys.add((KeyPair) o);
+                }
+            } catch (Exception e) {
+                log.warn("Unable to read key", e);
+            } finally {
+                IoUtils.closeQuietly(r, is, isr);
+            }
+        }
+
+        return keys.toArray(new KeyPair[keys.size()]);
+    }
+}

Modified: camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshComponent.java?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshComponent.java (original)
+++ camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshComponent.java Tue Mar  5 08:11:28 2013
@@ -119,11 +119,25 @@ public class SshComponent extends Defaul
         getConfiguration().setTimeout(timeout);
     }
 
+    /**
+     * @deprecated As of version 2.11, replaced by {@link #getCertResource()}
+     */
     public String getCertFilename() {
         return getConfiguration().getCertFilename();
     }
 
+    /**
+     * @deprecated As of version 2.11, replaced by {@link #setCertResource(String)}
+     */
     public void setCertFilename(String certFilename) {
         getConfiguration().setCertFilename(certFilename);
     }
+
+    public String getCertResource() {
+        return getConfiguration().getCertResource();
+    }
+
+    public void setCertResource(String certResource) {
+        getConfiguration().setCertResource(certResource);
+    }
 }

Modified: camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java (original)
+++ camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java Tue Mar  5 08:11:28 2013
@@ -32,7 +32,7 @@ public class SshConfiguration implements
     private String pollCommand;
     private KeyPairProvider keyPairProvider;
     private String keyType = KeyPairProvider.SSH_RSA;
-    private String certFilename;
+    private String certResource;
     private long timeout = 30000;
 
     public SshConfiguration() {
@@ -187,18 +187,32 @@ public class SshConfiguration implements
     public void setTimeout(long timeout) {
         this.timeout = timeout;
     }
-    
+
+    /**
+     * @deprecated As of version 2.11, replaced by {@link #getCertResource()}
+     */
     public String getCertFilename() {
-        return this.certFilename;
+        return ((certResource != null) && certResource.startsWith("file:")) ? certResource.substring(5) : null;
     }
 
     /**
-     * Sets the filename of the certificate to use for Authentication.
-     * Will use FileKeyPairProvider to resolve file based certificate, and depends on keyType setting.
-     *
-     * @param certFilename
+     * @deprecated As of version 2.11, replaced by {@link #setCertResource(String)}
      */
     public void setCertFilename(String certFilename) {
-        this.certFilename = certFilename;
+        this.certResource = "file:" + certFilename;
+    }
+
+    public String getCertResource() {
+        return certResource;
+    }
+
+    /**
+     * Sets the resource path of the certificate to use for Authentication.
+     * Will use {@link ResourceHelperKeyPairProvider} to resolve file based certificate, and depends on keyType setting.
+     *
+     * @param certResource String file, classpath, or http url for the certificate
+     */
+    public void setCertResource(String certResource) {
+        this.certResource = certResource;
     }
 }

Modified: camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java (original)
+++ camel/trunk/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java Tue Mar  5 08:11:28 2013
@@ -32,7 +32,6 @@ import org.apache.sshd.client.future.Aut
 import org.apache.sshd.client.future.ConnectFuture;
 import org.apache.sshd.client.future.OpenFuture;
 import org.apache.sshd.common.KeyPairProvider;
-import org.apache.sshd.common.keyprovider.FileKeyPairProvider;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -99,10 +98,10 @@ public class SshEndpoint extends Schedul
         ClientSession session = connectFuture.getSession();
 
         KeyPairProvider keyPairProvider;
-        final String certFilename = getCertFilename();
-        if (certFilename != null) {
-            log.debug("Attempting to authenticate using FileKey '{}'...", certFilename);
-            keyPairProvider = new FileKeyPairProvider(new String[]{certFilename});
+        final String certResource = getCertResource();
+        if (certResource != null) {
+            log.debug("Attempting to authenticate using ResourceKey '{}'...", certResource);
+            keyPairProvider = new ResourceHelperKeyPairProvider(new String[]{certResource}, getCamelContext().getClassResolver());
         } else {
             keyPairProvider = getKeyPairProvider();
         }
@@ -137,10 +136,10 @@ public class SshEndpoint extends Schedul
         openFuture.await(getTimeout());
         if (openFuture.isOpened()) {
             channel.waitFor(ClientChannel.CLOSED, 0);
-            result = new SshResult(command, channel.getExitStatus(), 
-                                       new ByteArrayInputStream(out.toByteArray()),
-                                       new ByteArrayInputStream(err.toByteArray()));
-            
+            result = new SshResult(command, channel.getExitStatus(),
+                    new ByteArrayInputStream(out.toByteArray()),
+                    new ByteArrayInputStream(err.toByteArray()));
+
         }
 
         return result;
@@ -235,12 +234,26 @@ public class SshEndpoint extends Schedul
     public void setTimeout(long timeout) {
         getConfiguration().setTimeout(timeout);
     }
-    
+
+    /**
+     * @deprecated As of version 2.11, replaced by {@link #getCertResource()}
+     */
     public String getCertFilename() {
         return getConfiguration().getCertFilename();
     }
-    
+
+    /**
+     * @deprecated As of version 2.11, replaced by {@link #setCertResource(String)}
+     */
     public void setCertFilename(String certFilename) {
         getConfiguration().setCertFilename(certFilename);
     }
+
+    public String getCertResource() {
+        return getConfiguration().getCertResource();
+    }
+
+    public void setCertResource(String certResource) {
+        getConfiguration().setCertResource(certResource);
+    }
 }

Modified: camel/trunk/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java (original)
+++ camel/trunk/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentSecurityTest.java Tue Mar  5 08:11:28 2013
@@ -73,7 +73,7 @@ public class SshComponentSecurityTest ex
                         .to("mock:rsa");
 
                 from("direct:ssh-rsaFile")
-                        .to("ssh://smx@localhost:" + port + "?certFilename=src/test/resources/hostkey.pem")
+                        .to("ssh://smx@localhost:" + port + "?certResource=file:src/test/resources/hostkey.pem")
                         .to("mock:rsaFile");
             }
         };

Added: camel/trunk/examples/camel-example-ssh-security/README.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/README.txt?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/README.txt (added)
+++ camel/trunk/examples/camel-example-ssh-security/README.txt Tue Mar  5 08:11:28 2013
@@ -0,0 +1,96 @@
+Camel-SSH using Key Example
+===========================
+
+This examples shows how to use the Camel-SSH component to call Apache Karaf
+using Public Key versus password. It can be run using Maven.
+
+Requirements
+------------
+
+* [Apache Maven](http://maven.apache.org) version 3.x
+* [Apache Karaf](http://karaf.apache.org) version 2.3.1
+
+Setup Karaf
+-----------
+
+We will need to make 2 changes to Karaf for this example to work.
+
+1. Register the Bouncy Castle Java Cryptography Extension (JCE) with Karaf.
+2. Add a user and public key to Karaf's identity store.
+
+### Register Bouncy Castle
+
+We need the Bouncy Castle JCE as Karaf's included Mina SSHD server uses this to handle Public Key files.
+
+Install the following jars into the `<karaf_home>/lib/ext` directory.
+
+    curl -O http://downloads.bouncycastle.org/java/bcprov-jdk15on-147.jar
+    curl -O http://downloads.bouncycastle.org/java/bcprov-ext-jdk15on-147.jar
+    curl -O http://downloads.bouncycastle.org/java/bcpkix-jdk15on-147.jar
+
+Edit the `<karaf_home>/etc/config.properties` file, making 2 changes
+
+1. add the following line
+
+    org.apache.karaf.security.providers = org.bouncycastle.jce.provider.BouncyCastleProvider
+
+2. update the `org.osgi.framework.bootdelegation` property, appending `,org.bouncycastle.*` to the end. It should look
+something like the following when done
+
+    org.osgi.framework.bootdelegation=org.apache.karaf.jaas.boot,sun.*,com.sun.*,javax.transaction,javax.transaction.*,org.bouncycastle.*
+
+### Add a user and public key
+
+Edit the `<karaf_home>/etc/keys.properties` file, appending a new user `scott`. The format of the keys.properties
+file is as follows
+
+    <user name>=<public key>,<role>
+
+For this example you will need to add a new user `scott` with the key value from the included
+`src/main/resources/test_rsa.pub` file. The included Camel route uses the associated private key
+`src/main/resources/test_rsa` when connecting to the updated Karaf server.
+
+Append the following to the `<karaf_home>/etc/keys.properties` file
+
+    scott=AAAAB3NzaC1yc2EAAAADAQABAAABAQC4MSqXneGVM9n3Rnqfya0D31crTx+J8X8dKZ5/+2Rq96/klnmt6uGyl+DI8G0HXVK66KqU2Z0qUE9ytOMR+zSPA+zU4Bhd3G82qdJsys7Nz8t9wSWQs8/ItWTjwg+b3vVLcI1Q8sSgfxqZvD/XQk4srbDs9ba55yjEPn5DOhA7UFbFAv8menSgbpNFMrUQQ9DJcMVlu3MOcMylI5UFFf1uvDD3vUoFXZa6GQOK9j1AGvfagGgBEqV4/AiKzDmQDFqMzmTfTfBpi1crY0SGXdT26PE4Knx7KP7bBJupBm6lJ9Pk39iw8dnDWcq45EEqrHsI0dps7/iQgYxYqBmFLIkP,admin
+
+### Start Karaf
+
+Karaf should be all configured at this point so start up an instance by running the `bin/karaf` from
+the `<karaf_home>` directory.
+
+Building this example
+---------------------
+
+To build, run the following command
+
+    mvn clean install
+
+To test locally, assuming you have Setup Karaf and have it running, run the following command
+
+    mvn camel:run
+
+To stop the example hit ctrl + c
+
+Deploy to Karaf
+---------------
+
+From the running Karaf console, run the following commands to install this example into your
+running Karaf server.
+
+    features:addurl mvn:org.apache.camel/camel-example-ssh-security/<camel version>/xml/features
+    features:install camel-example-ssh-security
+
+This example outputs into the Karaf log file so you can either `tail -f <karaf_home>data/log/karaf.log`
+or from the Karaf console run the following command
+
+    log:tail
+
+If you hit any problems please let us know on the Camel Forums
+  http://camel.apache.org/discussion-forums.html
+
+Please help us make Apache Camel better - we appreciate any feedback you
+may have. Enjoy!
+
+-----------------
+The Camel riders!

Added: camel/trunk/examples/camel-example-ssh-security/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/pom.xml?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/pom.xml (added)
+++ camel/trunk/examples/camel-example-ssh-security/pom.xml Tue Mar  5 08:11:28 2013
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>examples</artifactId>
+    <version>2.11-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>camel-example-ssh-security</artifactId>
+  <packaging>bundle</packaging>
+  <name>Camel :: Example :: SSH :: Security</name>
+  <description>A Certificate secured SSH example that creates a bundle that can be dropped into any OSGi container
+  </description>
+
+  <properties>
+    <camel.osgi.export.pkg></camel.osgi.export.pkg>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-core</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-spring</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-ssh</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.mina</groupId>
+      <artifactId>mina-core</artifactId>
+      <version>${mina2-version}</version>
+    </dependency>
+
+    <!-- Public Key dependencies -->
+    <dependency>
+      <groupId>org.apache.sshd</groupId>
+      <artifactId>sshd-core</artifactId>
+      <version>${sshd-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcpg-jdk15on</artifactId>
+      <version>${bouncycastle-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcpkix-jdk15on</artifactId>
+      <version>${bouncycastle-version}</version>
+    </dependency>
+
+    <!-- logging dependencies -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4j-version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>${slf4j-version}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>${log4j-version}</version>
+      <scope>runtime</scope>
+    </dependency>
+
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit-version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <defaultGoal>install</defaultGoal>
+
+    <resources>
+      <resource>
+        <directory>${project.basedir}/src/main/resources</directory>
+        <excludes>
+          <exclude>**/features.xml</exclude>
+        </excludes>
+        <filtering>false</filtering>
+      </resource>
+      <resource>
+        <directory>${project.basedir}/src/main/resources</directory>
+        <includes>
+          <include>**/features.xml</include>
+        </includes>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+
+    <plugins>
+      <!-- to generate the MANIFEST-FILE of the bundle -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Import-Package>*</Import-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>attach-artifacts</id>
+            <phase>package</phase>
+            <goals>
+              <goal>attach-artifact</goal>
+            </goals>
+            <configuration>
+              <artifacts>
+                <artifact>
+                  <file>${project.build.outputDirectory}/META-INF/feature/features.xml</file>
+                  <type>xml</type>
+                  <classifier>features</classifier>
+                </artifact>
+              </artifacts>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- Allows the routes to be run via 'mvn camel:run' -->
+      <plugin>
+        <groupId>org.apache.camel</groupId>
+        <artifactId>camel-maven-plugin</artifactId>
+        <version>${project.version}</version>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Added: camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/LICENSE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/LICENSE.txt?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/LICENSE.txt (added)
+++ camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/LICENSE.txt Tue Mar  5 08:11:28 2013
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+

Added: camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/NOTICE.txt
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/NOTICE.txt?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/NOTICE.txt (added)
+++ camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/NOTICE.txt Tue Mar  5 08:11:28 2013
@@ -0,0 +1,11 @@
+   =========================================================================
+   ==  NOTICE file corresponding to the section 4 d of                    ==
+   ==  the Apache License, Version 2.0,                                   ==
+   ==  in this case for the Apache Camel distribution.                    ==
+   =========================================================================
+
+   This product includes software developed by
+   The Apache Software Foundation (http://www.apache.org/).
+
+   Please read the different LICENSE files present in the licenses directory of
+   this distribution.

Added: camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/feature/features.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/feature/features.xml?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/feature/features.xml (added)
+++ camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/feature/features.xml Tue Mar  5 08:11:28 2013
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<features name="camel-example-ssh-security-${project.version}"
+          xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0">
+  <repository>mvn:org.apache.camel.karaf/apache-camel/${project.version}/xml/features</repository>
+
+  <feature name="camel-example-ssh-security" version="${project.version}">
+    <feature version="${project.version}">camel-ssh</feature>
+    <feature version="${project.version}">camel-spring</feature>
+    <bundle>mvn:org.apache.camel/camel-example-ssh-security/${project.version}</bundle>
+  </feature>
+</features>
\ No newline at end of file

Added: camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/spring/camelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/spring/camelContext.xml?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/spring/camelContext.xml (added)
+++ camel/trunk/examples/camel-example-ssh-security/src/main/resources/META-INF/spring/camelContext.xml Tue Mar  5 08:11:28 2013
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~      http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:camel="http://camel.apache.org/schema/spring"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="
+         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
+
+  <!--
+      Note: you need to XMl or URL encode newlines
+            XML encoding = &#10;
+            URL encoding = %0A
+  -->
+  <camelContext id="camel-example-ssh-security-context"
+                xmlns="http://camel.apache.org/schema/spring">
+    <route id="camel-example-ssh-consumer-secure" autoStartup="true">
+      <from uri="ssh://scott@localhost:8101?certResource=classpath:test_rsa&amp;useFixedDelay=true&amp;delay=5000&amp;pollCommand=features:list%0A"/>
+      <log message="${body}"/>
+    </route>
+  </camelContext>
+
+</beans>

Added: camel/trunk/examples/camel-example-ssh-security/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/src/main/resources/log4j.properties?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/src/main/resources/log4j.properties (added)
+++ camel/trunk/examples/camel-example-ssh-security/src/main/resources/log4j.properties Tue Mar  5 08:11:28 2013
@@ -0,0 +1,72 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, out
+
+#log4j.logger.org.apache.camel.impl.converter=WARN
+#log4j.logger.org.apache.camel.management=WARN
+log4j.logger.org.apache.camel.impl.DefaultPackageScanClassResolver=WARN
+#log4j.logger.org.apache.camel.impl.converter.DefaultTypeConverter=TRACE
+#log4j.logger.org.apache.camel.impl.converter=DEBUG
+
+#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel.builder=TRACE
+#log4j.logger.org.apache.camel.language.simple=TRACE
+#log4j.logger.org.apache.camel.component=TRACE
+#log4j.logger.org.apache.camel.component.seda=TRACE
+#log4j.logger.org.apache.camel.component.file=TRACE
+#log4j.logger.org.apache.camel.impl.DefaultUnitOfWork=TRACE
+#log4j.logger.org.apache.camel.impl.DefaultExecutorServiceManager=TRACE
+#log4j.logger.org.apache.camel.component.mock=DEBUG
+#log4j.logger.org.apache.camel.component.file=TRACE
+#log4j.logger.org.apache.camel.processor.DefaultErrorHandler=TRACE
+#log4j.logger.org.apache.camel.processor.Pipeline=TRACE
+#log4j.logger.org.apache.camel.processor.MulticastProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.RecipientList=TRACE
+#log4j.logger.org.apache.camel.processor.RecipientListProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.RoutingSlip=TRACE
+#log4j.logger.org.apache.camel.processor.TryProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.loadbalancer=TRACE
+#log4j.logger.org.apache.camel.processor.Delayer=TRACE
+#log4j.logger.org.apache.camel.processor.Throttler=TRACE
+#log4j.logger.org.apache.camel.processor.aggregate.AggregateProcessor=DEBUG
+#log4j.logger.org.apache.camel.impl=TRACE
+#log4j.logger.org.apache.camel.util.FileUtil=TRACE
+#log4j.logger.org.apache.camel.util.AsyncProcessorHelper=TRACE
+#log4j.logger.org.apache.camel.util.ServiceHelper=TRACE
+#log4j.logger.org.apache.camel.util.jsse=TRACE
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camelexchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.file=target/camel-core-test.log
+log4j.appender.file.append=true
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+
+log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file

Added: camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa (added)
+++ camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa Tue Mar  5 08:11:28 2013
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEAuDEql53hlTPZ90Z6n8mtA99XK08fifF/HSmef/tkavev5JZ5
+rerhspfgyPBtB11SuuiqlNmdKlBPcrTjEfs0jwPs1OAYXdxvNqnSbMrOzc/LfcEl
+kLPPyLVk48IPm971S3CNUPLEoH8ambw/10JOLK2w7PW2uecoxD5+QzoQO1BWxQL/
+Jnp0oG6TRTK1EEPQyXDFZbtzDnDMpSOVBRX9brww971KBV2WuhkDivY9QBr32oBo
+ARKlePwIisw5kAxajM5k303waYtXK2NEhl3U9ujxOCp8eyj+2wSbqQZupSfT5N/Y
+sPHZw1nKuORBKqx7CNHabO/4kIGMWKgZhSyJDwIDAQABAoIBAQCTuzuCJ6tK1C+6
+WNj5V/Rg6r0ri2asaPmfFkZ+N8+uy8JUASzPBVjIuXAdOlj4Uy2LpBlNEc0wpwFR
+6ytEvMrG+kr14lco0SiSG1sezvtXr5Zy4nuSt+WsAXFOC9QhHI55V2jAyDZU1B0t
+uQMrT48L3rPNGrbYHENiQw1aNjPWnZiFB97TiEQI3+7LbtTq+/9+nIBZD9wk3Xy0
+lbLnFL6PYgwinFnE7QueH3/+DexygKxc0BqnVt3KVupk6FSEWXIs1nj8fJmw5fKf
+QvTILWn6Eju1muG5AyIr0HwLaTwbYzXZpMbss+GXAQqJUZXLgP7uM1iysad79TgV
+TgPpsanhAoGBAON897gcJFVd6gPGgiX1qEBeTUqRGFmaw4+WQE3tOJp8RKfwyhBd
+EplAVXdL3NitYHxoX8PXf+CBOYFP985Xxngh18atjC7oZXEf7CubIHx1XIrY//w1
+6Q6ohRTcj8+uaO2TTuTOtuw3vrytUcmi6uxA56h5dwTq5jLN8mJxSv69AoGBAM9H
+B3W9QSSmiJNB/5d9zO+59XOEgrxPQj262r9dfdz0w0KjmDVEmEnEcFqF+zRgA4+e
+83emp0wBG3mYDXjGeY4mvNkNM+dtPX4RmBQXgmA+FayGDpaJrrEadxKOVQm8ezdz
+7/pxDSLoxUNBfretDHNMEBxMN20uXDEvMoEs1Bm7AoGAZ6Cfv7CiJHkZhwrAcsZL
+FLdggh1CeF71wszxEg6EAGunYtFfWsDrHgCebi+StOmV0FZDeZULXZvANFXXTpnR
+gRv5jTm1aBDZVQTzspGB5PAZbe6X/a4ZMmI17WDj6flLNx4pjDVWQpjKPGy/mxip
+52FRpf9e5lCS+IW0an+taAkCgYBGN2CekQsVWFjh0bS84//dodg1VslW816UPM1H
+kGtHw56132d7fA4+xw3sjICpoHD0YTtG6Cy6QZHGIi1GIa4h6puEx8Uye74eC+XB
+wKkI419CP3OHqYKFOlrl7VN/Zdsz0NGVvGBf2AyjGPfNTxDtqfG3NFZ+ZPsUKlHo
+koATawKBgQCX/uVGQ846W6+Ixd9FqLgr/tiyqfIxGBU3fM0eISocudpShcqq23Bd
+fvwiYHvE8YsImrWIXlc4QEEzs3R30OCtuhHHVcSwHPb7RLnN+xNYcDdKKs1FnIiM
+gdQapvz8LOQghmsA7A0JIR9zeJ7yEv/z8BGxcSLuQI3u2d3Lavf2vA==
+-----END RSA PRIVATE KEY-----

Added: camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa.pub
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa.pub?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa.pub (added)
+++ camel/trunk/examples/camel-example-ssh-security/src/main/resources/test_rsa.pub Tue Mar  5 08:11:28 2013
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC4MSqXneGVM9n3Rnqfya0D31crTx+J8X8dKZ5/+2Rq96/klnmt6uGyl+DI8G0HXVK66KqU2Z0qUE9ytOMR+zSPA+zU4Bhd3G82qdJsys7Nz8t9wSWQs8/ItWTjwg+b3vVLcI1Q8sSgfxqZvD/XQk4srbDs9ba55yjEPn5DOhA7UFbFAv8menSgbpNFMrUQQ9DJcMVlu3MOcMylI5UFFf1uvDD3vUoFXZa6GQOK9j1AGvfagGgBEqV4/AiKzDmQDFqMzmTfTfBpi1crY0SGXdT26PE4Knx7KP7bBJupBm6lJ9Pk39iw8dnDWcq45EEqrHsI0dps7/iQgYxYqBmFLIkP test@camel-ssh

Modified: camel/trunk/examples/camel-example-ssh/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh/pom.xml?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-ssh/pom.xml (original)
+++ camel/trunk/examples/camel-example-ssh/pom.xml Tue Mar  5 08:11:28 2013
@@ -15,8 +15,9 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -31,11 +32,10 @@
   <description>A simple SSH example which creates a bundle that can be dropped into any OSGi container</description>
 
   <properties>
-    <camel.osgi.export.pkg>org.apache.camel.example.ssh.*</camel.osgi.export.pkg>
+    <camel.osgi.export.pkg></camel.osgi.export.pkg>
   </properties>
 
   <dependencies>
-
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-core</artifactId>
@@ -44,6 +44,7 @@
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-spring</artifactId>
     </dependency>
+
     <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-ssh</artifactId>
@@ -54,16 +55,64 @@
       <version>${mina2-version}</version>
     </dependency>
 
-    <!-- used for mvn camel:run -->
+    <!-- logging dependencies -->
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>${slf4j-version}</version>
+    </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-simple</artifactId>
+      <artifactId>slf4j-log4j12</artifactId>
       <version>${slf4j-version}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>${log4j-version}</version>
+      <scope>runtime</scope>
     </dependency>
 
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.camel</groupId>
+      <artifactId>camel-test-spring</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>${junit-version}</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
+    <defaultGoal>install</defaultGoal>
+
+    <resources>
+      <resource>
+        <directory>${project.basedir}/src/main/resources</directory>
+        <excludes>
+          <exclude>**/features.xml</exclude>
+        </excludes>
+        <filtering>false</filtering>
+      </resource>
+      <resource>
+        <directory>${project.basedir}/src/main/resources</directory>
+        <includes>
+          <include>**/features.xml</include>
+        </includes>
+        <filtering>true</filtering>
+      </resource>
+    </resources>
+
     <plugins>
       <!-- to generate the MANIFEST-FILE of the bundle -->
       <plugin>
@@ -72,10 +121,7 @@
         <extensions>true</extensions>
         <configuration>
           <instructions>
-            <Import-Package>
-              org.apache.camel.component.ssh,
-              *
-            </Import-Package>
+            <Import-Package>*</Import-Package>
           </instructions>
         </configuration>
       </plugin>
@@ -93,7 +139,7 @@
             <configuration>
               <artifacts>
                 <artifact>
-                  <file>target/classes/features.xml</file>
+                  <file>${project.build.outputDirectory}/META-INF/feature/features.xml</file>
                   <type>xml</type>
                   <classifier>features</classifier>
                 </artifact>
@@ -110,7 +156,6 @@
         <version>${project.version}</version>
       </plugin>
     </plugins>
-
   </build>
 
 </project>

Added: camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/feature/features.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/feature/features.xml?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/feature/features.xml (added)
+++ camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/feature/features.xml Tue Mar  5 08:11:28 2013
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<features name="camel-example-ssh-${project.version}"
+          xmlns="http://karaf.apache.org/xmlns/features/v1.0.0"
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.0.0 http://karaf.apache.org/xmlns/features/v1.0.0">
+  <repository>mvn:org.apache.camel.karaf/apache-camel/${project.version}/xml/features</repository>
+
+  <feature name="camel-example-ssh" version="${project.version}">
+    <feature version="${project.version}">camel-ssh</feature>
+    <feature version="${project.version}">camel-spring</feature>
+    <bundle>mvn:org.apache.camel/camel-example-ssh/${project.version}</bundle>
+  </feature>
+</features>
\ No newline at end of file

Modified: camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/spring/camelContext.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/spring/camelContext.xml?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/spring/camelContext.xml (original)
+++ camel/trunk/examples/camel-example-ssh/src/main/resources/META-INF/spring/camelContext.xml Tue Mar  5 08:11:28 2013
@@ -17,32 +17,31 @@
 -->
 
 <beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:camel="http://camel.apache.org/schema/spring"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="
          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
          http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
-    <!--
-        Note: you need to XMl or URL encode newlines
-              XML encoding = &#10;
-              URL encoding = %0A
-    -->
-    <camelContext id="camel-example-ssh" xmlns="http://camel.apache.org/schema/spring">
-
-        <route id="camel-example-ssh-consumer">
-            <from uri="ssh://karaf:karaf@localhost:8101?useFixedDelay=true&amp;delay=5000&amp;pollCommand=features:list%0A"/>
-            <to uri="log:ExampleRouter?showAll=true"/>
-        </route>
+  <!--
+      Note: you need to XMl or URL encode newlines
+            XML encoding = &#10;
+            URL encoding = %0A
+  -->
+  <camelContext id="camel-example-ssh" xmlns="http://camel.apache.org/schema/spring">
+    <route id="camel-example-ssh-consumer">
+      <from uri="ssh://karaf:karaf@localhost:8101?useFixedDelay=true&amp;delay=5000&amp;pollCommand=features:list%0A"/>
+      <log message="${body}"/>
+    </route>
 
-        <route id="camel-example-ssh-producer">
-            <from uri="direct:exampleSshProducer"/>
-            <setBody>
-                <constant>features:list&#10;</constant>
-            </setBody>
-            <to uri="ssh://karaf:karaf@localhost:8101"/>
-            <to uri="log:ExampleRouter?showAll=true"/>
-        </route>
-    </camelContext>
+    <route id="camel-example-ssh-producer">
+      <from uri="direct:exampleSshProducer"/>
+      <setBody>
+        <constant>features:list&#10;</constant>
+      </setBody>
+      <to uri="ssh://karaf:karaf@localhost:8101"/>
+      <log message="${body}"/>
+    </route>
+  </camelContext>
 
 </beans>

Added: camel/trunk/examples/camel-example-ssh/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-ssh/src/main/resources/log4j.properties?rev=1452690&view=auto
==============================================================================
--- camel/trunk/examples/camel-example-ssh/src/main/resources/log4j.properties (added)
+++ camel/trunk/examples/camel-example-ssh/src/main/resources/log4j.properties Tue Mar  5 08:11:28 2013
@@ -0,0 +1,72 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, out
+
+#log4j.logger.org.apache.camel.impl.converter=WARN
+#log4j.logger.org.apache.camel.management=WARN
+log4j.logger.org.apache.camel.impl.DefaultPackageScanClassResolver=WARN
+#log4j.logger.org.apache.camel.impl.converter.DefaultTypeConverter=TRACE
+#log4j.logger.org.apache.camel.impl.converter=DEBUG
+
+#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel.builder=TRACE
+#log4j.logger.org.apache.camel.language.simple=TRACE
+#log4j.logger.org.apache.camel.component=TRACE
+#log4j.logger.org.apache.camel.component.seda=TRACE
+#log4j.logger.org.apache.camel.component.file=TRACE
+#log4j.logger.org.apache.camel.impl.DefaultUnitOfWork=TRACE
+#log4j.logger.org.apache.camel.impl.DefaultExecutorServiceManager=TRACE
+#log4j.logger.org.apache.camel.component.mock=DEBUG
+#log4j.logger.org.apache.camel.component.file=TRACE
+#log4j.logger.org.apache.camel.processor.DefaultErrorHandler=TRACE
+#log4j.logger.org.apache.camel.processor.Pipeline=TRACE
+#log4j.logger.org.apache.camel.processor.MulticastProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.RecipientList=TRACE
+#log4j.logger.org.apache.camel.processor.RecipientListProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.RoutingSlip=TRACE
+#log4j.logger.org.apache.camel.processor.TryProcessor=TRACE
+#log4j.logger.org.apache.camel.processor.loadbalancer=TRACE
+#log4j.logger.org.apache.camel.processor.Delayer=TRACE
+#log4j.logger.org.apache.camel.processor.Throttler=TRACE
+#log4j.logger.org.apache.camel.processor.aggregate.AggregateProcessor=DEBUG
+#log4j.logger.org.apache.camel.impl=TRACE
+#log4j.logger.org.apache.camel.util.FileUtil=TRACE
+#log4j.logger.org.apache.camel.util.AsyncProcessorHelper=TRACE
+#log4j.logger.org.apache.camel.util.ServiceHelper=TRACE
+#log4j.logger.org.apache.camel.util.jsse=TRACE
+
+# CONSOLE appender not used by default
+log4j.appender.out=org.apache.log4j.ConsoleAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camelexchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.file=target/camel-core-test.log
+log4j.appender.file.append=true
+log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+# MDC
+#log4j.appender.file.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %-10.10X{camel.breadcrumbId} - %-10.10X{camel.exchangeId} - %-10.10X{camel.correlationId} - %-10.10X{camel.routeId} - %m%n
+
+log4j.throwableRenderer=org.apache.log4j.EnhancedThrowableRenderer
\ No newline at end of file

Modified: camel/trunk/examples/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/examples/pom.xml?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/examples/pom.xml (original)
+++ camel/trunk/examples/pom.xml Tue Mar  5 08:11:28 2013
@@ -68,6 +68,7 @@
     <module>camel-example-spring-xquery</module>
     <module>camel-example-spring-security</module>
     <module>camel-example-ssh</module>
+    <module>camel-example-ssh-security</module>
     <module>camel-example-sql</module>
     <module>camel-example-tracer</module>
     <module>camel-example-twitter-websocket</module>

Modified: camel/trunk/platforms/karaf/features/src/main/resources/features.xml
URL: http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/src/main/resources/features.xml?rev=1452690&r1=1452689&r2=1452690&view=diff
==============================================================================
--- camel/trunk/platforms/karaf/features/src/main/resources/features.xml (original)
+++ camel/trunk/platforms/karaf/features/src/main/resources/features.xml Tue Mar  5 08:11:28 2013
@@ -892,6 +892,7 @@
     <feature version='${project.version}'>camel-core</feature>
     <bundle dependency="true">mvn:org.apache.mina/mina-core/${mina2-version}</bundle>
     <bundle dependency="true">mvn:org.apache.sshd/sshd-core/${sshd-version}</bundle>
+    <bundle dependency="true">mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle-version}</bundle>
     <bundle>mvn:org.apache.camel/camel-ssh/${project.version}</bundle>
   </feature>
   <feature name='camel-stax' version='${project.version}' resolver='(obr)' start-level='50'>