diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2007-04-09 18:25:42 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2007-04-09 18:25:42 +0000 |
commit | 716a3ae013bf361efa4348fea76c1ee873258716 (patch) | |
tree | f4189c67c68cb1fc3437c0eef1b63c0e280d2a8e | |
parent | d28b015b9a95d5ed2308e3d67d80422daf676341 (diff) | |
download | classpath-716a3ae013bf361efa4348fea76c1ee873258716.tar.gz |
2007-04-07 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/management/ObjectName.java:
(propertyValuePattern): New cache variable.
(parse(String)): Record in propertyListPattern
not propertyPattern and set propertyValuePattern.
(isPropertyPattern()): Semantics altered to be the
OR of isPropertyListPattern() and isPropertyValuePattern().
(isPropertyListPattern()): Implemented.
(isPropertyValuePattern()): Implemented.
(isPropertyValuePattern(String)): Implemented.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | javax/management/ObjectName.java | 77 |
2 files changed, 81 insertions, 8 deletions
@@ -1,6 +1,18 @@ 2007-04-07 Andrew John Hughes <gnu_andrew@member.fsf.org> * javax/management/ObjectName.java: + (propertyValuePattern): New cache variable. + (parse(String)): Record in propertyListPattern + not propertyPattern and set propertyValuePattern. + (isPropertyPattern()): Semantics altered to be the + OR of isPropertyListPattern() and isPropertyValuePattern(). + (isPropertyListPattern()): Implemented. + (isPropertyValuePattern()): Implemented. + (isPropertyValuePattern(String)): Implemented. + +2007-04-07 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * javax/management/ObjectName.java: (parse(String)): Fix result of getKeyPropertyListString(). 2007-04-07 Mark Wielaard <mark@klomp.org> diff --git a/javax/management/ObjectName.java b/javax/management/ObjectName.java index 257d8c238..5db81c187 100644 --- a/javax/management/ObjectName.java +++ b/javax/management/ObjectName.java @@ -71,7 +71,7 @@ import java.io.ObjectOutputStream; * is separated by commas, and largely consists of unordered key-value * pairs, separated by an equals sign ('='). At most one element may * be an asterisk ('*'), which turns the {@link ObjectName} instance - * into a <emph>property pattern</emph>. In this situation, the pattern + * into a <emph>property list pattern</emph>. In this situation, the pattern * matches a name if the name contains at least those key-value pairs * given and has the same domain. * </p> @@ -89,6 +89,13 @@ import java.io.ObjectOutputStream; * (after expansion) are considered part of the value. * </p> * <p> + * Both quoted and unquoted values may contain the wildcard characters + * '?' and '*'. A name with at least one value containing a wildcard + * character is known as a <emph>property value pattern</emph>. A + * name is generally a <emph>property pattern</emph> if it is either + * a <emph>property list pattern</emph> or <emph>property value pattern</emph>. + * </p> + * <p> * Spaces are maintained within the different parts of the name. Thus, * '<code>domain: key1 = value1 </code>' has a key ' key1 ' with value * ' value1 '. Newlines are disallowed, except where escaped in quoted @@ -127,9 +134,14 @@ public class ObjectName private transient String propertyListString; /** - * True if this object name is a property pattern. + * True if this object name is a property list pattern. */ - private transient boolean propertyPattern; + private transient boolean propertyListPattern; + + /** + * True if this object name is a property value pattern. + */ + private transient boolean propertyValuePattern; /** * The management server associated with this object name. @@ -201,7 +213,7 @@ public class ObjectName { if (pairs[a].equals("*")) { - propertyPattern = true; + propertyListPattern = true; continue; } int sep = pairs[a].indexOf('='); @@ -322,7 +334,10 @@ public class ObjectName throw new MalformedObjectNameException("A value contains " + "a '" + valchars[a] + "' " + "character."); + } + if (value.indexOf('*') != -1 || value.indexOf('?') != -1) + propertyValuePattern = true; } } @@ -685,14 +700,60 @@ public class ObjectName } /** - * Returns true if this object name is a property pattern. This is - * the case if the list of properties contains an '*'. + * Returns true if this object name is a property list + * pattern, a property value pattern or both. * - * @return true if this is a property pattern. + * @return true if the properties of this name contain a pattern. + * @see #isPropertyListPattern + * @see #isPropertyValuePattern */ public boolean isPropertyPattern() { - return propertyPattern; + return propertyListPattern || propertyValuePattern; + } + + /** + * Returns true if this object name is a property list pattern. This is + * the case if the list of properties contains an '*'. + * + * @return true if this is a property list pattern. + * @since 1.6 + */ + public boolean isPropertyListPattern() + { + return propertyListPattern; + } + + /** + * Returns true if this object name is a property value pattern. This is + * the case if one of the values contains a wildcard character, + * '?' or '*'. + * + * @return true if this is a property value pattern. + * @since 1.6 + */ + public boolean isPropertyValuePattern() + { + return propertyValuePattern; + } + + /** + * Returns true if the value of the given key is a pattern. This is + * the case if the value contains a wildcard character, '?' or '*'. + * + * @param key the key whose value should be checked. + * @return true if the value of the given key is a pattern. + * @since 1.6 + * @throws NullPointerException if {@code key} is {@code null}. + * @throws IllegalArgumentException if {@code key} is not a valid + * property. + */ + public boolean isPropertyValuePattern(String key) + { + String value = getKeyProperty(key); + if (value == null) + throw new IllegalArgumentException(key + " is not a valid property."); + return value.indexOf('?') != -1 || value.indexOf('*') != -1; } /** |