|
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.JMXNamespaces
public class JMXNamespaces extends Object
Static constants and utility methods to help work with JMX name spaces. There are no instances of this class.
| Modifier and Type | Field and Description |
|---|---|
static String |
NAMESPACE_SEPARATOR
The name space separator. |
| Modifier and Type | Method and Description | |
|---|---|---|
static String |
concat(String path,
String namespace)
Appends namespace to path. |
|
static
|
deepReplaceHeadNamespace(T obj,
String toRemove,
String toAdd)
Returns an object that is the same as the given object except that any ObjectName it might contain has its domain modified. |
|
static String |
getContainingNamespace(ObjectName name)
Returns the normalized name space path of the name space expected to contain ObjectName. |
|
static ObjectName |
getNamespaceObjectName(String namespace)
Return a canonical handler name for the provided namespace,
The handler name returned will be
normalizeNamespaceName(namespace) +
"//:type=JMXNamespace". |
|
static ObjectName |
getWildcardFor(String namespace)
Returns an ObjectName pattern that can be used to query for all MBeans contained in the given name space. |
|
static ObjectName |
insertPath(String path,
ObjectName to)
Returns an ObjectName that can be used to access an MBean contained in the given name space. |
|
static MBeanServerConnection |
narrowToNamespace(MBeanServerConnection parent,
String namespace)
Creates a new MBeanServerConnection proxy on a
sub name space
of the given parent. |
|
static MBeanServer |
narrowToNamespace(MBeanServer parent,
String namespace)
Creates a new MBeanServer proxy on a
sub name space
of the given parent. |
|
static String |
normalizeNamespaceName(String namespace)
Returns a syntactically valid name space path. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NAMESPACE_SEPARATOR
ObjectName.NAMESPACE_SEPARATOR.
| Method Detail |
|---|
public static MBeanServerConnection narrowToNamespace(MBeanServerConnection parent,
String namespace)
MBeanServerConnection proxy on a
sub name space
of the given parent.
parent - The parent MBeanServerConnection that contains
the name space.namespace - The name space in which to narrow.MBeanServerConnection proxy that shows the content
of that name space.IllegalArgumentException - if either argument is null,
or the name space does not exist, or if a proxy for that name space
cannot be created. The cause of
this exception will be an InstanceNotFoundException if and only
if the name space is found not to exist.
public static MBeanServer narrowToNamespace(MBeanServer parent,
String namespace)
MBeanServer proxy on a
sub name space
of the given parent.
parent - The parent MBeanServer that contains
the name space.namespace - The name space in which to narrow.MBeanServer proxy that shows the content
of that name space.IllegalArgumentException - if either argument is null,
or the name space does not exist, or if a proxy for that name space
cannot be created. The cause of
this exception will be an InstanceNotFoundException if and only
if the name space is found not to exist.
public static <T> T deepReplaceHeadNamespace(T obj,
String toRemove,
String toAdd)
ObjectName it might contain has its domain modified.
The returned object might be identical to the given object if it
does not contain any ObjectName values or if none of them
were modified.
This method will replace a prefix (toRemove) from the path of
the ObjectNames contained in obj by another prefix
(toAdd).
Therefore, all contained ObjectNames must have a path that start with
the given toRemove prefix. If one of them doesn't, an IllegalArgumentException is thrown.
For instance, if obj contains the ObjectName
x//y//z//d:k=x, and toAdd is v//w, and
toRemove
is x//y this method will return a copy of obj that
contains v//w//z//d:k=x.
On the other hand, if obj contains the ObjectName
x//y//z//d:k=x, and toAdd is v//w, and
toRemove is v this method
will raise an exception, because x//y//z//d:k=x doesn't start
with v
Note: the default implementation of this method can use the
Java serialization framework to clone and replace ObjectNames in the
provided obj. It will usually fail if obj is not
Java serializable, or contains objects which are not Java
serializable.
obj - The object to deep-rewritetoRemove - a prefix already present in contained ObjectNames.
If toRemove is the empty string "", nothing
will be removed from the contained ObjectNames.toAdd - the prefix that will replace (@code toRemove} in contained
ObjectNames.
If toAdd is the empty string "", nothing
will be added to the contained ObjectNames.obj if nothing needed
to be changed.IllegalArgumentException - if obj couldn't be rewritten or
if toRemove or toAdd is null.
public static String concat(String path,
String namespace)
namespace to path.
This methods appends namespace to path to obtain a
a full path, and normalizes the result thus obtained:
path is empty, the full path is
namespace.namespace is empty,
the full path is pathpath+"//"+namespace
path - a name space path prefixnamespace - a name space name to append to the pathIllegalArgumentException - if either argument is null or ends with
an odd number of / characters.public static String normalizeNamespaceName(String namespace)
namespace ends with "//",
recursively strips trailing "//". Each sequence of an
even number of "/" characters is also replaced by "//",
for example "foo//bar////baz/////buh" will become
"foo//bar//baz///buh".
namespace - A name space path"" - if the provided namespace resolves to
the empty string; otherwise a syntactically valid name space string
stripped of trailing and redundant "//".IllegalArgumentException - if namespace is null or
is not syntactically valid (e.g. it contains
invalid characters like ':', or it ends with an odd
number of '/').public static ObjectName getNamespaceObjectName(String namespace)
namespace,
The handler name returned will be
normalizeNamespaceName(namespace) +
"//:type=JMXNamespace".
namespace - A name space pathIllegalArgumentException - if the provided
namespace is null or not valid.normalizeNamespaceName(java.lang.String)public static ObjectName getWildcardFor(String namespace)
namespace="foo//bar", this method will
return "foo//bar//*:*"
public static ObjectName insertPath(String path,
ObjectName to)
path="foo//bar", and
to="domain:type=Thing" this method will
return "foo//bar//domain:type=Thing"
IllegalArgumentException - if path ends with an
odd number of / characters.public static String getContainingNamespace(ObjectName name)
ObjectName.
For instance, for "foo//domain:type=Thing" this will be
"foo". For "//foo//bar//domain:type=Thing" this will be
"foo//bar". For //foo//bar//baz//domain:type=Thing
this will be "foo//bar//baz". For
//foo//bar//baz//:type=JMXNamespace
this will be "foo//bar".
name - an ObjectNamename has no name space, returns "".IllegalArgumentException - if name is null.
|
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.