当前位置: 首页>>代码示例>>Java>>正文


Java SDKGlobalConfiguration类代码示例

本文整理汇总了Java中com.amazonaws.SDKGlobalConfiguration的典型用法代码示例。如果您正苦于以下问题:Java SDKGlobalConfiguration类的具体用法?Java SDKGlobalConfiguration怎么用?Java SDKGlobalConfiguration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SDKGlobalConfiguration类属于com.amazonaws包,在下文中一共展示了SDKGlobalConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: obtainResource

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
@Override
protected void obtainResource() throws Exception {
	// See https://github.com/mhart/kinesalite#cbor-protocol-issues-with-the-java-sdk
	System.setProperty(SDKGlobalConfiguration.AWS_CBOR_DISABLE_SYSTEM_PROPERTY, "true");

	this.resource = AmazonKinesisAsyncClientBuilder.standard()
			.withClientConfiguration(
					new ClientConfiguration()
							.withMaxErrorRetry(0)
							.withConnectionTimeout(1000))
			.withEndpointConfiguration(
					new AwsClientBuilder.EndpointConfiguration("http://localhost:" + this.port,
							Regions.DEFAULT_REGION.getName()))
			.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("", "")))
			.build();

	// Check connection
	this.resource.listStreams();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-stream-binder-aws-kinesis,代码行数:20,代码来源:LocalKinesisResource.java

示例2: init

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
@Override
public void init(Configuration conf, String keyPrefix) {
  bucketName = conf.get(keyPrefix + S3_BUCKET_NAME);
  String endpoint = conf.get(keyPrefix + S3_ENDPOINT_NAME);
  String key = conf.get(keyPrefix + S3_ACCESS_KEY);
  String secret = conf.get(keyPrefix + S3_ACCESS_SECRET);

  System.setProperty(SDKGlobalConfiguration.ACCESS_KEY_SYSTEM_PROPERTY, key);
  System.setProperty(SDKGlobalConfiguration.SECRET_KEY_SYSTEM_PROPERTY, secret);
  AWSCredentialsProvider provider = new SystemPropertiesCredentialsProvider();
  client = new AmazonS3Client(provider);
  client.setEndpoint(endpoint);
  override = conf.getBoolean(keyPrefix + "override", true);
  acls = new AccessControlList();
  acls.grantPermission(GroupGrantee.AllUsers, Permission.FullControl);
  acls.grantPermission(GroupGrantee.AllUsers, Permission.Read);
  acls.grantPermission(GroupGrantee.AllUsers, Permission.Write);
}
 
开发者ID:XiaoMi,项目名称:galaxy-fds-migration-tool,代码行数:19,代码来源:S3Source.java

示例3: createSocketFactoryRegistry

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
private Registry<ConnectionSocketFactory> createSocketFactoryRegistry(ConnectionSocketFactory sslSocketFactory) {

        /*
         * If SSL cert checking for endpoints has been explicitly disabled,
         * register a new scheme for HTTPS that won't cause self-signed certs to
         * error out.
         */
        if (SDKGlobalConfiguration.isCertCheckingDisabled()) {
            if (LOG.isWarnEnabled()) {
                LOG.warn("SSL Certificate checking for endpoints has been " +
                        "explicitly disabled.");
            }
            sslSocketFactory = new TrustingSocketFactory();
        }

        return RegistryBuilder.<ConnectionSocketFactory>create()
                .register("http", PlainConnectionSocketFactory.getSocketFactory())
                .register("https", sslSocketFactory)
                .build();
    }
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:21,代码来源:ApacheConnectionManagerFactory.java

