private S3StorageProvider getS3StorageProvider() { if (!storageAccountManager.isInitialized()) { throw new DuraCloudRuntimeException("storageAccountManager is not initialized!!!"); } final StorageAccount account = storageAccountManager.getPrimaryStorageAccount(); return new S3StorageProvider(account.getUsername(), account.getPassword(), account.getOptions()); } }
if (storeId == null) { for (StorageAccount account : accounts) { if (account.isPrimary()) { storeId = account.getId(); break; if (account.getId().equals(storeId)) { StorageProviderType type = account.getType(); if (type.equals(StorageProviderType.DPN) || type.equals(StorageProviderType.CHRONOPOLIS)) {
acct.setId(value); acct.setOwnerId(value); acct.setPrimary(Boolean.valueOf(value)); acct.setType(StorageProviderType.fromString(value)); acct.setUsername(value); acct.setPassword(value); acct.setOption(StorageAccount.OPTS.CF_ACCOUNT_ID.name(), value); acct.setOption(StorageAccount.OPTS.CF_KEY_ID.name(), value); acct.setOption(StorageAccount.OPTS.CF_KEY_PATH.name(), value); acct.setOption(StorageAccount.OPTS.ZONE.name(), value); acct.setOption(StorageAccount.OPTS.HOST.name(), value); acct.setOption(StorageAccount.OPTS.PORT.name(), value); acct.setOption(StorageAccount.OPTS.BASE_DIRECTORY.name(), value); acct.setOption(StorageAccount.OPTS.RESOURCE.name(), value); acct.setOption(StorageAccount.OPTS.SNAPSHOT_USER.name(), value);
protected String validateStoreId(String storeId) throws ManifestArgumentException { // validate storeId; if (StringUtils.isBlank(storeId)) { for (StorageAccount storageAccount : this.storageProviderFactory.getStorageAccounts()) { if (storageAccount.isPrimary()) { storeId = storageAccount.getId(); break; } } if (StringUtils.isBlank(storeId)) { throw new ManifestArgumentException("storeId is blank and " + "no primary storage account is " + "indicated for this account."); } } else { boolean matches = false; for (StorageAccount storageAccount : this.storageProviderFactory.getStorageAccounts()) { if (storageAccount.getId().equals(storeId)) { matches = true; break; } } if (!matches) { throw new ManifestArgumentException("The storeId you supplied (" + storeId + ") is not associated with this domain."); } } return storeId; }
public void setStorageAccounts(Set<StorageAccount> storageAccts) { this.storageAccounts = new HashMap<>(); for (StorageAccount storageAcct : storageAccts) { this.storageAccounts.put(storageAcct.getId(), storageAcct); } }
protected boolean isWritable(StorageAccount acct) { return Boolean.valueOf(acct.getOptions().get(StorageAccount.OPTS.WRITABLE.name())); }