/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties} with masking. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to resolve variables in properties string. * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr, Set<String> propsToMask) throws IOException { if(properties==null) return this; properties = Util.replaceMacro(properties, propertiesGeneratingResolver(vr)); for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), entry.getValue().toString(), (propsToMask == null) ? false : propsToMask.contains(entry.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @since 1.262 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), false); } return this; }
public FormValidation doCheckProperties(@QueryParameter String properties) throws IOException { try { if (validPropertyNames==null) { // this computation depends on the implementation details of MySQL JDBC connector GroovyShell gs = new GroovyShell(getClass().getClassLoader()); validPropertyNames = (Set<String>)gs.evaluate(new InputStreamReader(MySQLDatabase.class.getResourceAsStream("validate.groovy"))); } Properties props = Util.loadProperties(properties); for (Map.Entry e : props.entrySet()) { String key = e.getKey().toString(); if (!validPropertyNames.contains(key)) return FormValidation.error("Unrecognized property: "+key); } return FormValidation.ok(); } catch (Throwable e) { return FormValidation.warning(e,"Failed to validate the connection properties"); } } }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given * string using {@link Properties} with masking. * * @param prefix The '-D' portion of the example. Defaults to -D if null. * @param properties The persisted form of {@link Properties}. For example, * "abc=def\nghi=jkl". Can be null, in which case this method becomes no-op. * @param vr {@link VariableResolver} to be performed on the values. * @param propsToMask Set containing key names to mark as masked in the * argument list. Key names that do not exist in the set will be added * unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr, Set<String> propsToMask) throws IOException { if (properties == null) { return this; } for (Entry<Object, Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String) entry.getKey(), Util.replaceMacro(entry.getValue().toString(), vr), (propsToMask == null) ? false : propsToMask.contains((String) entry.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @since 1.262 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), false); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties}. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @since 1.262 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), false); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given * string using {@link Properties}. * * @param prefix The '-D' portion of the example. Defaults to -D if null. * @param properties The persisted form of {@link Properties}. For example, * "abc=def\nghi=jkl". Can be null, in which case this method becomes no-op. * @param vr {@link VariableResolver} to be performed on the values. * @since 1.262 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr) throws IOException { if (properties == null) { return this; } for (Entry<Object, Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String) entry.getKey(), Util.replaceMacro(entry.getValue().toString(), vr), false); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties} with masking. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr, Set<String> propsToMask) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), (propsToMask == null) ? false : propsToMask.contains((String)entry.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties} with masking. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr, Set<String> propsToMask) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), (propsToMask == null) ? false : propsToMask.contains((String)entry.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties} with masking. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to be performed on the values. * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver vr, Set<String> propsToMask) throws IOException { if(properties==null) return this; for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), Util.replaceMacro(entry.getValue().toString(),vr), (propsToMask == null) ? false : propsToMask.contains((String)entry.getKey())); } return this; }
/** * Adds key value pairs as "-Dkey=value -Dkey=value ..." by parsing a given string using {@link Properties} with masking. * * @param prefix * The '-D' portion of the example. Defaults to -D if null. * @param properties * The persisted form of {@link Properties}. For example, "abc=def\nghi=jkl". Can be null, in which * case this method becomes no-op. * @param vr * {@link VariableResolver} to resolve variables in properties string. * @param propsToMask * Set containing key names to mark as masked in the argument list. Key * names that do not exist in the set will be added unmasked. * @since 1.378 */ public ArgumentListBuilder addKeyValuePairsFromPropertyString(String prefix, String properties, VariableResolver<String> vr, Set<String> propsToMask) throws IOException { if(properties==null) return this; properties = Util.replaceMacro(properties, propertiesGeneratingResolver(vr)); for (Entry<Object,Object> entry : Util.loadProperties(properties).entrySet()) { addKeyValuePair(prefix, (String)entry.getKey(), entry.getValue().toString(), (propsToMask == null) ? false : propsToMask.contains(entry.getKey())); } return this; }