com.amazonaws.auth
Class PropertiesCredentials

java.lang.Object  extended by com.amazonaws.auth.PropertiesCredentials
All Implemented Interfaces:
AWSCredentials

public class PropertiesCredentials
extends Object
implements AWSCredentials

Simple implementation AWSCredentials that reads in AWS access keys from a properties file. The AWS access key is expected to be in the "accessKey" property and the AWS secret key id is expected to be in the "secretKey" property.


Constructor Summary
PropertiesCredentials(File file)
          Reads the specified file as a Java properties file and extracts the AWS access key from the "accessKey" property and AWS secret access key from the "secretKey" property.
PropertiesCredentials(InputStream inputStream)
          Reads the specified input stream as a stream of Java properties file content and extracts the AWS access key ID and secret access key from the properties.
 
Method Summary
 StringgetAWSAccessKeyId()
          Returns the AWS access key ID for this credentials object.
 StringgetAWSSecretKey()
          Returns the AWS secret access key for this credentials object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertiesCredentials

public PropertiesCredentials(File file)                      throws FileNotFoundException,                             IOException,                             IllegalArgumentException
Reads the specified file as a Java properties file and extracts the AWS access key from the "accessKey" property and AWS secret access key from the "secretKey" property. If the specified file doesn't contain the AWS access keys an IOException will be thrown.

Parameters:
file - The file from which to read the AWS credentials properties.
Throws:
FileNotFoundException - If the specified file isn't found.
IOException - If any problems are encountered reading the AWS access keys from the specified file.
IllegalArgumentException - If the specified properties file does not contain the required keys.


PropertiesCredentials

public PropertiesCredentials(InputStream inputStream)                      throws IOException
Reads the specified input stream as a stream of Java properties file content and extracts the AWS access key ID and secret access key from the properties.

Parameters:
inputStream - The input stream containing the AWS credential properties.
Throws:
IOException - If any problems occur while reading from the input stream.

Method Detail

getAWSAccessKeyId

public String getAWSAccessKeyId()
Description copied from interface: AWSCredentials
Returns the AWS access key ID for this credentials object.

Specified by:
getAWSAccessKeyId in interface AWSCredentials
Returns:
The AWS access key ID for this credentials object.

getAWSSecretKey

public String getAWSSecretKey()
Description copied from interface: AWSCredentials
Returns the AWS secret access key for this credentials object.

Specified by:
getAWSSecretKey in interface AWSCredentials
Returns:
The AWS secret access key for this credentials object.


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.


NOTHING
NOTHING
Add the Maven Dependecy to your project: maven dependecy for com.amazonaws : aws-java-sdk : 1.3.14