public interface ManagedObjectManager extends Closeable
Modifier and Type | Interface and Description |
---|---|
static class |
ManagedObjectManager.RegistrationDebugLevel
DebugLevel used to control how much debug info is printed for
registration of objects.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(AnnotatedElement element,
Annotation annotation)
Method to add an annotation to an element that cannot be modified.
|
void |
addInheritedAnnotations(Class<?> cls)
Add all annotations for this class as if they were declared on the
inheritance parent(s) of the class (immediate superclass for a class, all
immediate superinterfaces for an interface).
|
GmbalMBean |
createRoot()
Create a default root MBean.
|
GmbalMBean |
createRoot(Object root)
Create a root MBean from root, which much have a method with the
|
GmbalMBean |
createRoot(Object root,
String name)
Create a root MBean from root with the given name.
|
String |
dumpSkeleton(Object obj)
Dump the skeleton used in the implementation of the MBean for obj.
|
AMXClient |
getAMXClient(Object obj)
Get an AMXClient instance for the object obj, if obj is registered
as an MBean in this mom.
|
String |
getDomain()
Return the domain name that was used when this ManagedObjectManager
was created.
|
MBeanServer |
getMBeanServer()
Get the current MBeanServer.
|
Object |
getObject(ObjectName oname)
Get the Object that was registered with the given ObjectName.
|
ObjectName |
getObjectName(Object obj)
Get the ObjectName for the given object (which must have
been registered via a register call).
|
org.glassfish.pfl.tf.timer.spi.ObjectRegistrationManager |
getObjectRegistrationManager()
Return an ObjectRegistrationManager as required in the pfl timer services.
|
ResourceBundle |
getResourceBundle()
Get the resource bundle (if any) set by setResourceBundle.
|
Object |
getRoot()
Return the root of this ManagedObjectManager.
|
boolean |
isManagedObject(Object obj)
Return true if object is assignment compatible with a class or interface
that has an @ManagedObject annotation, otherwise false.
|
GmbalMBean |
register(Object parent,
Object obj)
Same as register( parent, obj, name ), but here the name
is derived from an @NameValue annotation.
|
GmbalMBean |
register(Object parent,
Object obj,
String name)
Construct an Open Mean for obj according to its annotations,
and register it with domain getDomain() and the appropriate
ObjectName.
|
GmbalMBean |
registerAtRoot(Object obj)
Same as registerAtRoot( Object, String ), but here the name
is derived from an @ObjectKeyName annotation.
|
GmbalMBean |
registerAtRoot(Object obj,
String name)
Registers the MBean for obj at the root MBean for the ObjectManager,
using the given name.
|
void |
resumeJMXRegistration()
Decrements the suspend counter, if the counter is greater than 0.
|
void |
setJMXRegistrationDebug(boolean flag)
Set debugging for JMX registrations.
|
void |
setMBeanServer(MBeanServer server)
Set the MBeanServer to which all MBeans using this interface
are published.
|
void |
setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel level)
Print debug output to System.out.
|
void |
setResourceBundle(ResourceBundle rb)
Set the ResourceBundle to use for getting localized descriptions.
|
void |
setRuntimeDebug(boolean flag)
Enable generation of debug log at INFO level for runtime MBean operations
to the org.glassfish.gmbal.impl logger.
|
void |
setTypelibDebug(int level)
Enabled generation of debug log for type evaluator debugging.
|
void |
stripPackagePrefix()
Change the default type name algorithm so that if nothing else
applies, the entire package prefix is stripped form the Class name.
|
void |
stripPrefix(String... str)
Add a type prefix to strip from type names, to shorten the names for
a better presentation to the user.
|
void |
suppressDuplicateRootReport(boolean suppressReport)
Suppress reporting of a duplicate root name.
|
void |
suspendJMXRegistration()
If called, no MBeans created after this call will be registered with
the JMX MBeanServer until resumeJMXRegistration is called.
|
void |
unregister(Object obj)
Unregister the Open MBean corresponding to obj from the
mbean server.
|
void suspendJMXRegistration()
void resumeJMXRegistration()
boolean isManagedObject(Object obj)
GmbalMBean createRoot()
IllegalStateException
- if called after a call to any
createRoot method.GmbalMBean createRoot(Object root)
root
- The Java object to be used to construct the root.IllegalStateException
- if called after a call to any
createRoot method.GmbalMBean createRoot(Object root, String name)
root
- The Java object to be used to construct the root.name
- The ObjectName name field to be used in the ObjectName of
the MBean constructed from root.IllegalStateException
- if called after a call to any
createRoot method.Object getRoot()
GmbalMBean register(Object parent, Object obj, String name)
The MBeanInfo for the result is actually ModelMBeanInfo, and may contain extra metadata as defined using annotations defined with the
parent
- The parent object that contains obj.obj
- The managed object we are registering.name
- The name to use for registering this object.IllegalStateException
- if called before a createRoot method is
called successfully.GmbalMBean register(Object parent, Object obj)
This version of register should also be used to register singletons.
parent
- The parent object that contains obj.obj
- The managed object we are registering.IllegalStateException
- if called before a createRoot method is
called successfully.GmbalMBean registerAtRoot(Object obj, String name)
Must be called after a successful createRoot call.
This version of register should not be used to register singletons.
obj
- The object for which we construct and register an MBean.name
- The name of the MBean.IllegalStateException
- if called before a createRoot method is
called successfully.GmbalMBean registerAtRoot(Object obj)
This version of register should also be used to register singletons.
obj
- The managed object we are registering.IllegalStateException
- if called before a createRoot method is
called successfully.void unregister(Object obj)
Must be called after a successful createRoot call.
obj
- The object originally passed to a register method.ObjectName getObjectName(Object obj)
Must be called after a successful createRoot call.
obj
- The object originally passed to a register call.AMXClient getAMXClient(Object obj)
Must be called after a successful createRoot call.
obj
- The object corresponding to an MBean.Object getObject(ObjectName oname)
Must be called after a successful createRoot call.
oname
- The ObjectName used to register the object.void stripPrefix(String... str)
str
- Class package name to strip from type name.IllegalStateException
- if called after createRoot method.void stripPackagePrefix()
IllegalStateException
- if called after a createRoot method.String getDomain()
May be called at any time.
void setMBeanServer(MBeanServer server)
Must be called before a successful createRoot call.
server
- The MBeanServer to set as the MBeanServer for this
ManagedObjectManager.MBeanServer getMBeanServer()
May be called at any time.
void setResourceBundle(ResourceBundle rb)
Must be called before a successful call to a createRoot method.
rb
- The resource bundle to use. May be null.ResourceBundle getResourceBundle()
May be called at any time.
void addAnnotation(AnnotatedElement element, Annotation annotation)
element
- The annotated element (class or method for our purposes).annotation
- The annotation we wish to add to the element.IllegalStateException
- if called after a call to a createRoot
method.void addInheritedAnnotations(Class<?> cls)
cls
- Class to analyze for inherited annotations.void setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel level)
May be called at any time.
level
- NONE is no debugging at all, NORMAL traces high-level
construction of skeletons and type converters, and dumps results of new
skeletons and type converters, FINE traces everything in great detail.
The tracing is done with INFO-level logger calls. The logger name is
that package name (org.glassfish.gmbal.impl).void setRuntimeDebug(boolean flag)
May be called at any time.
flag
- true to enable runtime debug, false to disable.void setTypelibDebug(int level)
May be called at any time.
level
- set to 1 to just see the results of the TypeEvaluator, >1 to
see lots of details. WARNING: values >1 will result in a large amount
of output.void setJMXRegistrationDebug(boolean flag)
flag
- True to enalbed registration tracing.String dumpSkeleton(Object obj)
Must be called after a successful call to a createRoot method.
obj
- The registered object whose skeleton should be displayed.void suppressDuplicateRootReport(boolean suppressReport)
Must be called before a successful call to a createRoot method.
org.glassfish.pfl.tf.timer.spi.ObjectRegistrationManager getObjectRegistrationManager()
Can be called at any time.
Copyright © 2017 Oracle. All rights reserved.