Permalink
Browse files

added initial version open source version

  • Loading branch information...
cosmin committed Jul 4, 2012
0 parents commit 8d0a03a2750a2a6e9f9d43af02e3fd98840d5072
@@ -0,0 +1,3 @@
+/target
+.idea
+*.iml
41 LICENSE
@@ -0,0 +1,41 @@
+Copyright (c) 2012 Simple Finance Technology Corp.
+
+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.
+
+
+
+
+GPG File Decryption code based the KeyBasedFileProcessor example code
+from bouncycastle.org, originally distributed under the following
+license:
+
+Copyright (c) 2000 - 2011 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
@@ -0,0 +1,65 @@
+# sftp-fetch
+
+Download new files from an SFTP server and publish them to a queue,
+using S3 to hold the data.
+
+## Configuration
+
+First, create a properties file that looks like
+
+```
+sftp.hostname=<the.sftp.hostname>
+sftp.username=<the.sftp.username>
+sftp.password=<the.sftp.password>
+sftp.folder=<the.sftp.folder.to.download.from>
+
+rabbit.hostname=<the.rabbit.hostname>
+rabbit.port=5672
+rabbit.username=<the.rabbit.username>
+rabbit.password=<the.rabbit.password>
+rabbit.vhost=<the.rabbit.vhost>
+rabbit.exchange=<the.rabbit.exchange>
+
+s3.bucket=<s3.bucket>
+fetch.days=<number.of.days.to.fetch>
+```
+
+## Usage
+
+### The Basics
+
+Once you have created the appropriate config files you can invoke
+
+```
+java -jar sftp-fetch.jar -c </path/to/properties/file> -n
+```
+
+This will show you what files it would process without actually doing
+it. Run without `-n` to actually process. Files that have already been
+processed will be skipped unless you run with `--overwrite`
+
+### Files that match a pattern
+
+Optionally you can restrict operations only to files that match a
+certain pattern using `-p`
+
+```
+java -jar sftp-fetch.jar -c </path/to/properties/file> -r <routingkey> -p '.*SomeFileName.*'
+```
+
+### Specify the routing key
+
+You can specify a routing key using `--routing-key` at the command
+line or `rabbit.routingkey` in the property file.
+
+### GPG decryption
+
+If you are fetching GPG encrypted files from SFTP you can optionally
+have `sft-fetch` decrypt them by supplying the path to the GPG private
+key in the property file using
+
+```
+decryption.key.path=</path/to/pgp/private/key>
+```
+
+Currently encrypted private keys are not supported.
155 pom.xml
@@ -0,0 +1,155 @@
+<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>
+
+ <groupId>com.simple</groupId>
+ <artifactId>sftp-fetch</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0.1-SNAPSHOT</version>
+
+ <name>bancorp-sftp</name>
+ <url>https://github.com/SimpleFinance/sftp-fetch</url>
+ <description>Download new files from an SFTP server and publish them to a queue, using S3 to hold the data
+ </description>
+
+ <developers>
+ <developer>
+ <name>Cosmin Stejerean</name>
+ <email>cosmin@offbytwo.com</email>
+ </developer>
+ </developers>
+
+ <licenses>
+ <license>
+ <name>Apache Public License (v2.0)</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+ </license>
+ </licenses>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.rabbitmq</groupId>
+ <artifactId>amqp-client</artifactId>
+ <version>2.7.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.jcraft</groupId>
+ <artifactId>jsch</artifactId>
+ <version>0.1.48</version>
+ </dependency>
+ <dependency>
+ <groupId>com.amazonaws</groupId>
+ <artifactId>aws-java-sdk</artifactId>
+ <version>1.3.11</version>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpg-jdk16</artifactId>
+ <version>1.46</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.0</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8.1</version>
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.1.2</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>shade</goal>
+ </goals>
+ <configuration>
+ <shadedArtifactAttached>true</shadedArtifactAttached>
+ <shadedClassifierName>standalone</shadedClassifierName>
+ <transformers>
+ <transformer
+ implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
+ <mainClass>com.simple.sftpfetch.App</mainClass>
+ </transformer>
+ </transformers>
+ <filters>
+ <filter>
+ <artifact>*</artifact>
+ <excludes>
+ <exclude>META-INF/*.SF</exclude>
+ <exclude>META-INF/*.RSA</exclude>
+ <exclude>META-INF/*.INF</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Oops, something went wrong.

0 comments on commit 8d0a03a

Please sign in to comment.