GUACAMOLE-2051: Allow Guacamole properties to be either comma or semi-colon delimited.
This commit is contained in:
1 parent
0db9294153
commit
63987d84fd
8 files changed
+60
-9
No files matched your search
@@ -23,6 +23,7 @@ import java.io.File;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -30,6 +31,14 @@ import org.apache.guacamole.GuacamoleException;
|
|||||||
*/
|
*/
|
||||||
public abstract class FileGuacamoleProperty implements GuacamoleProperty<File> {
|
public abstract class FileGuacamoleProperty implements GuacamoleProperty<File> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern which matches against the delimiters between values. This is
|
||||||
|
* currently either a comma or a semicolon and any following whitespace.
|
||||||
|
* Parts of the input string which match this pattern will not be included
|
||||||
|
* in the parsed result.
|
||||||
|
*/
|
||||||
|
static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File parseValue(String value) throws GuacamoleException {
|
public File parseValue(String value) throws GuacamoleException {
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package org.apache.guacamole.properties;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,14 +32,6 @@ import org.apache.guacamole.GuacamoleException;
|
|||||||
*/
|
*/
|
||||||
public interface GuacamoleProperty<Type> {
|
public interface GuacamoleProperty<Type> {
|
||||||
|
|
||||||
/**
|
|
||||||
* A pattern which matches against the delimiters between values. This is
|
|
||||||
* currently simply a semicolon and any following whitespace. Parts of the
|
|
||||||
* input string which match this pattern will not be included in the parsed
|
|
||||||
* result.
|
|
||||||
*/
|
|
||||||
static final Pattern DELIMITER_PATTERN = Pattern.compile(";\\s*");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the property in guacamole.properties that this
|
* Returns the name of the property in guacamole.properties that this
|
||||||
* GuacamoleProperty will parse.
|
* GuacamoleProperty will parse.
|
||||||
|
|||||||
+9
@@ -22,6 +22,7 @@ package org.apache.guacamole.properties;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleServerException;
|
import org.apache.guacamole.GuacamoleServerException;
|
||||||
|
|
||||||
@@ -30,6 +31,14 @@ import org.apache.guacamole.GuacamoleServerException;
|
|||||||
*/
|
*/
|
||||||
public abstract class IntegerGuacamoleProperty implements GuacamoleProperty<Integer> {
|
public abstract class IntegerGuacamoleProperty implements GuacamoleProperty<Integer> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern which matches against the delimiters between values. This is
|
||||||
|
* currently either a comma or a semicolon and any following whitespace.
|
||||||
|
* Parts of the input string which match this pattern will not be included
|
||||||
|
* in the parsed result.
|
||||||
|
*/
|
||||||
|
static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer parseValue(String value) throws GuacamoleException {
|
public Integer parseValue(String value) throws GuacamoleException {
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package org.apache.guacamole.properties;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleServerException;
|
import org.apache.guacamole.GuacamoleServerException;
|
||||||
|
|
||||||
@@ -30,6 +31,14 @@ import org.apache.guacamole.GuacamoleServerException;
|
|||||||
*/
|
*/
|
||||||
public abstract class LongGuacamoleProperty implements GuacamoleProperty<Long> {
|
public abstract class LongGuacamoleProperty implements GuacamoleProperty<Long> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern which matches against the delimiters between values. This is
|
||||||
|
* currently either a comma or a semicolon and any following whitespace.
|
||||||
|
* Parts of the input string which match this pattern will not be included
|
||||||
|
* in the parsed result.
|
||||||
|
*/
|
||||||
|
static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long parseValue(String value) throws GuacamoleException {
|
public Long parseValue(String value) throws GuacamoleException {
|
||||||
|
|
||||||
|
|||||||
+9
@@ -21,6 +21,7 @@ package org.apache.guacamole.properties;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,6 +29,14 @@ import org.apache.guacamole.GuacamoleException;
|
|||||||
*/
|
*/
|
||||||
public abstract class StringGuacamoleProperty implements GuacamoleProperty<String> {
|
public abstract class StringGuacamoleProperty implements GuacamoleProperty<String> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern which matches against the delimiters between values. This is
|
||||||
|
* currently either a comma or a semicolon and any following whitespace.
|
||||||
|
* Parts of the input string which match this pattern will not be included
|
||||||
|
* in the parsed result.
|
||||||
|
*/
|
||||||
|
static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String parseValue(String value) throws GuacamoleException {
|
public String parseValue(String value) throws GuacamoleException {
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ import org.apache.guacamole.GuacamoleException;
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public abstract class StringListProperty implements GuacamoleProperty<List<String>> {
|
public abstract class StringListProperty implements GuacamoleProperty<List<String>> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern which matches against the delimiters between values. This is
|
||||||
|
* currently either a comma or a semicolon and any following whitespace.
|
||||||
|
* Parts of the input string which match this pattern will not be included
|
||||||
|
* in the parsed result.
|
||||||
|
*/
|
||||||
|
static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> parseValue(String values) throws GuacamoleException {
|
public List<String> parseValue(String values) throws GuacamoleException {
|
||||||
|
|
||||||
|
|||||||
+8
@@ -33,6 +33,14 @@ import org.apache.guacamole.GuacamoleServerException;
|
|||||||
public abstract class TimeZoneGuacamoleProperty
|
public abstract class TimeZoneGuacamoleProperty
|
||||||
implements GuacamoleProperty<TimeZone> {
|
implements GuacamoleProperty<TimeZone> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern which matches against the delimiters between values. This is
|
||||||
|
* currently either a comma or a semicolon and any following whitespace.
|
||||||
|
* Parts of the input string which match this pattern will not be included
|
||||||
|
* in the parsed result.
|
||||||
|
*/
|
||||||
|
static final Pattern DELIMITER_PATTERN = Pattern.compile("[,;]\\s*");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A regex that matches valid variants of GMT timezones.
|
* A regex that matches valid variants of GMT timezones.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import java.net.URISyntaxException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleServerException;
|
import org.apache.guacamole.GuacamoleServerException;
|
||||||
|
|
||||||
@@ -32,6 +33,13 @@ import org.apache.guacamole.GuacamoleServerException;
|
|||||||
*/
|
*/
|
||||||
public abstract class URIGuacamoleProperty implements GuacamoleProperty<URI> {
|
public abstract class URIGuacamoleProperty implements GuacamoleProperty<URI> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A pattern which matches against the delimiters between values. For the
|
||||||
|
* URIGuacamoleProperty, this is set to one or more spaces, as commas and
|
||||||
|
* semicolons are valid in URIs while white space is not.
|
||||||
|
*/
|
||||||
|
static final Pattern DELIMITER_PATTERN = Pattern.compile("\\s+");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URI parseValue(String value) throws GuacamoleException {
|
public URI parseValue(String value) throws GuacamoleException {
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user