本文整理汇总了Java中org.javaswift.joss.client.factory.AccountConfig类的典型用法代码示例。如果您正苦于以下问题:Java AccountConfig类的具体用法?Java AccountConfig怎么用?Java AccountConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccountConfig类属于org.javaswift.joss.client.factory包,在下文中一共展示了AccountConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
public void init() {
AccountConfig config = new AccountConfig();
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(url);
if (StringUtils.isNotEmpty(tenantId)) {
config.setTenantId(tenantId);
}
if (StringUtils.isNotEmpty(tenantName)) {
config.setTenantName(tenantName);
}
Account account = new AccountFactory(config).createAccount();
this.container = account.getContainer(containerName);
}
示例2: login
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
/**
* {@inheritDoc}.
*/
@Override
public synchronized void login(AccountConfig accConf, HasSwiftSettings swiftSettings, String url, String tenant, String user, String pass, SwiftCallback callback) {
String preferredRegion = null ;
if (swiftSettings != null) {
this.segmentationSize = swiftSettings.getSegmentationSize() ;
useCustomSegmentation = true ;
preferredRegion = swiftSettings.getPreferredRegion() ;
preferredRegion = ((preferredRegion == null || preferredRegion.trim().isEmpty()) ? (null) : (preferredRegion.trim())) ;
}
account = new AccountFactory(accConf).setPreferredRegion(preferredRegion).setUsername(user).setPassword(pass).setTenantName(tenant).setAuthUrl(url).createAccount();
largeObjectManager = new LargeObjectManagerImpl (account) ;
callback.onLoginSuccess();
callback.onNumberOfCalls(account.getNumberOfCalls());
}
示例3: getMockAccountConfig
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
public static AccountConfig getMockAccountConfig ()
{
AccountConfig accConf = new AccountConfig () ;
accConf.setAllowCaching(true) ;
accConf.setAllowReauthenticate(true) ;
accConf.setAllowContainerCaching(true) ;
accConf.setAuthUrl(null) ;
accConf.setHashPassword(null) ;
accConf.setMock(true) ;
accConf.setMockAllowEveryone(true) ;
accConf.setMockAllowObjectDeleter(true) ;
accConf.setMockMillisDelay(0) ;
accConf.setMockOnFileObjectStore(null) ;
accConf.setPassword(null) ;
accConf.setPreferredRegion(null) ;
accConf.setPrivateHost(null) ;
accConf.setPublicHost(null) ;
accConf.setSocketTimeout(0) ;
accConf.setTenantName(null) ;
accConf.setTenantId(null) ;
accConf.setUsername(null);
return accConf ;
}
示例4: getHttpClient
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
@Override
public HttpClient getHttpClient(AccountConfig accountConfig, HasProxySettings proxySettings) {
PoolingClientConnectionManager connectionManager = initConnectionManager();
if(accountConfig.isDisableSslValidation()) {
disableSslValidation(connectionManager);
}
org.apache.http.client.HttpClient httpClient = newHttpClient (connectionManager) ;
int socketTimeout = accountConfig.getSocketTimeout() ;
if (socketTimeout != -1) {
logger.info("Set socket timeout on HttpClient: " + socketTimeout);
HttpParams params = httpClient.getParams();
HttpConnectionParams.setSoTimeout(params, socketTimeout);
}
// proxy setting
if (proxySettings != null)
setProxySettings (httpClient, proxySettings, "http") ;
return httpClient ;
}
示例5: init
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
@Before
public void init() {
AccountConfig accConf = AccountConfigFactory.getMockAccountConfig() ;
callback = Mockito.mock(SwiftCallback.class);
SwiftOperations ops = new SwiftOperationsImpl();
// We need to mockup SwiftParameters, because the builder constrains the minimum size
//SwiftParameters param = new SwiftParameters.Builder(segmentSize, true).build() ;
SwiftParameters param = Mockito.mock(SwiftParameters.class);
Mockito.when(param.getSegmentationSize()).thenReturn(segmentSize) ;
ops.login(accConf, param, "http://localhost:8080/", "user", "pass", "secret", callback);
Mockito.verify(callback, Mockito.atLeastOnce()).onLoginSuccess();
account = ((SwiftOperationsImpl)ops).getAccount() ;
largeObjectManager = new LargeObjectManagerImpl (account) ;
container = account.getContainer("x").create();
}
示例6: ViPRSwiftClient
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
public static Account ViPRSwiftClient(String username,String password,String dataNode)throws Exception
{
try {
AccountConfig config = new AccountConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(dataNode + "/v2.0/tokens");
config.setDisableSslValidation(true);
Account account = new AccountFactory(config).createAccount();
return account;
} catch (Exception e) {
System.out.println("error during creating connection with " + dataNode);
e.printStackTrace();
}
return null;
}
示例7: createSwift
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
protected static Account createSwift(String username, String password) {
AccountConfig config = new AccountConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(swiftEndpoint);
config.setAuthenticationMethod(AuthenticationMethod.BASIC);
return new AccountFactory(config).createAccount();
}
示例8: getHubicAccountConfig
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
public static AccountConfig getHubicAccountConfig (final SwiftAccess sa)
{
AccountConfig accConf = new AccountConfig () ;
accConf.setDisableSslValidation(false);
accConf.setAuthenticationMethod(AuthenticationMethod.EXTERNAL);
accConf.setMock(false);
accConf.setAllowReauthenticate(true);
accConf.setAllowCaching(true) ;
accConf.setAccessProvider (getHubicAccessProvider (sa)) ;
return accConf ;
}
示例9: getKeystoneAccountConfig
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
public static AccountConfig getKeystoneAccountConfig ()
{
AccountConfig accConf = new AccountConfig () ;
accConf.setDisableSslValidation(false);
accConf.setAuthenticationMethod(AuthenticationMethod.KEYSTONE);
accConf.setMock(false);
accConf.setAllowReauthenticate(true);
accConf.setAllowCaching(true) ;
return accConf ;
}
示例10: ViPRSwiftClient
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
public static Account ViPRSwiftClient(String username,String password,String dataNode)throws Exception
{
AccountConfig config = new AccountConfig();
config.setUsername(username);
config.setPassword(password);
config.setAuthUrl(dataNode + "/v2.0/tokens");
config.setDisableSslValidation(true);
Account account = new AccountFactory(config).createAccount();
return account;
}
示例11: swiftBasic
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
/**
* Create a Swift account object and connect it to Swift
*
* @param url
* The auth url (eg: localhost:8080/auth/v1.0/)
* @param username
* The username
* @param password
* The password
* @return swift Account
*/
public synchronized Account swiftBasic(String url, String username, String password, String preferredRegion) {
if (swiftUser != null) {
return swiftUser;
}
try {
AccountConfig conf = getStandardConfig(url, username, password, AuthenticationMethod.BASIC, preferredRegion);
swiftUser = createAccount(conf);
} catch (CommandException ce) {
throw new ElasticsearchException("Unable to authenticate to Swift Basic " + url + "/" + username + "/" + password, ce);
}
return swiftUser;
}
示例12: createAccount
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
private Account createAccount(final AccountConfig conf) {
return SwiftPerms.exec(new PrivilegedAction<Account>() {
@Override
public Account run() {
return new AccountFactory(conf).createAccount();
}
});
}
示例13: swiftKeyStone
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
public synchronized Account swiftKeyStone(String url, String username, String password, String tenantName, String preferredRegion) {
if (swiftUser != null) {
return swiftUser;
}
try {
AccountConfig conf = getStandardConfig(url, username, password, AuthenticationMethod.KEYSTONE, preferredRegion);
conf.setTenantName(tenantName);
swiftUser = createAccount(conf);
} catch (CommandException ce) {
throw new ElasticsearchException(
"Unable to authenticate to Swift Keystone " + url + "/" + username + "/" + password + "/" + tenantName, ce);
}
return swiftUser;
}
示例14: swiftTempAuth
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
public synchronized Account swiftTempAuth(String url, String username, String password, String preferredRegion) {
if (swiftUser != null) {
return swiftUser;
}
try {
AccountConfig conf = getStandardConfig(url, username, password, AuthenticationMethod.TEMPAUTH, preferredRegion);
swiftUser = createAccount(conf);
} catch (CommandException ce) {
throw new ElasticsearchException("Unable to authenticate to Swift Temp", ce);
}
return swiftUser;
}
示例15: getStandardConfig
import org.javaswift.joss.client.factory.AccountConfig; //导入依赖的package包/类
private AccountConfig getStandardConfig(String url, String username, String password, AuthenticationMethod method, String preferredRegion) {
AccountConfig conf = new AccountConfig();
conf.setAuthUrl(url);
conf.setUsername(username);
conf.setPassword(password);
conf.setAuthenticationMethod(method);
conf.setAllowContainerCaching(false);
conf.setAllowCaching(false);
conf.setPreferredRegion(preferredRegion);
return conf;
}