INTSAMPLES-42 rename readme.txt files to README.md
This commit is contained in:
71
basic/sftp/README.md
Normal file
71
basic/sftp/README.md
Normal file
@@ -0,0 +1,71 @@
|
||||
SFTP Sample
|
||||
===========
|
||||
|
||||
This example demonstrates the following aspects of the SFTP support available with Spring Integration:
|
||||
|
||||
1. SFTP Inbound Channel Adapter (transfers files from remote to local directory)
|
||||
2. SFTP Outbound Channel Adapter (transfers files from local to the remote directory)
|
||||
|
||||
In order to run this sample you need to:
|
||||
|
||||
1. generate private/public keys. Below is simple directions what needs to be done
|
||||
2. update user.properties file with appropriate values
|
||||
3. run the sample
|
||||
|
||||
## INBOUND CHANNEL ADAPTER
|
||||
|
||||
To run the NBOUND CHANNEL ADAPTER sample execute **SftpInboundReceiveSample** test. You will see that based on configuration it will access the sample remote directory which contains 3 files and will attempt to securely copy them to a local directory which will be generated. The output should look like this:
|
||||
|
||||
Received first file message: [Payload=local-dir/a.txt][Headers={timestamp=1290066001349, id=9dca686a-cfd4-4d96-a1a7-761feb005e43}]
|
||||
Received second file message: [Payload=local-dir/b.txt][Headers={timestamp=1290066001650, id=d33a475d-fa71-4c5b-b73e-3147969f1c6f}]
|
||||
No third file was received null
|
||||
|
||||
As you can see, although the remote directory had 3 files we only received 2 since we were filtering only the files that end with **txt**.
|
||||
|
||||
## OUTBOUND CHANNEL ADAPTER
|
||||
|
||||
To run the OUTBOUND CHANNEL ADAPTER sample execute the **SftpOutboundTransferSample** test. You will see that based on the configuration it will attempt to transfer this **readme.txt** file to a remote directory **remote-target-dir**. The output should look like this:
|
||||
|
||||
Successfully transfered 'readme.txt' file to a remote location under the name 'readme.txt_foo'
|
||||
|
||||
NOTE: You can see that we are using *SpEL* via the **remote-filename-generator-expression** attribute to define the remote file name by simply appending **_foo** to the original file name.
|
||||
|
||||
## OUTBOUND GATEWAY
|
||||
|
||||
Run the **FtpOutoundGateway** sample as a JUnit test; it creates 2 files, retrieves and removes them over ftp. It cleans up by removing the retrieved files. The test assumes full access to the filesystem via **/tmp** where the test files are created. Requires **sshd** to be running on localhost.
|
||||
|
||||
This sample uses a property **private.keyfile** to point to the location of your private key. Requires setting of **user**, **private.keyfile** and, optionally, **passphrase** in **user.properties**.
|
||||
|
||||
### HOW TO GENERATE KEYS
|
||||
|
||||
>$ ssh-keygen
|
||||
Generating public/private rsa key pair.
|
||||
Enter file in which to save the key (/Users/ozhurakousky/.ssh/id_rsa): ./sftp_rsa
|
||||
Enter passphrase (empty for no passphrase):
|
||||
Enter same passphrase again:
|
||||
Your identification has been saved in ./sftp_rsa.
|
||||
Your public key has been saved in ./sftp_rsa.pub.
|
||||
The key fingerprint is:
|
||||
2c:30:7c:18:3c:a0:d5:83:68:78:7e:c1:5f:c1:3e:3d ozhurakousky@oleg.home
|
||||
The key's randomart image is:
|
||||
+--[ RSA 2048]----+
|
||||
|..o*. ... |
|
||||
|o+o.Bo o |
|
||||
|oo ==.o . |
|
||||
| . .+..o E |
|
||||
| . . S. . |
|
||||
| . |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
+-----------------+
|
||||
>$ ls
|
||||
sftp_rsa sftp_rsa.pub
|
||||
>$
|
||||
|
||||
* Create a file ~/.ssh/authorized_keys and give it the required permissions
|
||||
|
||||
>$ chmod 600 ~/.ssh/authorized_keys
|
||||
|
||||
* Then edit **authorized_keys** file and paste in the contents of the public key file **sftp_rsa.pub**.
|
||||
* Move your private key file **sftp_rsa** to META-INF/keys directory
|
||||
@@ -1,79 +0,0 @@
|
||||
This example demonstrates the following aspects of the SFTP support available with Spring Integration:
|
||||
1. SFTP Inbound Channel Adapter (transfers files from remote to local directory)
|
||||
2. SFTP Outbound Channel Adapter (transfers files from local to the remote directory)
|
||||
|
||||
In order to run this sample you need to
|
||||
1. generate private/public keys. Below is simple directions what needs to be done
|
||||
2. update user.properties file with appropriate values
|
||||
3. run the sample
|
||||
|
||||
#### INBOUND CHANNEL ADAPTER ####
|
||||
|
||||
To run INBOUND CHANNEL ADAPTER sample execute SftpInboundReceiveSample test. You will see that based on configuration it
|
||||
will access sample remote directory which contains 3 files and will attept to securly copy them to a local directory which
|
||||
will be generated.
|
||||
The output should look like this:
|
||||
=====
|
||||
Received first file message: [Payload=local-dir/a.txt][Headers={timestamp=1290066001349, id=9dca686a-cfd4-4d96-a1a7-761feb005e43}]
|
||||
Received second file message: [Payload=local-dir/b.txt][Headers={timestamp=1290066001650, id=d33a475d-fa71-4c5b-b73e-3147969f1c6f}]
|
||||
No third file was received null
|
||||
=====
|
||||
|
||||
As you can see, although the remote directory had 3 files we only received 2 since we were filtering only the files that end with 'txt'.
|
||||
|
||||
#### OUTBOUND CHANNEL ADAPTER ####
|
||||
|
||||
To run OUTBOUND CHANNEL ADAPTER sample execute SftpOutboundTransferSample test. You will see that based on configuration it
|
||||
will attempt to transfer this 'readme.txt' file to a remote directory 'remote-target-dir'
|
||||
The output should look like this:
|
||||
=====
|
||||
Successfully transfered 'readme.txt' file to a remote location under the name 'readme.txt_foo'
|
||||
=====
|
||||
|
||||
NOTE: You can see that we are using SpEL via 'remote-filename-generator-expression' attribute to define the remote file name by
|
||||
simply appending '_foo' to the original file name.
|
||||
|
||||
|
||||
|
||||
#### OUTBOUND GATEWAY ####
|
||||
|
||||
Run the FtpOutoundGateway sample as a JUnit test; it creates 2 files, retrieves and removes them over ftp. It cleans up
|
||||
by removing the retrieved files. Test assumes full access to the filesystem via /tmp where the test files are created.
|
||||
Requires sshd to be running on localhost.
|
||||
|
||||
This sample uses a property 'private.keyfile' to point to the location of your private key.
|
||||
|
||||
Requires setting of user, private.keyfile and, optionally, passphrase in user.properties.
|
||||
|
||||
====== HOW TO GENERATE KEYS ======
|
||||
|
||||
>$ ssh-keygen
|
||||
Generating public/private rsa key pair.
|
||||
Enter file in which to save the key (/Users/ozhurakousky/.ssh/id_rsa): ./sftp_rsa
|
||||
Enter passphrase (empty for no passphrase):
|
||||
Enter same passphrase again:
|
||||
Your identification has been saved in ./sftp_rsa.
|
||||
Your public key has been saved in ./sftp_rsa.pub.
|
||||
The key fingerprint is:
|
||||
2c:30:7c:18:3c:a0:d5:83:68:78:7e:c1:5f:c1:3e:3d ozhurakousky@oleg.home
|
||||
The key's randomart image is:
|
||||
+--[ RSA 2048]----+
|
||||
|..o*. ... |
|
||||
|o+o.Bo o |
|
||||
|oo ==.o . |
|
||||
| . .+..o E |
|
||||
| . . S. . |
|
||||
| . |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
+-----------------+
|
||||
>$ ls
|
||||
sftp_rsa sftp_rsa.pub
|
||||
>$
|
||||
|
||||
2. Create a file ~/.ssh/authorized_keys and give it the required permissions
|
||||
>$ chmod 600 ~/.ssh/authorized_keys
|
||||
|
||||
3. Then edit 'authorized_keys' file and paste in the contents of the public key file 'sftp_rsa.pub' .
|
||||
4. Move your private key file 'sftp_rsa' to META-INF/keys directory
|
||||
Reference in New Issue
Block a user