public double getDouble(final String property) { final String v = this.getProperty(property); if(null == v) { return -1; } try { return Double.parseDouble(v); } catch(NumberFormatException e) { return -1; } }
public String abbreviate(final String name) { if(StringUtils.startsWith(name, preferences.getProperty("local.user.home"))) { return Local.HOME + StringUtils.removeStart(name, preferences.getProperty("local.user.home")); } return name; }
/** * @param property The property to query. * @return The configured values determined by a whitespace separator. */ public List<String> getList(final String property) { final String value = this.getProperty(property); if(StringUtils.isBlank(value)) { return Collections.emptyList(); } return Arrays.asList(value.split("(?<!\\\\)\\p{javaWhitespace}+")); }
public long getLong(final String property) { final String v = this.getProperty(property); if(null == v) { return -1; } try { return Long.parseLong(v); } catch(NumberFormatException e) { return (long) this.getDouble(property); } }
/** * @return The character encoding to be used when connecting to this server or null * if the default encoding should be used */ public String getEncoding() { if(null == encoding) { return PreferencesFactory.get().getProperty("browser.charset.encoding"); } return encoding; }
@Override public String getContext() { return PreferencesFactory.get().getProperty("openstack.authentication.context"); } }
public float getFloat(final String property) { final String v = this.getProperty(property); if(null == v) { return -1; } try { return Float.parseFloat(v); } catch(NumberFormatException e) { return (float) this.getDouble(property); } }
@Override public Local find() { final Local folder = LocalFactory.get(preferences.getProperty("tmp.dir")); if(log.isDebugEnabled()) { log.debug(String.format("Use folder %s for application resources directory", folder)); } return folder; } }
@Override public Algorithm getDefault(final Path file) { final String setting = preferences.getProperty("s3.encryption.algorithm"); if(StringUtils.equals(KMSEncryptionFeature.SSE_KMS_DEFAULT.algorithm, setting)) { final String key = String.format("s3.encryption.key.%s", containerService.getContainer(file).getName()); if(StringUtils.isNotBlank(preferences.getProperty(key))) { return Algorithm.fromString(preferences.getProperty(key)); } return KMSEncryptionFeature.SSE_KMS_DEFAULT; } return super.getDefault(file); }
@Override public Local find() { final Local folder = LocalFactory.get(LocalFactory.get(preferences.getProperty("local.user.home")), ".duck"); if(log.isDebugEnabled()) { log.debug(String.format("Use folder %s for application support directory", folder)); } return folder; } }
/** * @return The login secret */ public String getPassword() { if(StringUtils.isEmpty(password)) { if(this.isAnonymousLogin()) { return PreferencesFactory.get().getProperty("connection.login.anon.pass"); } } return password; }
@Override public Local getFile() { return LocalFactory.get(PreferencesFactory.get().getProperty("bookmark.import.flashfxp4.common.location")); } }
/** * @return The number of concurrent sessions allowed. -1 if unlimited or null * if the default should be used */ public TransferType getTransferType() { switch(transfer) { case unknown: return Host.TransferType.valueOf(PreferencesFactory.get().getProperty("queue.transfer.type")); } return transfer; }
@Override public Local getFile() { return LocalFactory.get(PreferencesFactory.get().getProperty("bookmark.import.flashfxp4.location")); } }
public TransferPromptController(final WindowController parent, final Transfer transfer) { this.parent = parent; this.transfer = transfer; this.action = TransferAction.forName(preferences.getProperty( String.format("queue.prompt.%s.action.default", transfer.getType().name()))); }
/** * Use given random as prefix for filename * * @param uid Prefix * @param file Filename */ @Override public Local create(final String uid, final Path file) { return this.create(String.format("%s%s%s", uid, PreferencesFactory.get().getProperty("local.delimiter"), file.getName())); }
/** * @return temporary file with name in system temporary directory */ @Override public Local create(final String name) { return this.delete(LocalFactory.get(PreferencesFactory.get().getProperty("tmp.dir"), name)); } }
@Override public <T> T serialize(final Serializer dict) { dict.setStringForKey(this.getAbbreviatedPath(), "Path"); // Get or create application scope bookmark final String bookmark = this.getBookmark(); if(StringUtils.isNotBlank(bookmark)) { dict.setStringForKey(bookmark, String.format("%s Bookmark", PreferencesFactory.get().getProperty("application.name"))); } return dict.getSerialized(); }
@Override public RequestEntityRestStorageService connect(final Proxy proxy, final HostKeyCallback hostkey, final LoginCallback prompt) { final HttpClientBuilder configuration = builder.build(proxy, this, prompt); // Only for AWS if(host.getHostname().endsWith(PreferencesFactory.get().getProperty("s3.hostname.default"))) { configuration.setServiceUnavailableRetryStrategy(new S3TokenExpiredResponseInterceptor(this, prompt)); } return new RequestEntityRestStorageService(this, this.configure(), configuration); }
public void setDefaultBucketLocation(NSPopUpButton b) { this.defaultBucketLocation = b; this.defaultBucketLocation.setAutoenablesItems(false); this.defaultBucketLocation.removeAllItems(); for(Location.Name location : new S3Protocol().getRegions()) { this.defaultBucketLocation.addItemWithTitle(location.toString()); this.defaultBucketLocation.lastItem().setRepresentedObject(location.getIdentifier()); } this.defaultBucketLocation.setTarget(this.id()); this.defaultBucketLocation.setAction(Foundation.selector("defaultBucketLocationClicked:")); this.defaultBucketLocation.selectItemWithTitle(LocaleFactory.localizedString(preferences.getProperty("s3.location"), "S3")); }