diff options
author | Gary Benson <gbenson@redhat.com> | 2007-02-20 15:02:38 +0000 |
---|---|---|
committer | Gary Benson <gary@gcc.gnu.org> | 2007-02-20 15:02:38 +0000 |
commit | c7e576cf1547b62332291d719985655c85cbbc6d (patch) | |
tree | 11facc4a5bb6a13eb2c81ebb451b52a543b0b46c /libjava/classpath | |
parent | cc0c8dbc9363a9355c3ab81588b583f1a49a58b0 (diff) | |
download | gcc-c7e576cf1547b62332291d719985655c85cbbc6d.zip gcc-c7e576cf1547b62332291d719985655c85cbbc6d.tar.gz gcc-c7e576cf1547b62332291d719985655c85cbbc6d.tar.bz2 |
MBeanServer.java: Updated.
2007-02-20 Gary Benson <gbenson@redhat.com>
* javax/management/MBeanServer.java: Updated.
* javax/management/MBeanServerConnection.java: Likewise.
* javax/management/ObjectName.java: Likewise.
* javax/management/StandardMBean.java: Likewise.
From-SVN: r122165
Diffstat (limited to 'libjava/classpath')
-rw-r--r-- | libjava/classpath/ChangeLog.gcj | 7 | ||||
-rw-r--r-- | libjava/classpath/javax/management/MBeanServer.java | 4 | ||||
-rw-r--r-- | libjava/classpath/javax/management/MBeanServerConnection.java | 4 | ||||
-rw-r--r-- | libjava/classpath/javax/management/ObjectName.java | 135 | ||||
-rw-r--r-- | libjava/classpath/javax/management/StandardMBean.java | 19 | ||||
-rw-r--r-- | libjava/classpath/lib/javax/management/MBeanServer.class | bin | 4177 -> 4423 bytes | |||
-rw-r--r-- | libjava/classpath/lib/javax/management/MBeanServerConnection.class | bin | 3243 -> 3489 bytes | |||
-rw-r--r-- | libjava/classpath/lib/javax/management/ObjectName.class | bin | 8394 -> 8844 bytes | |||
-rw-r--r-- | libjava/classpath/lib/javax/management/StandardMBean.class | bin | 14328 -> 14615 bytes |
9 files changed, 93 insertions, 76 deletions
diff --git a/libjava/classpath/ChangeLog.gcj b/libjava/classpath/ChangeLog.gcj index c147ab6..9273fe2 100644 --- a/libjava/classpath/ChangeLog.gcj +++ b/libjava/classpath/ChangeLog.gcj @@ -1,3 +1,10 @@ +2007-02-20 Gary Benson <gbenson@redhat.com> + + * javax/management/MBeanServer.java: Updated. + * javax/management/MBeanServerConnection.java: Likewise. + * javax/management/ObjectName.java: Likewise. + * javax/management/StandardMBean.java: Likewise. + 2007-02-15 David Daney <ddaney@avtrex.com> * tools/Makefile.am (TOOLS_ZIP): Add classes from vm-tools-packages. diff --git a/libjava/classpath/javax/management/MBeanServer.java b/libjava/classpath/javax/management/MBeanServer.java index 73a28e3..0be5d71 100644 --- a/libjava/classpath/javax/management/MBeanServer.java +++ b/libjava/classpath/javax/management/MBeanServer.java @@ -890,7 +890,7 @@ public interface MBeanServer * arise from the execution of the query, in which * case that particular bean will again be excluded. */ - Set queryMBeans(ObjectName name, QueryExp query); + Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query); /** * <p> @@ -929,7 +929,7 @@ public interface MBeanServer * Note that these permissions are implied if the * <code>queryMBeans</code> permissions are available. */ - Set queryNames(ObjectName name, QueryExp query); + Set<ObjectName> queryNames(ObjectName name, QueryExp query); /** * Registers the supplied instance with the server, using the specified diff --git a/libjava/classpath/javax/management/MBeanServerConnection.java b/libjava/classpath/javax/management/MBeanServerConnection.java index dff03e8..cba6dac 100644 --- a/libjava/classpath/javax/management/MBeanServerConnection.java +++ b/libjava/classpath/javax/management/MBeanServerConnection.java @@ -533,7 +533,7 @@ public interface MBeanServerConnection * @throws IOException if an I/O error occurred in communicating with * the bean server. */ - Set queryMBeans(ObjectName name, QueryExp query) + Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query) throws IOException; /** @@ -560,7 +560,7 @@ public interface MBeanServerConnection * @throws IOException if an I/O error occurred in communicating with * the bean server. */ - Set queryNames(ObjectName name, QueryExp query) + Set<ObjectName> queryNames(ObjectName name, QueryExp query) throws IOException; /** diff --git a/libjava/classpath/javax/management/ObjectName.java b/libjava/classpath/javax/management/ObjectName.java index 757b80f..8259eab 100644 --- a/libjava/classpath/javax/management/ObjectName.java +++ b/libjava/classpath/javax/management/ObjectName.java @@ -105,7 +105,7 @@ public class ObjectName /** * The properties, as key-value pairs. */ - private TreeMap properties; + private TreeMap<String,String> properties = new TreeMap<String,String>(); /** * The properties as a string (stored for ordering). @@ -164,7 +164,6 @@ public class ObjectName throw new MalformedObjectNameException("A name that is not a " + "pattern must contain at " + "least one key-value pair."); - properties = new TreeMap(); for (int a = 0; a < pairs.length; ++a) { int sep = pairs[a].indexOf('='); @@ -197,7 +196,6 @@ public class ObjectName throws MalformedObjectNameException { this.domain = domain; - properties = new TreeMap(); properties.put(key, value); checkComponents(); } @@ -216,7 +214,7 @@ public class ObjectName * @throws NullPointerException if one of the parameters is * <code>null</code>. */ - public ObjectName(String domain, Hashtable properties) + public ObjectName(String domain, Hashtable<String,String> properties) throws MalformedObjectNameException { this.domain = domain; @@ -305,70 +303,80 @@ public class ObjectName { if (name.isPattern()) return false; - if (isPattern()) + + if (!isPattern()) + return equals(name); + + if (isDomainPattern()) { - boolean domainMatch, propMatch; - if (isDomainPattern()) + if (!domainMatches(domain, 0, name.getDomain(), 0)) + return false; + } + else + { + if (!domain.equals(name.getDomain())) + return false; + } + + if (isPropertyPattern()) + { + Hashtable oProps = name.getKeyPropertyList(); + Iterator i = properties.entrySet().iterator(); + while (i.hasNext()) { - String oDomain = name.getDomain(); - int oLength = oDomain.length(); - for (int a = 0; a < domain.length(); ++a) - { - char n = domain.charAt(a); - if (oLength == a && n != '*') - return false; - if (n == '?') - continue; - if (n == '*') - if ((a + 1) < domain.length()) - { - if (oLength == a) - return false; - char next; - do - { - next = domain.charAt(a + 1); - } while (next == '*'); - if (next == '?') - continue; - int pos = a; - while (oDomain.charAt(pos) != next) - { - ++pos; - if (pos == oLength) - return false; - } - } - if (n != oDomain.charAt(a)) - return false; - } - domainMatch = true; + Map.Entry entry = (Map.Entry) i.next(); + String key = (String) entry.getKey(); + if (!(oProps.containsKey(key))) + return false; + String val = (String) entry.getValue(); + if (!(val.equals(oProps.get(key)))) + return false; } - else - domainMatch = domain.equals(name.getDomain()); - if (isPropertyPattern()) + } + else + { + if (!getCanonicalKeyPropertyListString().equals + (name.getCanonicalKeyPropertyListString())) + return false; + } + return true; + } + + /** + * Returns true if the domain matches the pattern. + * + * @param pattern the pattern to match against. + * @param patternindex the index into the pattern to start matching. + * @param domain the domain to match. + * @param domainindex the index into the domain to start matching. + * @return true if the domain matches the pattern. + */ + private static boolean domainMatches(String pattern, int patternindex, + String domain, int domainindex) + { + while (patternindex < pattern.length()) + { + char c = pattern.charAt(patternindex++); + + if (c == '*') { - Hashtable oProps = name.getKeyPropertyList(); - Iterator i = properties.entrySet().iterator(); - while (i.hasNext()) + for (int i = domain.length(); i >= domainindex; i--) { - Map.Entry entry = (Map.Entry) i.next(); - String key = (String) entry.getKey(); - if (!(oProps.containsKey(key))) - return false; - String val = (String) entry.getValue(); - if (!(val.equals(oProps.get(key)))) - return false; + if (domainMatches(pattern, patternindex, domain, i)) + return true; } - propMatch = true; + return false; } - else - propMatch = - getCanonicalKeyPropertyListString().equals - (name.getCanonicalKeyPropertyListString()); - return domainMatch && propMatch; + + if (domainindex >= domain.length()) + return false; + + if (c != '?' && c != domain.charAt(domainindex)) + return false; + + domainindex++; } - return equals(name); + return true; } /** @@ -542,7 +550,8 @@ public class ObjectName * specifications. * @throws NullPointerException if <code>name</code> is <code>null</code>. */ - public static ObjectName getInstance(String domain, Hashtable properties) + public static ObjectName getInstance(String domain, + Hashtable<String,String> properties) throws MalformedObjectNameException { return new ObjectName(domain, properties); @@ -571,9 +580,9 @@ public class ObjectName * @return a {@link java.util.Hashtable}, containing each of the object * name's properties. */ - public Hashtable getKeyPropertyList() + public Hashtable<String,String> getKeyPropertyList() { - return new Hashtable(properties); + return new Hashtable<String,String>(properties); } /** diff --git a/libjava/classpath/javax/management/StandardMBean.java b/libjava/classpath/javax/management/StandardMBean.java index 0434a40..b31436c 100644 --- a/libjava/classpath/javax/management/StandardMBean.java +++ b/libjava/classpath/javax/management/StandardMBean.java @@ -69,7 +69,7 @@ public class StandardMBean /** * The interface for this bean. */ - private Class iface; + private Class<?> iface; /** * The implementation of the interface. @@ -94,7 +94,7 @@ public class StandardMBean * in the interface that doesn't comply * with the naming conventions. */ - protected StandardMBean(Class iface) + protected StandardMBean(Class<?> iface) throws NotCompliantMBeanException { if (iface == null) @@ -133,7 +133,7 @@ public class StandardMBean * in the interface that doesn't comply * with the naming conventions. */ - public StandardMBean(Object impl, Class iface) + public <T> StandardMBean(T impl, Class<T> iface) throws NotCompliantMBeanException { if (impl == null) @@ -143,8 +143,8 @@ public class StandardMBean String className = impl.getClass().getName(); try { - iface = Class.forName(className + "MBean", true, - impl.getClass().getClassLoader()); + this.iface = Class.forName(className + "MBean", true, + impl.getClass().getClassLoader()); } catch (ClassNotFoundException e) { @@ -154,11 +154,12 @@ public class StandardMBean " was not found.").initCause(e)); } } - if (!(iface.isInstance(impl))) + else + this.iface = iface; + if (!(this.iface.isInstance(impl))) throw new NotCompliantMBeanException("The instance, " + impl + ", is not an instance of " + iface); this.impl = impl; - this.iface = iface; } /** @@ -493,7 +494,7 @@ public class StandardMBean * * @return the implementation class. */ - public Class getImplementationClass() + public Class<?> getImplementationClass() { return impl.getClass(); } @@ -681,7 +682,7 @@ public class StandardMBean * * @return the management interface. */ - public final Class getMBeanInterface() + public final Class<?> getMBeanInterface() { return iface; } diff --git a/libjava/classpath/lib/javax/management/MBeanServer.class b/libjava/classpath/lib/javax/management/MBeanServer.class Binary files differindex 1194582..68c2041 100644 --- a/libjava/classpath/lib/javax/management/MBeanServer.class +++ b/libjava/classpath/lib/javax/management/MBeanServer.class diff --git a/libjava/classpath/lib/javax/management/MBeanServerConnection.class b/libjava/classpath/lib/javax/management/MBeanServerConnection.class Binary files differindex 2ca079e..7f60a3e 100644 --- a/libjava/classpath/lib/javax/management/MBeanServerConnection.class +++ b/libjava/classpath/lib/javax/management/MBeanServerConnection.class diff --git a/libjava/classpath/lib/javax/management/ObjectName.class b/libjava/classpath/lib/javax/management/ObjectName.class Binary files differindex 720f668..28a3f54 100644 --- a/libjava/classpath/lib/javax/management/ObjectName.class +++ b/libjava/classpath/lib/javax/management/ObjectName.class diff --git a/libjava/classpath/lib/javax/management/StandardMBean.class b/libjava/classpath/lib/javax/management/StandardMBean.class Binary files differindex 29ed9db..be54235 100644 --- a/libjava/classpath/lib/javax/management/StandardMBean.class +++ b/libjava/classpath/lib/javax/management/StandardMBean.class |