示例4: PropertiesCredentials

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
/**
   * 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.
   *
   * @param inputStream
   *            The input stream containing the AWS credential properties.
   *
   * @throws IOException
   *             If any problems occur while reading from the input stream.
   */
  public PropertiesCredentials(InputStream inputStream) throws IOException {
      Properties accountProperties = new Properties();
      try {
          accountProperties.load(inputStream);
      } finally {
          try {inputStream.close();} catch (Exception e) {}
      }
      if ((accountProperties.getProperty(SDKGlobalConfiguration.IBM_API_KEY_SYSTEM_PROPERTY) == null) && 
      	(accountProperties.getProperty("accessKey") == null ||
          accountProperties.getProperty("secretKey") == null)) {
          throw new IllegalArgumentException("The specified properties data " +
                  "doesn't contain the expected properties 'accessKey' and 'secretKey'.");
      
      }
       
      accessKey = accountProperties.getProperty("accessKey");
   secretAccessKey = accountProperties.getProperty("secretKey");
ibmApiKey = accountProperties.getProperty(SDKGlobalConfiguration.IBM_API_KEY_SYSTEM_PROPERTY);
  	ibmServiceInstanceId = accountProperties.getProperty(SDKGlobalConfiguration.IBM_SERVICE_INSTANCE_ID_SYSTEM_PROPERTY);
      
  }
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:33,代码来源:PropertiesCredentials.java

示例5: shouldRetryTokenRetrievalNoMoreThanMax

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
/**
 * Mock TokenProvider to throw OAuthServiceException on token retrieval.
 * Check that TokenManager retries up to the max number of retry attempts.
 */
