本文整理汇总了Java中org.javaswift.joss.model.Account类的典型用法代码示例。如果您正苦于以下问题:Java Account类的具体用法?Java Account怎么用?Java Account使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Account类属于org.javaswift.joss.model包,在下文中一共展示了Account类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.javaswift.joss.model.Account; //导入依赖的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: isJobSuccessful
import org.javaswift.joss.model.Account; //导入依赖的package包/类
/**
* Checks if container/object contains
* container/object/_SUCCESS
* If so, this object was created by successful Hadoop job
*
* @param objectName
* @return boolean if job is successful
*/
private boolean isJobSuccessful(String objectName) {
LOG.trace("Checking if job completed successfull for {}", objectName);
if (cachedSparkJobsStatus.containsKey(objectName)) {
return cachedSparkJobsStatus.get(objectName).booleanValue();
}
String obj = objectName;
Account account = mJossAccount.getAccount();
LOG.trace("HEAD {}", obj + "/" + HADOOP_SUCCESS);
StoredObject so = account.getContainer(container).getObject(obj
+ "/" + HADOOP_SUCCESS);
Boolean isJobOK = Boolean.FALSE;
if (so.exists()) {
LOG.debug("{} exists", obj + "/" + HADOOP_SUCCESS);
isJobOK = Boolean.TRUE;
}
cachedSparkJobsStatus.put(objectName, isJobOK);
return isJobOK.booleanValue();
}
示例3: ViPRSwiftClient
import org.javaswift.joss.model.Account; //导入依赖的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;
}
示例4: CreateObject
import org.javaswift.joss.model.Account; //导入依赖的package包/类
public static void CreateObject(String username,String passwod,String dataNode, String container, String key, InputStream content)throws Exception
{
try{
Account client = ViPRSwiftClient(username, passwod, dataNode);
Container myContainer = client.getContainer(container);
if (!myContainer.exists()) {
myContainer.create();
myContainer.makePublic();
}
StoredObject object = myContainer.getObject(key);
object.uploadObject(content);
}
catch(Exception e)
{
System.out.println("error during creating "+key);
e.printStackTrace();
}
}
示例5: createSomeObjects
import org.javaswift.joss.model.Account; //导入依赖的package包/类
protected static void createSomeObjects(Account account) {
Container container =
account.getContainer("container-" + UUID.randomUUID().toString().toLowerCase());
container.create();
for (int i = 0; i < 3; i++) {
container
.getObject("OBJECT-" + UUID.randomUUID())
.uploadObject(createString(4096).getBytes());
}
}
示例6: createSwift
import org.javaswift.joss.model.Account; //导入依赖的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();
}
示例7: getAccount
import org.javaswift.joss.model.Account; //导入依赖的package包/类
/**
* Get account
*
* @return Account
*/
public Account getAccount() {
if (mAccount == null) {
createAccount();
}
return mAccount;
}
示例8: createAccount
import org.javaswift.joss.model.Account; //导入依赖的package包/类
public Account createAccount() {
final Client client;
if (mConfig.isMock()) {
client = createClientMock();
} else {
client = createClientImpl();
}
return client.authenticate();
}
示例9: eagerFetchContainers
import org.javaswift.joss.model.Account; //导入依赖的package包/类
private Collection<Container> eagerFetchContainers(Account parent) {
parent.reload();
List<Container> results = new ArrayList<Container>(parent.getCount());
PaginationMap map = parent.getPaginationMap(MAX_PAGE_SIZE);
for (int page = 0; page < map.getNumberOfPages(); page++) {
results.addAll(parent.list(map, page));
}
return results;
}
示例10: ReadObject
import org.javaswift.joss.model.Account; //导入依赖的package包/类
public static InputStream ReadObject(String username,String passwod,String dataNode, String container, String key)throws Exception {
try {
Account client = ViPRSwiftClient(username, passwod, dataNode);
Container myContainer = client.getContainer(container);
StoredObject object = myContainer.getObject(key);
return object.downloadObjectAsInputStream();
} catch (Exception e) {
System.out.println("error during reading " + key);
e.printStackTrace();
}
return null;
}
示例11: DeleteObject
import org.javaswift.joss.model.Account; //导入依赖的package包/类
public static void DeleteObject(String username,String passwod,String dataNode, String container, String key)throws Exception {
try {
Account client = ViPRSwiftClient(username, passwod, dataNode);
Container myContainer = client.getContainer(container);
StoredObject object = myContainer.getObject(key);
object.delete();
} catch (Exception e) {
System.out.println("error during delete " + key);
e.printStackTrace();
}
}
示例12: ViPRSwiftClient
import org.javaswift.joss.model.Account; //导入依赖的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;
}
示例13: CreateObject
import org.javaswift.joss.model.Account; //导入依赖的package包/类
public static void CreateObject(String username,String passwod,String dataNode, String container, String key, InputStream content)throws Exception
{
Account client= ViPRSwiftClient(username, passwod, dataNode);
Container myContainer=client.getContainer(container);
StoredObject object = myContainer.getObject(key);
object.uploadObject(content);
}
示例14: ReadObject
import org.javaswift.joss.model.Account; //导入依赖的package包/类
public static InputStream ReadObject(String username,String passwod,String dataNode, String container, String key)throws Exception
{
Account client= ViPRSwiftClient(username, passwod, dataNode);
Container myContainer=client.getContainer(container);
StoredObject object = myContainer.getObject(key);
return object.downloadObjectAsInputStream();
}
示例15: DeleteObject
import org.javaswift.joss.model.Account; //导入依赖的package包/类
public static void DeleteObject(String username,String passwod,String dataNode, String container, String key)throws Exception
{
Account client= ViPRSwiftClient(username, passwod, dataNode);
Container myContainer=client.getContainer(container);
StoredObject object = myContainer.getObject(key);
object.delete();
}