public final class WvaUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static DateTime |
dateTimeFromString(String timestamp)
Parse the given time string into a corresponding
DateTime object. |
static String |
getConfigKeyFromUri(String uri)
Given a web services URI or sub-path, intelligently parse out the correct top-level key
to use when applying configuration to the WVA.
|
static String |
getEndpointFromUri(String uri)
Extract the last path piece from the given URI.
|
public static DateTime dateTimeFromString(String timestamp)
DateTime object.timestamp - the time string to parseDateTime objectpublic static String getEndpointFromUri(String uri)
assert getEndpointFromUri("foo/bar/baz").equals("baz");
uri - the path string to parse/),
or null if uri is null or emptypublic static String getConfigKeyFromUri(String uri)
For example, when interacting with ws/config/canbus/1, the JSON we send down
must have the top-level key canbus.
uri - the full request path, or a section of that, to be used when applying configuration
to the WVAconfig/, if config/ is
present in the path. This represents the settings group being configured, which is
the correct string to use as the top-level key.
config, implying that
we will be unable to decide which key to use (because it is not clear what is
being configured).
config is not found as a section of the path.
This implies that uri is the path under ws/config/ being used, and as
such, the first section of the path represents the settings group being configured.