Commit b697e623 by Gary Benson Committed by Gary Benson

AttributeList.java: Updated.

2007-02-15  Gary Benson  <gbenson@redhat.com>

	* javax/management/AttributeList.java: Updated.
	* javax/management/MBeanServerDelegate.java: Likewise.
	* javax/management/MBeanServerFactory.java: Likewise.
	* javax/management/StandardMBean.java: Likewise.

From-SVN: r122004
parent c47277a6
2007-02-15 Gary Benson <gbenson@redhat.com> 2007-02-15 Gary Benson <gbenson@redhat.com>
* javax/management/AttributeList.java: Updated.
* javax/management/MBeanServerDelegate.java: Likewise.
* javax/management/MBeanServerFactory.java: Likewise.
* javax/management/StandardMBean.java: Likewise.
2007-02-15 Gary Benson <gbenson@redhat.com>
* gnu/javax/management/Server.java * gnu/javax/management/Server.java
(registerMBean): Always register objects that implement the (registerMBean): Always register objects that implement the
MBeanRegistration interface, and check the name returned by MBeanRegistration interface, and check the name returned by
......
...@@ -49,7 +49,7 @@ import java.util.ArrayList; ...@@ -49,7 +49,7 @@ import java.util.ArrayList;
* @since 1.5 * @since 1.5
*/ */
public class AttributeList public class AttributeList
extends ArrayList extends ArrayList<Object>
{ {
/** /**
......
...@@ -69,7 +69,7 @@ public class MBeanServerDelegate ...@@ -69,7 +69,7 @@ public class MBeanServerDelegate
/** /**
* The listeners registered with the delegate. * The listeners registered with the delegate.
*/ */
private List listeners; private final List listeners = new ArrayList();
/** /**
* The sequence identifier used by the delegate. * The sequence identifier used by the delegate.
...@@ -120,8 +120,6 @@ public class MBeanServerDelegate ...@@ -120,8 +120,6 @@ public class MBeanServerDelegate
{ {
if (listener == null) if (listener == null)
throw new IllegalArgumentException("A null listener was supplied."); throw new IllegalArgumentException("A null listener was supplied.");
if (listeners == null)
listeners = new ArrayList();
listeners.add(new ListenerData(listener, filter, passback)); listeners.add(new ListenerData(listener, filter, passback));
} }
......
/* MBeanServerFactory.java -- Manages server instances. /* MBeanServerFactory.java -- Manages server instances.
Copyright (C) 2006, 2007 Free Software Foundation, Inc. Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath. This file is part of GNU Classpath.
...@@ -89,7 +89,7 @@ public class MBeanServerFactory ...@@ -89,7 +89,7 @@ public class MBeanServerFactory
/** /**
* The map of registered servers (identifiers to servers). * The map of registered servers (identifiers to servers).
*/ */
private static Map servers = new HashMap(); private static final Map<Object,MBeanServer> servers = new HashMap();
/** /**
* Private constructor to prevent instance creation. * Private constructor to prevent instance creation.
...@@ -206,15 +206,15 @@ public class MBeanServerFactory ...@@ -206,15 +206,15 @@ public class MBeanServerFactory
* caller's permissions don't imply {@link * caller's permissions don't imply {@link
* MBeanServerPermission(String)}("findMBeanServer") * MBeanServerPermission(String)}("findMBeanServer")
*/ */
public static ArrayList findMBeanServer(String id) public static ArrayList<MBeanServer> findMBeanServer(String id)
{ {
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) if (sm != null)
sm.checkPermission(new MBeanServerPermission("findMBeanServer")); sm.checkPermission(new MBeanServerPermission("findMBeanServer"));
if (id == null) if (id == null)
return new ArrayList(servers.values()); return new ArrayList(servers.values());
ArrayList list = new ArrayList(); ArrayList<MBeanServer> list = new ArrayList<MBeanServer>();
MBeanServer server = (MBeanServer) servers.get(id); MBeanServer server = servers.get(id);
if (server != null) if (server != null)
list.add(servers.get(id)); list.add(servers.get(id));
return list; return list;
...@@ -334,7 +334,8 @@ public class MBeanServerFactory ...@@ -334,7 +334,8 @@ public class MBeanServerFactory
builder.getClass() != MBeanServerBuilder.class) builder.getClass() != MBeanServerBuilder.class)
builder = new MBeanServerBuilder(); builder = new MBeanServerBuilder();
} }
else if (!(builderClass.equals(builder.getClass().getName()))) else if (!(builder != null &&
builderClass.equals(builder.getClass().getName())))
{ {
ClassLoader cl = Thread.currentThread().getContextClassLoader(); ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) if (cl == null)
...@@ -394,10 +395,10 @@ public class MBeanServerFactory ...@@ -394,10 +395,10 @@ public class MBeanServerFactory
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
if (sm != null) if (sm != null)
sm.checkPermission(new MBeanServerPermission("releaseMBeanServer")); sm.checkPermission(new MBeanServerPermission("releaseMBeanServer"));
Iterator i = servers.values().iterator(); Iterator<MBeanServer> i = servers.values().iterator();
while (i.hasNext()) while (i.hasNext())
{ {
MBeanServer s = (MBeanServer) i.next(); MBeanServer s = i.next();
if (server == s) if (server == s)
{ {
i.remove(); i.remove();
......
...@@ -107,8 +107,9 @@ public class StandardMBean ...@@ -107,8 +107,9 @@ public class StandardMBean
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
throw (NotCompliantMBeanException) throw (NotCompliantMBeanException)
(new NotCompliantMBeanException("An interface for the class " + (new NotCompliantMBeanException("An interface, " + className +
className + " was not found.").initCause(e)); "MBean, for the class " + className +
" was not found.").initCause(e));
} }
} }
if (!(iface.isInstance(this))) if (!(iface.isInstance(this)))
...@@ -142,13 +143,15 @@ public class StandardMBean ...@@ -142,13 +143,15 @@ public class StandardMBean
String className = impl.getClass().getName(); String className = impl.getClass().getName();
try try
{ {
iface = Class.forName(className + "MBean"); iface = Class.forName(className + "MBean", true,
impl.getClass().getClassLoader());
} }
catch (ClassNotFoundException e) catch (ClassNotFoundException e)
{ {
throw (NotCompliantMBeanException) throw (NotCompliantMBeanException)
(new NotCompliantMBeanException("An interface for the class " + (new NotCompliantMBeanException("An interface, " + className +
className + " was not found.").initCause(e)); "MBean, for the class " + className +
" was not found.").initCause(e));
} }
} }
if (!(iface.isInstance(impl))) if (!(iface.isInstance(impl)))
...@@ -665,7 +668,10 @@ public class StandardMBean ...@@ -665,7 +668,10 @@ public class StandardMBean
ainfo, cinfo, oinfo, null); ainfo, cinfo, oinfo, null);
String cname = getClassName(info); String cname = getClassName(info);
String desc = getDescription(info); String desc = getDescription(info);
info = new MBeanInfo(cname, desc, ainfo, cinfo, oinfo, null); MBeanNotificationInfo[] ninfo = null;
if (impl instanceof NotificationBroadcaster)
ninfo = ((NotificationBroadcaster) impl).getNotificationInfo();
info = new MBeanInfo(cname, desc, ainfo, cinfo, oinfo, ninfo);
cacheMBeanInfo(info); cacheMBeanInfo(info);
return info; return info;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment