Java 类com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider 实例源码

项目:tweetamo    文件:PersistentStore.java   
/**
 * The only information needed to create a client are security credentials
 * consisting of the AWS Access Key ID and Secret Access Key. All other
 * configuration, such as the service endpoints, are performed
 * automatically. Client parameters, such as proxies, can be specified in an
 * optional ClientConfiguration object when constructing a client.
 * 
 * @see com.amazonaws.auth.BasicAWSCredentials
 * @see com.amazonaws.auth.PropertiesCredentials
 * @see com.amazonaws.ClientConfiguration
 */
private PersistentStore(Region region, long readCapacity, long writeCapacity)
        throws Exception {
    /*
     * This credentials provider implementation loads your AWS credentials
     * from a properties file at the root of your classpath.
     */
    dynamoDB = new AmazonDynamoDBClient(
            new ClasspathPropertiesFileCredentialsProvider());
    dynamoDB.setRegion(region);

    try {
        if (!tablesExist()) {
            createTables(readCapacity, writeCapacity);
        }
        waitForTableToBecomeAvailable(TABLE_NAME);
    } catch (Exception e) {
        handleException(e);
    }
}
项目:aws-iot-mqtt-load-generator    文件:MyCredentialsProvider.java   
MyCredentialsProvider() {
    super(new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(),
            // Removed due to ElasticBeanstalk environment not being setup with a profile dir
            // new ProfileCredentialsProvider(),
            new InstanceProfileCredentialsProvider(),
            new ClasspathPropertiesFileCredentialsProvider());
}
项目:duckdns    文件:AmazonDynamoDBDAO.java   
protected AmazonDynamoDBDAO() {
    dynamoDB = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider());
       Region usWest2 = Region.getRegion(Regions.US_WEST_2);

       String local_db = EnvironmentUtils.getInstance().getLocal_db();
       if (local_db != null && local_db.trim().length() > 0) {
        // LOCAL
        dynamoDB.setEndpoint(local_db,"local","us-west-2"); 
       } else {
        // PROD
        dynamoDB.setRegion(usWest2);
       }
       mapper = new DynamoDBMapper(dynamoDB);
}
项目:duckdns    文件:AmazonDynamoDBDAO.java   
protected AmazonDynamoDBDAO() {
    dynamoDB = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider());
       Region usWest2 = Region.getRegion(Regions.US_WEST_2);

       String local_db = EnvironmentUtils.getInstance().getLocal_db();
       if (local_db != null && local_db.trim().length() > 0) {
        // LOCAL
        dynamoDB.setEndpoint(local_db,"local","us-west-2"); 
       } else {
        // PROD
        dynamoDB.setRegion(usWest2);
       }
       mapper = new DynamoDBMapper(dynamoDB);
}
项目:duckdns    文件:AccountTools.java   
private static void updateApp() {

    System.out.println("Downloading file (duckdns-dist) duckdns.war  --->  /var/tmp/duckdns.war");
    ClientConfiguration clientConfig = new ClientConfiguration();
    clientConfig.setProtocol(Protocol.HTTP);

    AmazonS3 conn = new AmazonS3Client(new ClasspathPropertiesFileCredentialsProvider(), clientConfig);

    conn.getObject(new GetObjectRequest("duckdns-dist", "duckdns.war"),new File("/var/tmp/duckdns.war"));
    System.out.println("Done");
}
项目:duckdns    文件:AmazonDynamoDBDAO.java   
protected AmazonDynamoDBDAO() {
    dynamoDB = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider());
       Region usWest2 = Region.getRegion(Regions.US_WEST_2);

       String local_db = EnvironmentUtils.getInstance().getLocal_db();
       if (local_db != null && local_db.trim().length() > 0) {
        // LOCAL
        dynamoDB.setEndpoint(local_db,"local","us-west-2"); 
       } else {
        // PROD
        dynamoDB.setRegion(usWest2);
       }
       mapper = new DynamoDBMapper(dynamoDB);
}
项目:milton-aws    文件:AmazonS3ManagerImpl.java   
/**
 * You can choose the geographical region where Amazon S3 will store the
 * buckets you create. You might choose a region to optimize latency,
 * minimize costs, or address regulator requirements.
 * 
 * @param region
 */
public AmazonS3ManagerImpl(Region region) {
    LOG.info("Create an instance of the AmazonS3Client class by providing your "
            + "AWS Account or IAM user credentials (Access Key ID, Secret Access Key)");

    // Create an instance of the AmazonS3Client class by providing your AWS
    // Account or IAM user credentials (Access Key ID, Secret Access Key)
    amazonS3Client = new AmazonS3Client(new ClasspathPropertiesFileCredentialsProvider());
    amazonS3Client.setRegion(region);
}
项目:aws-cloudtrail-processing-library    文件:PropertiesFileConfiguration.java   
/**
 * Creates a {@link PropertiesFileConfiguration} from values provided in a classpath properties file.
 *
 * @param propertiesFile the classpath properties file to load.
 */
