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


Java StringUtils.trim方法代码示例

本文整理汇总了Java中com.amazonaws.util.StringUtils.trim方法的典型用法代码示例。如果您正苦于以下问题:Java StringUtils.trim方法的具体用法?Java StringUtils.trim怎么用?Java StringUtils.trim使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.util.StringUtils的用法示例。


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

示例1: getCredentials

import com.amazonaws.util.StringUtils; //导入方法依赖的package包/类
@Override
public AWSCredentials getCredentials() {
  String accessKey = null;
  if (config.hasPath(GobblinAWSConfigurationKeys.SERVICE_ACCESS_KEY)) {
    accessKey = config.getString(GobblinAWSConfigurationKeys.SERVICE_ACCESS_KEY);
  }

  String secretKey = null;
  if (config.hasPath(GobblinAWSConfigurationKeys.SERVICE_SECRET_KEY)) {
    secretKey = PasswordManager.getInstance(ConfigUtils.configToState(config))
            .readPassword(config.getString(GobblinAWSConfigurationKeys.SERVICE_SECRET_KEY));
  }

  accessKey = StringUtils.trim(accessKey);
  secretKey = StringUtils.trim(secretKey);
  if (StringUtils.isNullOrEmpty(accessKey) || StringUtils.isNullOrEmpty(secretKey)) {
    throw new AmazonClientException(String.format("Unable to load AWS credentials from config (%s and %s)",
            GobblinAWSConfigurationKeys.SERVICE_ACCESS_KEY, GobblinAWSConfigurationKeys.SERVICE_SECRET_KEY));
  }

  return new BasicAWSCredentials(accessKey, secretKey);
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:23,代码来源:AWSClusterSecurityManager.java

示例2: getCredentials

import com.amazonaws.util.StringUtils; //导入方法依赖的package包/类
@Override
public AWSCredentials getCredentials() {
    
	//Load IBM properties
	
	String accessKey =
        StringUtils.trim(System.getProperty(ACCESS_KEY_SYSTEM_PROPERTY));

    String secretKey =
        StringUtils.trim(System.getProperty(SECRET_KEY_SYSTEM_PROPERTY));
    
	String apiKey =
        StringUtils.trim(System.getProperty(SDKGlobalConfiguration.IBM_API_KEY_SYSTEM_PROPERTY));

    String serviceInstance =
        StringUtils.trim(System.getProperty(SDKGlobalConfiguration.IBM_SERVICE_INSTANCE_ID_SYSTEM_PROPERTY));
    
    if (!StringUtils.isNullOrEmpty(apiKey) && tokenManager == null) {

    	BasicIBMOAuthCredentials oAuthCreds = new BasicIBMOAuthCredentials(apiKey, serviceInstance);
    	tokenManager = oAuthCreds.getTokenManager();
    	return oAuthCreds;
    	
    } else if ((!StringUtils.isNullOrEmpty(apiKey) && tokenManager != null)) {

    	return new BasicIBMOAuthCredentials(tokenManager, serviceInstance);
    }

    if (StringUtils.isNullOrEmpty(accessKey)
            || StringUtils.isNullOrEmpty(secretKey)) {

        throw new SdkClientException(
                "Unable to load AWS credentials from Java system "
                + "properties (" + ACCESS_KEY_SYSTEM_PROPERTY + " and "
                + SECRET_KEY_SYSTEM_PROPERTY + ")");
    }

    return new BasicAWSCredentials(accessKey, secretKey);
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:40,代码来源:SystemPropertiesCredentialsProvider.java

示例3: createModel

import com.amazonaws.util.StringUtils; //导入方法依赖的package包/类
public @NotNull AgentRunnerBuildParametersModel createModel(@NotNull final Map<String, String> runnerParameters) {
    final String bucketName = StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_BUCKET_NAME));
    final String credentialsPublicKey = StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_CREDENTIALS_PUB_KEY));
    final String credentialsPrivateKey = StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_CREDENTIALS_PRIVATE_KEY));
    final String sourcePaths = runnerParameters.get(PluginConstants.UI_PARAM_CONTENT_PATHS);
    final boolean needToEmptyBucket = Boolean.valueOf(runnerParameters.get(PluginConstants.UI_PARAM_EMPTY_BUCKET));
    final String httpHeaderCacheControl = StringUtil.nullIfEmpty(StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_HTTP_HEADERS_CACHE_CONTROL)));
    final String httpProxy = StringUtils.trim(runnerParameters.get(PluginConstants.UI_PARAM_HTTP_PROXY));

    return new AgentRunnerBuildParametersModel(bucketName, credentialsPublicKey, credentialsPrivateKey, needToEmptyBucket, sourcePaths, httpHeaderCacheControl, httpProxy);
}
 
开发者ID:gonzadocarmo,项目名称:teamcity-s3-plugin,代码行数:12,代码来源:AWSS3BuildProcessAdapterHelper.java

示例4: getSysPropertyProfileName

import com.amazonaws.util.StringUtils; //导入方法依赖的package包/类
private String getSysPropertyProfileName() {
    return StringUtils.trim(System.getProperty(AWS_PROFILE_SYSTEM_PROPERTY));
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:4,代码来源:AwsProfileNameLoader.java

示例5: getEnvProfileName

import com.amazonaws.util.StringUtils; //导入方法依赖的package包/类
private String getEnvProfileName() {
    return StringUtils.trim(System.getenv(AWS_PROFILE_ENVIRONMENT_VARIABLE));
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:4,代码来源:AwsProfileNameLoader.java

示例6: getCredentials

import com.amazonaws.util.StringUtils; //导入方法依赖的package包/类
@Override
public AWSCredentials getCredentials() {
	
	if (System.getenv(SDKGlobalConfiguration.IBM_API_KEY) != null) {
		
		String apiKey = System.getenv(SDKGlobalConfiguration.IBM_API_KEY);
		String serviceInstanceId = System.getenv(SDKGlobalConfiguration.IBM_SERVICE_INSTANCE_ID);
		if (oAuthCredentials == null) {
			oAuthCredentials = new BasicIBMOAuthCredentials(apiKey, serviceInstanceId);
		}
		
		return oAuthCredentials;
		
 } else {
     String accessKey = System.getenv(ACCESS_KEY_ENV_VAR);
     if (accessKey == null) {
         accessKey = System.getenv(ALTERNATE_ACCESS_KEY_ENV_VAR);
     }
	
     String secretKey = System.getenv(SECRET_KEY_ENV_VAR);
     if (secretKey == null) {
         secretKey = System.getenv(ALTERNATE_SECRET_KEY_ENV_VAR);
     }
	
     accessKey = StringUtils.trim(accessKey);
     secretKey = StringUtils.trim(secretKey);
     String sessionToken = StringUtils.trim(System.getenv(AWS_SESSION_TOKEN_ENV_VAR));
    if (StringUtils.isNullOrEmpty(accessKey) || StringUtils.isNullOrEmpty(secretKey)) {

        throw new SdkClientException(
                "Unable to load AWS credentials from environment variables " +
                "(" + ACCESS_KEY_ENV_VAR + " (or " + ALTERNATE_ACCESS_KEY_ENV_VAR + ") and " +
                SECRET_KEY_ENV_VAR + " (or " + ALTERNATE_SECRET_KEY_ENV_VAR + "))");
    }

    return sessionToken == null ?
            new BasicAWSCredentials(accessKey, secretKey)
            :
            new BasicSessionCredentials(accessKey, secretKey, sessionToken);
 }
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:42,代码来源:EnvironmentVariableCredentialsProvider.java


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