2016-10-28 115 views
0

是否可以使用DefaultAWSCredentialsProviderChain創建一個S3管理的點火羣集?在java中,你可以做這樣的:通過S3管理Ignite集羣DefaultAWSCredentialsProviderChain()

DefaultAWSCredentialsProviderChain chain = new DefaultAWSCredentialsProviderChain(); 
    AWSCredentials creds = chain.getCredentials(); 

我知道我可以很容易地創建一個實現AWSCredentials並使用提供鏈罩下,也喜歡在這裏http://apacheignite.gridgain.org/docs/aws-config的包裝類。有沒有辦法只用春天來做到這一點?沒有包裝?

編輯:這也許正是我要去使用:

import com.amazonaws.auth.AWSCredentials; 
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain; 

/** 
* Created by Carlos Bribiescas on 10/28/16. 
*/ 
public class DefaultAWSCredentials implements AWSCredentials{ 
    private DefaultAWSCredentials() {} 

    private static class LazyHolder{ 
     private static AWSCredentials CREDENTIALS = new DefaultAWSCredentialsProviderChain().getCredentials(); 
    } 

    @Override 
    public String getAWSAccessKeyId() { 
     return LazyHolder.CREDENTIALS.getAWSAccessKeyId(); 
    } 

    @Override 
    public String getAWSSecretKey() { 
     return LazyHolder.CREDENTIALS.getAWSSecretKey(); 
    } 
} 

回答

0

你應該能夠利用春季factory-beanfactory-method此:

<bean id="aws.cred.chain" class="com.amazonaws.auth.DefaultAWSCredentialsProviderChain"/> 

<property name="ipFinder"> 
    <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinder"> 
     <property name="awsCredentials"> 
      <bean factory-bean="aws.cred.chain" factory-method="getCredentials"/> 
     </property> 
    </bean> 
</property>