@Test
public void shouldRetryTokenRetrievalNoMoreThanMax() {
	OAuthServiceException exception = new OAuthServiceException(
			"Token retrival from IAM service failed with refresh token");
	exception.setStatusCode(429);
	exception.setStatusMessage("Too many requests");

	TokenProvider tokenProviderMock = mock(TokenProvider.class);
	when(tokenProviderMock.retrieveToken()).thenThrow(exception);

	defaultTokenManager = new DefaultTokenManager(tokenProviderMock);

	try {
		defaultTokenManager.getToken();
		fail("Should have thrown an OAuthServiceException");
	} catch (OAuthServiceException expected) {
		assertEquals(SDKGlobalConfiguration.IAM_MAX_RETRY, Mockito.mockingDetails(tokenProviderMock).getInvocations().size());
	}
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:24,代码来源:DefaultTokenManagerTest.java

示例6: shouldNotRefreshToken

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
/**
 * Mock TokenProvider to return non expiring token.
 * Token manager should not attempt to refresh.
 */
@Test
public void shouldNotRefreshToken() {
	int extraTime = (int) (3600 * SDKGlobalConfiguration.IAM_REFRESH_OFFSET);
	long expiry = (System.currentTimeMillis() / 1000L) + (extraTime * 3);
	Token token = new Token();
	token.setAccess_token(accessToken);
	token.setRefresh_token(refreshToken);
	token.setToken_type("Bearer");
	token.setExpires_in("3600");
	token.setExpiration(String.valueOf(expiry));
	
	TokenProvider tokenProviderMock = mock(TokenProvider.class);
	DefaultTokenManager defaultTokenManager = spy(new DefaultTokenManager(tokenProviderMock));
	when(defaultTokenManager.getProvider()).thenReturn(tokenProviderMock);
	when(tokenProviderMock.retrieveToken()).thenReturn(token);
	Mockito.doNothing().when(defaultTokenManager).submitRefreshTask();
	
	defaultTokenManager.getToken();
	verify(defaultTokenManager, times(0)).submitRefreshTask();
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:25,代码来源:DefaultTokenManagerTest.java

示例7: getStreamBufferSize

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
/**
 * Returns the buffer size override if it is specified in the system property,
 * otherwise returns the default value.
 */
@Deprecated
public static int getStreamBufferSize() {
    int streamBufferSize = DEFAULT_STREAM_BUFFER_SIZE;
    String bufferSizeOverride =
        System.getProperty(SDKGlobalConfiguration.DEFAULT_S3_STREAM_BUFFER_SIZE);

    if (bufferSizeOverride != null) {
        try {
            streamBufferSize = Integer.parseInt(bufferSizeOverride);
        } catch (Exception e) {
            log.warn("Unable to parse buffer size override from value: " + bufferSizeOverride);
        }
    }
    return streamBufferSize;
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:20,代码来源:Constants.java

示例8: before

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
@Before
public void before() {

    boolean configured =
               !StringUtils.isEmpty(System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR))
            && !StringUtils.isEmpty(System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR))
            && !StringUtils.isEmpty(System.getProperty("bucketName"));

    if ( !configured ) {
        logger.warn("Skipping test because {}, {} and bucketName not " +
            "specified as system properties, e.g. in your Maven settings.xml file.",
            new Object[] {
                SDKGlobalConfiguration.SECRET_KEY_ENV_VAR,
                SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR
            });
    }

    Assume.assumeTrue( configured );

    adminUser = newOrgAppAdminRule.getAdminInfo();
    organization = newOrgAppAdminRule.getOrganizationInfo();
    applicationId = newOrgAppAdminRule.getApplicationInfo().getId();


    bucketName = bucketPrefix + RandomStringUtils.randomAlphanumeric(10).toLowerCase();
}
 
开发者ID:apache,项目名称:usergrid,代码行数:27,代码来源:ImportCollectionIT.java

示例9: deleteBucket

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
/**
 * Delete the configured s3 bucket.
 */
public void deleteBucket() {

    logger.debug("\n\nDelete bucket\n");

    String accessId = System.getProperty(SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR);
    String secretKey = System.getProperty(SDKGlobalConfiguration.SECRET_KEY_ENV_VAR);

    Properties overrides = new Properties();
    overrides.setProperty("s3" + ".identity", accessId);
    overrides.setProperty("s3" + ".credential", secretKey);

    final Iterable<? extends Module> MODULES = ImmutableSet
        .of(new JavaUrlHttpCommandExecutorServiceModule(),
            new Log4JLoggingModule(),
            new NettyPayloadModule());

    BlobStoreContext context =
        ContextBuilder.newBuilder("s3").credentials(accessId, secretKey).modules(MODULES)
            .overrides(overrides).buildView(BlobStoreContext.class);

    BlobStore blobStore = context.getBlobStore();
    blobStore.deleteContainer( bucketName );
}
 
开发者ID:apache,项目名称:usergrid,代码行数:27,代码来源:ImportCollectionIT.java

示例10: before

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
@Before
 public void before() {

     boolean configured =
                !StringUtils.isEmpty(System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR))
             && !StringUtils.isEmpty(System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR))
             && !StringUtils.isEmpty(System.getProperty("bucketName"));

     if ( !configured ) {
         logger.warn("Skipping test because {}, {} and bucketName not " +
             "specified as system properties, e.g. in your Maven settings.xml file.",
             new Object[] {
                 SDKGlobalConfiguration.SECRET_KEY_ENV_VAR,
                 SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR
             });
     }

     Assume.assumeTrue( configured );
}
 
开发者ID:apache,项目名称:usergrid,代码行数:20,代码来源:ImportServiceIT.java

示例11: payloadBuilder

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
public HashMap<String, Object> payloadBuilder() {

        HashMap<String, Object> payload = new HashMap<String, Object>();
        Map<String, Object> properties = new HashMap<String, Object>();
        Map<String, Object> storage_info = new HashMap<String, Object>();
        storage_info.put( "bucket_location", bucketName );

        storage_info.put( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR,
            System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR ) );
        storage_info.put( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR,
            System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR ) );

        properties.put( "storage_provider", "s3" );
        properties.put( "storage_info", storage_info );

        payload.put( "path","test-organization/test-app" );
        payload.put( "properties", properties );
        return payload;
    }
 
开发者ID:apache,项目名称:usergrid,代码行数:20,代码来源:ImportServiceIT.java

