|
Java™ Platform Standard Ed. 7 DRAFT ea-b76 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.management.namespace.JMXNamespaceView
public class JMXNamespaceView extends Object
This class makes it possible to navigate easily within a hierarchical namespace view.
MBeanServerConnnection rootConnection = ...;
// create a view at the local root of the namespace hierarchy.
//
JMXNamespaceView view = new JMXNamespaceView(rootConnection);
// list all top level namespaces
String[] list = view.list();
// select one namespace from the list
String whereToGo = ... ;
// go down to the selected namespace:
view = view.down(whereToGo);
System.out.println("I am now in: " + view.where());
System.out.println("I can see these MBeans:" +
view.getMBeanServerConnection().queryNames(null,null));
// list sub namespaces in current view ('whereToGo')
list = view.list();
System.out.println("Here are the sub namespaces of "+view.where()+": "+
Arrays.toString(list));
// go up one level
view = view.up();
System.out.println("I am now back to: " +
(view.isRoot() ? "root namespace" : view.where()));
| Constructor and Description |
|---|
JMXNamespaceView(MBeanServerConnection namespaceRoot)
Creates a view at the top of a JMX namespace hierarchy. |
| Modifier and Type | Method and Description |
|---|---|
JMXNamespaceView |
down(String namespace)
Go down into a sub namespace. |
boolean |
equals(Object o)
Returns true if this object is equal to the given object. |
ObjectName |
getJMXNamespaceMBeanName()
Get the name of the JMXNamespaceMBean handling the namespace shown by this view, relative to the root of the hierarchy. |
MBeanServerConnection |
getMBeanServerConnection()
A MBeanServerConnection to the namespace shown by this view. |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
isRoot()
Tells whether this view is at the root of the hierarchy. |
String[] |
list()
Lists all direct sub namespaces in this view. |
JMXNamespaceView |
root()
Returns the view at the root of the hierarchy. |
JMXNamespaceView |
up()
Go back up one level. |
String |
where()
Returns the path leading to the namespace in this view, from the top of the hierarchy. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JMXNamespaceView(MBeanServerConnection namespaceRoot)
namespaceRoot - The MBeanServerConnection at the
top of the hierarchy.| Method Detail |
|---|
public String where()
public String[] list()
throws IOException
// separator.
IOException - if the attempt to list the namespaces fails because
of a communication problem.public JMXNamespaceView down(String namespace)
namespace - the namespace to go down to. It can contain one or
more // separators, to traverse intermediate namespaces, but
it must not begin or end with // or contain an empty
intermediate namespace. If it is the empty string, then this is
returned.IllegalArgumentException - if the namespace begins or
ends with //.public JMXNamespaceView up()
null.
null if we're at
the root of the hierarchy.public boolean isRoot()
true if this view is at the root of the hierachy.public JMXNamespaceView root()
this.
public MBeanServerConnection getMBeanServerConnection()
JMX.narrowToNamespace(this.root().getMBeanServerConnection(),
this.where());
public ObjectName getJMXNamespaceMBeanName()
Get the name of the JMXNamespaceMBean handling the namespace shown by
this view, relative to the root of the hierarchy. If we are at the root
of the hierarchy, this method returns null.
You can use this method to make a proxy for the JMXNamespaceMBean as follows:
JMXNamespaceView view = ...;
ObjectName namespaceMBeanName = view.getJMXNamespaceMBeanName();
JMXNamespaceMBean namespaceMBean = JMX.newMBeanProxy(
view.root().getMBeanServerConnection(), namespaceMBeanName,
JMXNamespaceMBean.class);
JMXNamespaceMBean handling the namespace
shown by this view, or null.public int hashCode()
ObjectHashMap.
The general contract of hashCode is:
hashCode method
must consistently return the same integer, provided no information
used in equals comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
JavaTM programming language.)
hashCode in class ObjectObject.equals(java.lang.Object),
System.identityHashCode(java.lang.Object)public boolean equals(Object o)
JMXNamespaceView and both objects have the same root
MBeanServerConnection and the same path.
equals in class Objecto - the other object to compare to.Object.hashCode(),
HashMap
|
Java™ Platform Standard Ed. 7 DRAFT ea-b76 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.