/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return The matching {@link NamedFactory} for the configured value. * {@code null} if no configuration or unknown name specified * @see ConfigFileReaderSupport#COMPRESSION_PROP COMPRESSION_PROP */ public static CompressionFactory getCompression(PropertyResolver props) { return CompressionConfigValue.fromName( (props == null) ? null : props.getString(ConfigFileReaderSupport.COMPRESSION_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return The matching {@link NamedFactory} for the configured value. * {@code null} if no configuration or unknown name specified * @see ConfigFileReaderSupport#COMPRESSION_PROP COMPRESSION_PROP */ public static CompressionFactory getCompression(PropertyResolver props) { return CompressionConfigValue.fromName( (props == null) ? null : props.getString(ConfigFileReaderSupport.COMPRESSION_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return A {@code ParseResult} of all the {@link NamedFactory}-ies * whose name appears in the string and represent a built-in MAC. Any * unknown name is <U>ignored</U>. The order of the returned result * is the same as the original order - bar the unknown MACs. * <B>Note:</B> it is up to caller to ensure that the list does not * contain duplicates * @see ConfigFileReaderSupport#MACS_CONFIG_PROP MACS_CONFIG_PROP * @see BuiltinMacs#parseMacsList(String) */ public static BuiltinMacs.ParseResult getMacs(PropertyResolver props) { return BuiltinMacs.parseMacsList( (props == null) ? null : props.getString(ConfigFileReaderSupport.MACS_CONFIG_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return A {@code ParseResult} of all the {@link NamedFactory} * whose name appears in the string and represent a built-in signature. Any * unknown name is <U>ignored</U>. The order of the returned result is the * same as the original order - bar the unknown signatures. <B>Note:</B> it * is up to caller to ensure that the list does not contain duplicates * @see ConfigFileReaderSupport#HOST_KEY_ALGORITHMS_CONFIG_PROP HOST_KEY_ALGORITHMS_CONFIG_PROP * @see BuiltinSignatures#parseSignatureList(String) */ public static BuiltinSignatures.ParseResult getSignatures(PropertyResolver props) { return BuiltinSignatures.parseSignatureList( (props == null) ? null : props.getString(ConfigFileReaderSupport.HOST_KEY_ALGORITHMS_CONFIG_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return A {@code ParseResult} of all the {@link DHFactory}-ies * whose name appears in the string and represent a built-in value. Any * unknown name is <U>ignored</U>. The order of the returned result is the * same as the original order - bar the unknown ones. <B>Note:</B> it is * up to caller to ensure that the list does not contain duplicates * @see ConfigFileReaderSupport#KEX_ALGORITHMS_CONFIG_PROP KEX_ALGORITHMS_CONFIG_PROP * @see BuiltinDHFactories#parseDHFactoriesList(String) */ public static BuiltinDHFactories.ParseResult getKexFactories(PropertyResolver props) { return BuiltinDHFactories.parseDHFactoriesList( (props == null) ? null : props.getString(ConfigFileReaderSupport.KEX_ALGORITHMS_CONFIG_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return A {@code ParseResult} of all the {@link NamedFactory} * whose name appears in the string and represent a built-in signature. Any * unknown name is <U>ignored</U>. The order of the returned result is the * same as the original order - bar the unknown signatures. <B>Note:</B> it * is up to caller to ensure that the list does not contain duplicates * @see ConfigFileReaderSupport#HOST_KEY_ALGORITHMS_CONFIG_PROP HOST_KEY_ALGORITHMS_CONFIG_PROP * @see BuiltinSignatures#parseSignatureList(String) */ public static BuiltinSignatures.ParseResult getSignatures(PropertyResolver props) { return BuiltinSignatures.parseSignatureList( (props == null) ? null : props.getString(ConfigFileReaderSupport.HOST_KEY_ALGORITHMS_CONFIG_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return A {@code ParseResult} of all the {@link DHFactory}-ies * whose name appears in the string and represent a built-in value. Any * unknown name is <U>ignored</U>. The order of the returned result is the * same as the original order - bar the unknown ones. <B>Note:</B> it is * up to caller to ensure that the list does not contain duplicates * @see ConfigFileReaderSupport#KEX_ALGORITHMS_CONFIG_PROP KEX_ALGORITHMS_CONFIG_PROP * @see BuiltinDHFactories#parseDHFactoriesList(String) */ public static BuiltinDHFactories.ParseResult getKexFactories(PropertyResolver props) { return BuiltinDHFactories.parseDHFactoriesList( (props == null) ? null : props.getString(ConfigFileReaderSupport.KEX_ALGORITHMS_CONFIG_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return A {@code ParseResult} of all the {@link NamedFactory}-ies * whose name appears in the string and represent a built-in cipher. * Any unknown name is <U>ignored</U>. The order of the returned result * is the same as the original order - bar the unknown ciphers. * <B>Note:</B> it is up to caller to ensure that the lists do not * contain duplicates * @see ConfigFileReaderSupport#CIPHERS_CONFIG_PROP CIPHERS_CONFIG_PROP * @see BuiltinCiphers#parseCiphersList(String) */ public static BuiltinCiphers.ParseResult getCiphers(PropertyResolver props) { return BuiltinCiphers.parseCiphersList( (props == null) ? null : props.getString(ConfigFileReaderSupport.CIPHERS_CONFIG_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return A {@code ParseResult} of all the {@link NamedFactory}-ies * whose name appears in the string and represent a built-in MAC. Any * unknown name is <U>ignored</U>. The order of the returned result * is the same as the original order - bar the unknown MACs. * <B>Note:</B> it is up to caller to ensure that the list does not * contain duplicates * @see ConfigFileReaderSupport#MACS_CONFIG_PROP MACS_CONFIG_PROP * @see BuiltinMacs#parseMacsList(String) */ public static BuiltinMacs.ParseResult getMacs(PropertyResolver props) { return BuiltinMacs.parseMacsList( (props == null) ? null : props.getString(ConfigFileReaderSupport.MACS_CONFIG_PROP)); }
/** * @param props The {@link PropertyResolver} - ignored if {@code null}/empty * @return A {@code ParseResult} of all the {@link NamedFactory}-ies * whose name appears in the string and represent a built-in cipher. * Any unknown name is <U>ignored</U>. The order of the returned result * is the same as the original order - bar the unknown ciphers. * <B>Note:</B> it is up to caller to ensure that the lists do not * contain duplicates * @see ConfigFileReaderSupport#CIPHERS_CONFIG_PROP CIPHERS_CONFIG_PROP * @see BuiltinCiphers#parseCiphersList(String) */ public static BuiltinCiphers.ParseResult getCiphers(PropertyResolver props) { return BuiltinCiphers.parseCiphersList( (props == null) ? null : props.getString(ConfigFileReaderSupport.CIPHERS_CONFIG_PROP)); }
protected SftpVersionSelector resolveSftpVersionSelector(URI uri, SftpVersionSelector defaultSelector, PropertyResolver resolver) { String preference = resolver.getString(VERSION_PARAM); if (GenericUtils.isEmpty(preference)) { return defaultSelector; } if (log.isDebugEnabled()) { log.debug("resolveSftpVersionSelector({}) preference={}", uri, preference); } if ("max".equalsIgnoreCase(preference)) { return SftpVersionSelector.MAXIMUM; } else if ("min".equalsIgnoreCase(preference)) { return SftpVersionSelector.MINIMUM; } else if ("current".equalsIgnoreCase(preference)) { return SftpVersionSelector.CURRENT; } String[] values = GenericUtils.split(preference, ','); if (values.length == 1) { return SftpVersionSelector.fixedVersionSelector(Integer.parseInt(values[0])); } int[] preferred = new int[values.length]; for (int index = 0; index < values.length; index++) { preferred[index] = Integer.parseInt(values[index]); } return SftpVersionSelector.preferredVersionSelector(preferred); }
throws IOException { PropertyResolver manager = getFactoryManager(); String valStr = manager.getString(property); T val = defaultValue; if (!GenericUtils.isEmpty(valStr)) {
protected <T> boolean setOption(NetworkChannel socket, String property, SocketOption<T> option, T defaultValue) throws IOException { PropertyResolver manager = getFactoryManager(); String valStr = manager.getString(property); T val = defaultValue; if (!GenericUtils.isEmpty(valStr)) {
static boolean isSecurityEntitySupported(PropertyResolver resolver, String propName, Class<?> entityType, String name, String defaultValue) { if (GenericUtils.isEmpty(name)) { return false; } String propValue = resolver.getString(propName); if (GenericUtils.isEmpty(propValue)) { propValue = defaultValue; } if (NO_OPTIONS_VALUE.equalsIgnoreCase(propValue)) { return false; } String[] values = GenericUtils.split(propValue, ','); if (GenericUtils.isEmpty(values)) { return false; } if ((values.length == 1) && isAllOptionsValue(values[0])) { return true; } String effectiveName = getEffectiveSecurityEntityName(entityType, name); int index = Arrays.binarySearch(values, effectiveName, String.CASE_INSENSITIVE_ORDER); return index >= 0; }
static boolean isSecurityEntitySupported(PropertyResolver resolver, String propName, Class<?> entityType, String name, String defaultValue) { if (GenericUtils.isEmpty(name)) { return false; } String propValue = resolver.getString(propName); if (GenericUtils.isEmpty(propValue)) { propValue = defaultValue; } if (NO_OPTIONS_VALUE.equalsIgnoreCase(propValue)) { return false; } String[] values = GenericUtils.split(propValue, ','); if (GenericUtils.isEmpty(values)) { return false; } if ((values.length == 1) && isAllOptionsValue(values[0])) { return true; } String effectiveName = getEffectiveSecurityEntityName(entityType, name); int index = Arrays.binarySearch(values, effectiveName, String.CASE_INSENSITIVE_ORDER); return index >= 0; }