示例12: deleteBucket

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
public void deleteBucket() {

        String accessId = System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR );
        String secretKey = System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR );

        Properties overrides = new Properties();
        overrides.setProperty( "s3" + ".identity", accessId );
        overrides.setProperty( "s3" + ".credential", secretKey );

        Blob bo = null;
        BlobStore blobStore = null;
        final Iterable<? extends Module> MODULES = ImmutableSet
                .of(new JavaUrlHttpCommandExecutorServiceModule(), new Log4JLoggingModule(),
                        new NettyPayloadModule());

        BlobStoreContext context =
                ContextBuilder.newBuilder("s3").credentials( accessId, secretKey ).modules( MODULES )
                        .overrides( overrides ).buildView( BlobStoreContext.class );

        blobStore = context.getBlobStore();
        blobStore.deleteContainer( bucketName );
    }
 
开发者ID:apache,项目名称:usergrid,代码行数:23,代码来源:ImportServiceIT.java

示例13: before

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
@Before
public void before() {

    boolean configured =
        !StringUtils.isEmpty(System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR))
            && !StringUtils.isEmpty(System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR))
            && !StringUtils.isEmpty(System.getProperty("bucketName"));

    if ( !configured ) {
        logger.warn("Skipping test because {}, {} and bucketName not " +
                "specified as system properties, e.g. in your Maven settings.xml file.",
            new Object[] {
                SDKGlobalConfiguration.SECRET_KEY_ENV_VAR,
                SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR
            });
    }

    Assume.assumeTrue( configured );

    adminUser = newOrgAppAdminRule.getAdminInfo();
    organization = newOrgAppAdminRule.getOrganizationInfo();
    applicationId = newOrgAppAdminRule.getApplicationInfo().getId();

    bucketPrefix = System.getProperty( "bucketName" );
    bucketName = bucketPrefix + RandomStringUtils.randomAlphanumeric(10).toLowerCase();
}
 
开发者ID:apache,项目名称:usergrid,代码行数:27,代码来源:ExportServiceIT.java

示例14: payloadBuilder

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
public HashMap<String, Object> payloadBuilder( String orgOrAppName ) {
    HashMap<String, Object> payload = new HashMap<String, Object>();
    Map<String, Object> properties = new HashMap<String, Object>();
    Map<String, Object> storage_info = new HashMap<String, Object>();
    storage_info.put( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR,
        System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR ) );
    storage_info.put( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR,
        System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR ) );
    storage_info.put( "bucket_location",  bucketName );

    properties.put( "storage_provider", "s3" );
    properties.put( "storage_info", storage_info );

    payload.put( "path", orgOrAppName );
    payload.put( "properties", properties );
    return payload;
}
 
开发者ID:apache,项目名称:usergrid,代码行数:18,代码来源:ExportServiceIT.java

示例15: before

import com.amazonaws.SDKGlobalConfiguration; //导入依赖的package包/类
@Before
    public void before() {
        configured =
                   !StringUtils.isEmpty(System.getProperty( SDKGlobalConfiguration.SECRET_KEY_ENV_VAR ))
                && !StringUtils.isEmpty(System.getProperty( SDKGlobalConfiguration.ACCESS_KEY_ENV_VAR ))
                && !StringUtils.isEmpty(System.getProperty("bucketName"));


        if (!configured) {
            logger.warn("Skipping test because {}, {} and bucketName not " +
                    "specified as system properties, e.g. in your Maven settings.xml file.",
                new Object[]{
                    "s3_key",
                    "s3_access_id"
                });
        }

//        if (!StringUtils.isEmpty(bucketPrefix)) {
//            deleteBucketsWithPrefix();
//        }

        bucketName = bucketPrefix + RandomStringUtils.randomAlphanumeric(10).toLowerCase();
    }
 
开发者ID:apache,项目名称:usergrid,代码行数:24,代码来源:ImportResourceIT.java


注:本文中的com.amazonaws.SDKGlobalConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。