Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
amolnayak311 committed Nov 10, 2011
0 parents commit 4568dfa
Show file tree
Hide file tree
Showing 101 changed files with 8,230 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<classpath>
<classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
<classpathentry kind="src" path="src/test/resources" output="target/test-classes" including="**/*" excluding="**/*.java"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/resources" including="**/*" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4.4/mail-1.4.4.jar"/>
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/com/amazonaws/aws-java-sdk/1.2.7/aws-java-sdk-1.2.7.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.5/commons-codec-1.5.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/2.0.1/commons-io-2.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.1.1/httpcore-4.1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-core-asl/1.8.3/jackson-core-asl-1.8.3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.8.3/jackson-mapper-asl-1.8.3.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit-dep/4.8.2/junit-dep-4.8.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/3.1.0.M2/spring-aop-3.1.0.M2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-asm/3.1.0.M2/spring-asm-3.1.0.M2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/3.1.0.M2/spring-beans-3.1.0.M2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/3.1.0.M2/spring-context-3.1.0.M2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-context-support/3.0.5.RELEASE/spring-context-support-3.0.5.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-core/3.1.0.M2/spring-core-3.1.0.M2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-expression/3.1.0.M2/spring-expression-3.1.0.M2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/integration/spring-integration-core/2.1.0.BUILD-SNAPSHOT/spring-integration-core-2.1.0.BUILD-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-test/3.0.5.RELEASE/spring-test-3.0.5.RELEASE.jar"/>
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-tx/3.1.0.M2/spring-tx-3.1.0.M2.jar"/>
<classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
</classpath>
13 changes: 13 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<projectDescription>
<name>spring-integration-aws</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Thu Nov 10 21:47:36 IST 2011
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
Binary file added docs/Spring Integration AWS GSG.docx
Binary file not shown.
235 changes: 235 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-aws</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<name>Spring Integration Amazon Web Services Support</name>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
<includes>
<include>**/*</include>
</includes>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/*Tests.java</include>
</includes>
<excludes>
<exclude>**/*Abstract*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestone</id>
<url>http://maven.springframework.org/milestone</url>
</repository>
<repository>
<id>spring-release</id>
<url>http://maven.springframework.org/release</url>
</repository>
<repository>
<id>spring-snapshot</id>
<url>http://maven.springframework.org/snapshot</url>
</repository>
<repository>
<id>repo-spring-external</id>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
<repository>
<id>repo-spring-milestone</id>
<url>http://repository.springsource.com/maven/bundles/milestone</url>
</repository>
<repository>
<id>repo-spring-release</id>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>mvnrepostory</id>
<url>http://mvnrepository.com/artifact</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.2.7</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.M2</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>3.1.0.M2</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.1.0.M2</version>
<scope>compile</scope>
</dependency>


<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.1.0.M2</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.5</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.4</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>2.1.0.BUILD-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.8.3</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.3</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.1.1</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.0.5.RELEASE</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.0.5.RELEASE</version>
<scope>test</scope>
</dependency>

</dependencies>

<properties>
<project.build.sourceEncoding>UTF8</project.build.sourceEncoding>
</properties>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright 2002-2011 the original author or authors.
*
* 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.
*/
package org.springframework.integration.aws.core;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
* The common utilities methods
* @author Amol Nayak
*
*/
public class AmazonWSCommonUtils {

private static final Log logger = LogFactory.getLog(AmazonWSCommonUtils.class);

/**
* Generates the MD5 hash of the file provided
* @param file
* @return
*/
public static byte[] getContentsMD5AsBytes(File file) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
BufferedInputStream bin = new BufferedInputStream(new FileInputStream(file),32768);
byte[] bytesRead = new byte[8192];
for (int read = 0;(read = bin.read(bytesRead)) != -1;) {
digest.update(bytesRead, 0, read);
}
return digest.digest();

} catch (NoSuchAlgorithmException e) {
logger.error("Caught Exception while generating a MessageDigest instance", e);
} catch (FileNotFoundException e) {
logger.error("File " + file.getName() + " not found",e);
} catch(IOException e) {
logger.error("IO Exception occurred while reading file " + file.getName(), e);
}
return null;
}

/**
* Compute the MD5 hash of the provided String
* @param the String whose MD5 sun is to be computed
* @return
*/
public static byte[] getContentsMD5AsBytes(String contents) {
try {
MessageDigest digest = MessageDigest.getInstance("MD5");
return digest.digest(contents.getBytes());
} catch (NoSuchAlgorithmException e) {
logger.error("Unable to digest the input String",e);
}
return null;
}

/**
* Encodes the given raw bytes into hex
* @param rawBytes
* @return
*/
public static String encodeHex(byte[] rawBytes) throws UnsupportedEncodingException {
return new String(Base64.encodeBase64(rawBytes),"UTF-8");
}
}
Loading

0 comments on commit 4568dfa

Please sign in to comment.