public PropertiesFileConfiguration(String propertiesFile) {
    //load properties from configuration properties file
    Properties prop = loadProperty(propertiesFile);

    sqsUrl = prop.getProperty(SQS_URL);
    LibraryUtils.checkArgumentNotNull(sqsUrl, "Cannot find SQS URL in properties file.");

    String accessKey = prop.getProperty(ACCESS_KEY);
    String secretKey = prop.getProperty(SECRET_KEY);

    if (accessKey != null && secretKey != null) {
        awsCredentialsProvider = new ClasspathPropertiesFileCredentialsProvider(propertiesFile);
    }

    s3Region = prop.getProperty(S3_REGION);
    visibilityTimeout = getIntProperty(prop, VISIBILITY_TIMEOUT);

    sqsRegion = prop.getProperty(SQS_REGION);

    threadCount = getIntProperty(prop, THREAD_COUNT);
    threadTerminationDelaySeconds = getIntProperty(prop, THREAD_TERMINATION_DELAY_SECONDS);

    maxEventsPerEmit = getIntProperty(prop, MAX_EVENTS_PER_EMIT);
    enableRawEventInfo = getBooleanProperty(prop, ENABLE_RAW_EVENT_INFO);

    deleteMessageUponFailure  = getBooleanProperty(prop, DELETE_MESSAGE_UPON_FAILURE);
}
项目:Fancraft    文件:FandomDAO.java   
public FandomDAO() {
    client = new AmazonDynamoDBClient(
            new ClasspathPropertiesFileCredentialsProvider());
    mapper = new DynamoDBMapper(client);

    Fandom test = mapper.load(Fandom.class, "fandoms");
    if (test == null) {
        test = new Fandom();
        test.setId("fandoms");
        mapper.save(test);
    }
}
项目:Fancraft    文件:CraftDAO.java   
public CraftDAO(){
    client = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider());
    mapper = new DynamoDBMapper(client);

    Craft test = mapper.load(Craft.class, "crafts");
    if(test == null){
        test = new Craft();
        test.setId("crafts");
        mapper.save(test);
    }
}
项目:geoprism    文件:AmazonEndpoint.java   
@Override
public void copyFiles(File directory, List<String> keys, boolean preserveDirectories)
{
  try
  {
    List<File> files = new LinkedList<File>();

    AmazonS3 client = new AmazonS3Client(new ClasspathPropertiesFileCredentialsProvider());

    for (String key : keys)
    {
      GetObjectRequest request = new GetObjectRequest("geodashboarddata", key);

      S3Object object = client.getObject(request);

      InputStream istream = object.getObjectContent();

      try
      {
        String targetPath = this.getTargetPath(preserveDirectories, key);

        File file = new File(directory, targetPath);

        FileUtils.copyInputStreamToFile(istream, file);

        files.add(file);
      }
      finally
      {
        // Process the objectData stream.
        istream.close();
      }
    }
  }
  catch (IOException e)
  {
    throw new ProgrammingErrorException(e);
  }
}
项目:geoprism    文件:AmazonEndpoint.java   
private List<String> listFiles(String prefix)
{
  List<String> files = new LinkedList<String>();

  try
  {
    AmazonS3 s3Client = new AmazonS3Client(new ClasspathPropertiesFileCredentialsProvider());

    ListObjectsRequest request = new ListObjectsRequest();
    request = request.withBucketName("geodashboarddata");
    request = request.withPrefix(prefix);

    ObjectListing listing;

    do
    {
      listing = s3Client.listObjects(request);

      List<S3ObjectSummary> summaries = listing.getObjectSummaries();

      for (S3ObjectSummary summary : summaries)
      {
        String key = summary.getKey();

        if (key.endsWith(".xml.gz"))
        {
          files.add(key);
        }
      }

      request.setMarker(listing.getNextMarker());
    } while (listing != null && listing.isTruncated());
  }
  catch (Exception e)
  {
    logger.error("Unable to retrieve files", e);
  }

  return files;
}
项目:kinesis-logback-appender    文件:CustomCredentialsProviderChain.java   
public CustomCredentialsProviderChain() {
  super(new ClasspathPropertiesFileCredentialsProvider(), new InstanceProfileCredentialsProvider(),
      new SystemPropertiesCredentialsProvider(), new EnvironmentVariableCredentialsProvider(),
      new ProfileCredentialsProvider());
}
项目:transcoder    文件:ApplicationConfig.java   
@Bean
AWSCredentialsProvider awsCredentials()
{
    return new ClasspathPropertiesFileCredentialsProvider( "aws-credentials.properties" );
}
项目:ivona-speechcloud-sdk-java    文件:SampleIvonaSpeechCloudVoiceList.java   
private static void init() {
    speechCloud = new IvonaSpeechCloudClient(
            new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}
项目:ivona-speechcloud-sdk-java    文件:SampleIvonaSpeechCloudGetVoiceListURL.java   
private static void init() {
    speechCloud = new IvonaSpeechCloudClient(
            new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}
项目:ivona-speechcloud-sdk-java    文件:SampleIvonaSpeechCloudGetCreateSpeechURL.java   
private static void init() {
    speechCloud = new IvonaSpeechCloudClient(
            new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}
项目:ivona-speechcloud-sdk-java    文件:SampleIvonaSpeechCloudCreateSpeech.java   
private static void init() {
    speechCloud = new IvonaSpeechCloudClient(
            new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}
项目:ivona-speechcloud-sdk-java    文件:SampleIvonaSpeechCloudPutLexicon.java   
private static void init() {
    speechCloud = new IvonaSpeechCloudClient(
            new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}
项目:ivona-speechcloud-sdk-java    文件:SampleIvonaSpeechCloudGetLexicon.java   
private static void init() {
    speechCloud = new IvonaSpeechCloudClient(
            new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}
项目:ivona-speechcloud-sdk-java    文件:SampleIvonaSpeechCloudDeleteLexicon.java   
private static void init() {
    speechCloud = new IvonaSpeechCloudClient(
            new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}
项目:ivona-speechcloud-sdk-java    文件:SampleIvonaSpeechCloudListLexicons.java   
private static void init() {
    speechCloud = new IvonaSpeechCloudClient(
            new ClasspathPropertiesFileCredentialsProvider("resources/IvonaCredentials.properties"));
    speechCloud.setEndpoint("https://tts.eu-west-1.ivonacloud.com");
}
项目:kinesis-log4j-appender    文件:CustomCredentialsProviderChain.java   
public CustomCredentialsProviderChain() {
  super(new ClasspathPropertiesFileCredentialsProvider(), new InstanceProfileCredentialsProvider(),
      new SystemPropertiesCredentialsProvider(), new EnvironmentVariableCredentialsProvider());
}
项目:aws-big-data-blog    文件:CustomCredentialsProviderChain.java   
public CustomCredentialsProviderChain() {
    super(new EnvironmentVariableCredentialsProvider(),
            new SystemPropertiesCredentialsProvider(),
            new ClasspathPropertiesFileCredentialsProvider(),
            new InstanceProfileCredentialsProvider());
}
项目:Fancraft    文件:UserDAO.java   
public UserDAO() {
    client = new AmazonDynamoDBClient(
            new ClasspathPropertiesFileCredentialsProvider());
    mapper = new DynamoDBMapper(client);
}
项目:Fancraft    文件:CommentDAO.java   
public CommentDAO() {
    client = new AmazonDynamoDBClient(
            new ClasspathPropertiesFileCredentialsProvider());
    mapper = new DynamoDBMapper(client);
}
项目:Fancraft    文件:PostDAO.java   
public PostDAO() {
    client = new AmazonDynamoDBClient(
            new ClasspathPropertiesFileCredentialsProvider());
    mapper = new DynamoDBMapper(client);
}
项目:milton-aws    文件:DynamoDBServiceImpl.java   
/**
 * The only information needed to create a client are security credentials
 * consisting of the AWS Access Key ID and Secret Access Key. All other
 * configuration, such as the service endpoints, are performed
 * automatically. Client parameters, such as proxies, can be specified in an
 * optional ClientConfiguration object when constructing a client.
 *
 * @see com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider
 * @see com.amazonaws.regions.Region
 */
public DynamoDBServiceImpl(Region region) {
    LOG.info("Initialize Amazon DynamoDB environment...!!!");

    dynamoDBClient = new AmazonDynamoDBClient(new ClasspathPropertiesFileCredentialsProvider());
    dynamoDBClient.setRegion(region);
}
项目:sumologic-kinesis-connector    文件:KinesisConnectorExecutor.java   
/**
 * Returns an {@link AWSCredentialsProvider} with the permissions necessary to accomplish all specified
 * tasks. At the minimum it will require read permissions for Amazon Kinesis. Additional read permissions
 * and write permissions may be required based on the Pipeline used.
 * 
 * @return
 */
public AWSCredentialsProvider getAWSCredentialsProvider() {
    return new ClasspathPropertiesFileCredentialsProvider("SumologicConnector.properties");
}