Example usage for com.amazonaws ClientConfiguration ClientConfiguration

List of usage examples for com.amazonaws ClientConfiguration ClientConfiguration

Introduction

In this page you can find the example usage for com.amazonaws ClientConfiguration ClientConfiguration.

Prototype

public ClientConfiguration() 

Source Link

Usage

From source file:com.forerunnergames.peril.client.assets.S3AssetUpdater.java

License:Open Source License

S3AssetUpdater(final String bucketPath) {
    Arguments.checkIsNotNull(bucketPath, "bucketPath");
    Preconditions.checkIsTrue(AssetSettings.isValidS3BucketPath(bucketPath),
            AssetSettings.VALID_S3_BUCKET_PATH_DESCRIPTION);

    bucketName = AssetSettings.getS3BucketName(bucketPath);
    executorService = Executors.newSingleThreadExecutor();
    final ClientConfiguration clientConfig = new ClientConfiguration().withMaxErrorRetry(10)
            .withConnectionTimeout(10_000).withSocketTimeout(10_000).withTcpKeepAlive(true);
    final AmazonS3 s3 = new AmazonS3Client(new ProfileCredentialsProvider(), clientConfig);
    transferManager = new TransferManager(s3);
}

From source file:com.ge.predix.sample.blobstore.connector.spring.BlobstoreServiceConnectorCreator.java

License:Apache License

/**
 * Creates the BlobStore context using S3Client
 *
 * @param serviceInfo Object Store Service Info Object
 * @param serviceConnectorConfig Cloud Foundry Service Connector Configuration
 *
 * @return BlobstoreService Instance of the ObjectStore Service
 *//*www  .  j av a2 s.co m*/
@Override
public BlobstoreService create(BlobstoreServiceInfo serviceInfo,
        ServiceConnectorConfig serviceConnectorConfig) {
    log.info("create() invoked with serviceInfo? = " + (serviceInfo == null));
    ClientConfiguration config = new ClientConfiguration();
    config.setProtocol(Protocol.HTTPS);

    S3ClientOptions options = new S3ClientOptions();
    config.setSignerOverride("S3SignerType");

    BasicAWSCredentials creds = new BasicAWSCredentials(serviceInfo.getObjectStoreAccessKey(),
            serviceInfo.getObjectStoreSecretKey());
    AmazonS3Client s3Client = new AmazonS3Client(creds, config);
    s3Client.setEndpoint(serviceInfo.getUrl());
    s3Client.setS3ClientOptions(options);

    try {
        // Remove the Credentials from the Object Store URL
        URL url = new URL(serviceInfo.getUrl());
        String urlWithoutCredentials = url.getProtocol() + "://" + url.getHost();

        // Return BlobstoreService
        return new BlobstoreService(s3Client, serviceInfo.getBucket(), urlWithoutCredentials);
    } catch (MalformedURLException e) {
        log.error("create(): Couldnt parse the URL provided by VCAP_SERVICES. Exception = " + e.getMessage());
        throw new RuntimeException("Blobstore URL is Invalid", e);
    }
}

From source file:com.ge.predix.solsvc.blobstore.bootstrap.BlobstoreClientImpl.java

License:Apache License

/**
 *  -/*from   w  ww  .  j a  va2s  .com*/
 */
@PostConstruct
public void init() {

    ClientConfiguration config = new ClientConfiguration();
    config.setProtocol(Protocol.HTTPS);
    if (this.blobstoreConfig.getProxyHost() != null && !"".equals(this.blobstoreConfig.getProxyHost())) { //$NON-NLS-1$
        this.log.info("Connnecting with proxy"); //$NON-NLS-1$
        if (this.blobstoreConfig.getProxyHost() != null) {
            config.withProxyHost(this.blobstoreConfig.getProxyHost());
        }
        if (this.blobstoreConfig.getProxyPort() != null) {
            config.withProxyPort(Integer.parseInt(this.blobstoreConfig.getProxyPort()));
        }
    }
    BasicAWSCredentials creds = new BasicAWSCredentials(this.blobstoreConfig.getAccessKey(),
            this.blobstoreConfig.getAccessKey());
    this.s3Client = new AmazonS3Client(creds, config);
    this.s3Client.setEndpoint(this.blobstoreConfig.getUrl());

}

From source file:com.github.sjones4.youcan.youare.YouAreClient.java

License:Open Source License

public YouAreClient() {
    this(new DefaultAWSCredentialsProviderChain(), new ClientConfiguration());
}

From source file:com.github.sjones4.youcan.youare.YouAreClient.java

License:Open Source License

public YouAreClient(final AWSCredentials awsCredentials) {
    this(new StaticCredentialsProvider(awsCredentials), new ClientConfiguration());
}

From source file:com.github.sjones4.youcan.youare.YouAreClient.java

License:Open Source License

public YouAreClient(final AWSCredentialsProvider awsCredentialsProvider) {
    this(awsCredentialsProvider, new ClientConfiguration());
}

From source file:com.github.sjones4.youcan.youconfig.YouConfigClient.java

License:Open Source License

public YouConfigClient() {
    this(new DefaultAWSCredentialsProviderChain(), new ClientConfiguration());
}

From source file:com.github.sjones4.youcan.youconfig.YouConfigClient.java

License:Open Source License

public YouConfigClient(final AWSCredentials awsCredentials) {
    this(new StaticCredentialsProvider(awsCredentials), new ClientConfiguration());
}

From source file:com.github.sjones4.youcan.youconfig.YouConfigClient.java

License:Open Source License

public YouConfigClient(final AWSCredentialsProvider awsCredentialsProvider) {
    this(awsCredentialsProvider, new ClientConfiguration());
}

From source file:com.github.sjones4.youcan.youprop.YouPropClient.java

License:Open Source License

public YouPropClient() {
    this(new DefaultAWSCredentialsProviderChain(), new ClientConfiguration());
}