public class ManagedObjectManagerImpl extends java.lang.Object implements ManagedObjectManagerInternal
| Modifier and Type | Class and Description |
|---|---|
static interface |
ManagedObjectManagerImpl.DummyAverageRangeStatistic |
static interface |
ManagedObjectManagerImpl.DummyBoundaryStatistic |
static interface |
ManagedObjectManagerImpl.DummyBoundedRangeStatistic |
static interface |
ManagedObjectManagerImpl.DummyCountStatistic |
static interface |
ManagedObjectManagerImpl.DummyRangeStatistic |
static interface |
ManagedObjectManagerImpl.DummyStatistic |
static interface |
ManagedObjectManagerImpl.DummyStringStatistic |
static interface |
ManagedObjectManagerImpl.DummyTimeStatistic |
ManagedObjectManagerInternal.AttributeDescriptorTypeManagedObjectManager.RegistrationDebugLevel| Constructor and Description |
|---|
ManagedObjectManagerImpl(javax.management.ObjectName rootParentName) |
ManagedObjectManagerImpl(java.lang.String domain) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAnnotation(java.lang.reflect.AnnotatedElement element,
java.lang.annotation.Annotation annotation)
Method to add an annotation to an element that cannot be modified.
|
void |
addInheritedAnnotations(java.lang.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).
|
void |
close() |
MBeanImpl |
constructMBean(MBeanImpl parentEntity,
java.lang.Object obj,
java.lang.String name) |
GmbalMBean |
createRoot()
Create a default root MBean.
|
GmbalMBean |
createRoot(java.lang.Object root)
Create a root MBean from root, which much have a method with the
|
GmbalMBean |
createRoot(java.lang.Object root,
java.lang.String name)
Create a root MBean from root with the given name.
|
java.lang.String |
dumpSkeleton(java.lang.Object obj)
Dump the skeleton used in the implementation of the MBean for obj.
|
<T extends EvaluatedDeclaration> |
forAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation,
java.lang.Class<T> cls) |
AMXClient |
getAMXClient(java.lang.Object obj)
Get an AMXClient instance for the object obj, if obj is registered
as an MBean in this mom.
|
<T extends java.lang.annotation.Annotation> |
getAnnotation(java.lang.reflect.AnnotatedElement element,
java.lang.Class<T> type) |
java.util.Collection<java.lang.annotation.Annotation> |
getAnnotations(java.lang.reflect.AnnotatedElement elem) |
org.glassfish.pfl.basic.contain.Pair<java.util.Map<java.lang.String,AttributeDescriptor>,java.util.Map<java.lang.String,AttributeDescriptor>> |
getAttributes(EvaluatedClassAnalyzer ca,
ManagedObjectManagerInternal.AttributeDescriptorType adt) |
org.glassfish.pfl.basic.contain.Pair<EvaluatedClassDeclaration,EvaluatedClassAnalyzer> |
getClassAnalyzer(EvaluatedClassDeclaration cls,
java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
Find the superclass or superinterface of cls (which may be cls itself)
that has the given annotationClass as an annotation.
|
AMXMetadata |
getDefaultAMXMetadata() |
java.lang.String |
getDescription(EvaluatedDeclaration element) |
java.lang.String |
getDomain()
Return the domain name that was used when this ManagedObjectManager
was created.
|
org.glassfish.pfl.basic.facet.FacetAccessor |
getFacetAccessor(java.lang.Object obj) |
<T extends java.lang.annotation.Annotation> |
getFirstAnnotationOnClass(EvaluatedClassDeclaration element,
java.lang.Class<T> type) |
java.util.List<InheritedAttribute> |
getInheritedAttributes(EvaluatedClassAnalyzer ca)
Get the inherited attributes from the EvaluatedClassAnalyzer.
|
javax.management.MBeanServer |
getMBeanServer()
Get the current MBeanServer.
|
java.lang.Object |
getObject(javax.management.ObjectName oname)
Get the Object that was registered with the given ObjectName.
|
javax.management.ObjectName |
getObjectName(java.lang.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.
|
java.util.ResourceBundle |
getResourceBundle()
Get the resource bundle (if any) set by setResourceBundle.
|
java.lang.Object |
getRoot()
Return the root of this ManagedObjectManager.
|
javax.management.ObjectName |
getRootParentName() |
TypeConverter |
getTypeConverter(EvaluatedType type)
Construct or lookup the TypeConverter for the given type.
|
java.lang.String |
getTypeName(java.lang.Class<?> cls,
java.lang.String fieldName,
java.lang.String nameFromAnnotation) |
boolean |
isAMXAttributeName(java.lang.String name) |
boolean |
isManagedObject(java.lang.Object obj)
Return true if object is assignment compatible with a class or interface
that has an @ManagedObject annotation, otherwise false.
|
boolean |
jmxRegistrationDebug() |
<K,V> void |
putIfNotPresent(java.util.Map<K,V> map,
K key,
V value) |
GmbalMBean |
register(java.lang.Object parent,
java.lang.Object obj)
Same as register( parent, obj, name ), but here the name
is derived from an @NameValue annotation.
|
GmbalMBean |
register(java.lang.Object parent,
java.lang.Object obj,
java.lang.String name)
Construct an Open Mean for obj according to its annotations,
and register it with domain getDomain() and the appropriate
ObjectName.
|
GmbalMBean |
registerAtRoot(java.lang.Object obj)
Same as registerAtRoot( Object, String ), but here the name
is derived from an @ObjectKeyName annotation.
|
GmbalMBean |
registerAtRoot(java.lang.Object obj,
java.lang.String name)
Registers the MBean for obj at the root MBean for the ObjectManager,
using the given name.
|
boolean |
registrationDebug() |
boolean |
registrationFineDebug() |
void |
resumeJMXRegistration()
Decrements the suspend counter, if the counter is greater than 0.
|
boolean |
runtimeDebug() |
void |
setJMXRegistrationDebug(boolean flag)
Set debugging for JMX registrations.
|
void |
setMBeanServer(javax.management.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(java.util.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(java.lang.String... args)
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.
|
java.lang.String |
toString() |
void |
unregister(java.lang.Object obj)
Unregister the Open MBean corresponding to obj from the
mbean server.
|
public ManagedObjectManagerImpl(java.lang.String domain)
public ManagedObjectManagerImpl(javax.management.ObjectName rootParentName)
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic void suspendJMXRegistration()
ManagedObjectManagersuspendJMXRegistration in interface ManagedObjectManagerpublic void resumeJMXRegistration()
ManagedObjectManagerresumeJMXRegistration in interface ManagedObjectManagerpublic void stripPackagePrefix()
ManagedObjectManagerstripPackagePrefix in interface ManagedObjectManagerpublic java.lang.String toString()
toString in class java.lang.Objectpublic javax.management.ObjectName getRootParentName()
getRootParentName in interface ManagedObjectManagerInternalpublic GmbalMBean createRoot()
ManagedObjectManagercreateRoot in interface ManagedObjectManagerpublic GmbalMBean createRoot(java.lang.Object root)
ManagedObjectManagercreateRoot in interface ManagedObjectManagerroot - The Java object to be used to construct the root.public GmbalMBean createRoot(java.lang.Object root, java.lang.String name)
ManagedObjectManagercreateRoot in interface ManagedObjectManagerroot - 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.public java.lang.Object getRoot()
ManagedObjectManagergetRoot in interface ManagedObjectManagerpublic TypeConverter getTypeConverter(EvaluatedType type)
ManagedObjectManagerInternalgetTypeConverter in interface ManagedObjectManagerInternaltype - The type for which we need a TypeConverter.public java.lang.String getTypeName(java.lang.Class<?> cls,
java.lang.String fieldName,
java.lang.String nameFromAnnotation)
getTypeName in interface ManagedObjectManagerInternalpublic boolean isManagedObject(java.lang.Object obj)
ManagedObjectManagerisManagedObject in interface ManagedObjectManagerpublic MBeanImpl constructMBean(MBeanImpl parentEntity, java.lang.Object obj, java.lang.String name)
constructMBean in interface ManagedObjectManagerInternalpublic GmbalMBean register(java.lang.Object parent, java.lang.Object obj, java.lang.String name)
ManagedObjectManagerThe MBeanInfo for the result is actually ModelMBeanInfo, and may contain extra metadata as defined using annotations defined with the
register in interface ManagedObjectManagerparent - The parent object that contains obj.obj - The managed object we are registering.name - The name to use for registering this object.public GmbalMBean register(java.lang.Object parent, java.lang.Object obj)
ManagedObjectManagerThis version of register should also be used to register singletons.
register in interface ManagedObjectManagerparent - The parent object that contains obj.obj - The managed object we are registering.public GmbalMBean registerAtRoot(java.lang.Object obj, java.lang.String name)
ManagedObjectManagerMust be called after a successful createRoot call.
This version of register should not be used to register singletons.
registerAtRoot in interface ManagedObjectManagerobj - The object for which we construct and register an MBean.name - The name of the MBean.public GmbalMBean registerAtRoot(java.lang.Object obj)
ManagedObjectManagerThis version of register should also be used to register singletons.
registerAtRoot in interface ManagedObjectManagerobj - The managed object we are registering.public void unregister(java.lang.Object obj)
ManagedObjectManagerMust be called after a successful createRoot call.
unregister in interface ManagedObjectManagerobj - The object originally passed to a register method.public javax.management.ObjectName getObjectName(java.lang.Object obj)
ManagedObjectManagerMust be called after a successful createRoot call.
getObjectName in interface ManagedObjectManagerobj - The object originally passed to a register call.public AMXClient getAMXClient(java.lang.Object obj)
ManagedObjectManagerMust be called after a successful createRoot call.
getAMXClient in interface ManagedObjectManagerobj - The object corresponding to an MBean.public java.lang.Object getObject(javax.management.ObjectName oname)
ManagedObjectManagerMust be called after a successful createRoot call.
getObject in interface ManagedObjectManageroname - The ObjectName used to register the object.public org.glassfish.pfl.basic.facet.FacetAccessor getFacetAccessor(java.lang.Object obj)
getFacetAccessor in interface ManagedObjectManagerInternalpublic java.lang.String getDomain()
ManagedObjectManagerMay be called at any time.
getDomain in interface ManagedObjectManagerpublic void setMBeanServer(javax.management.MBeanServer server)
ManagedObjectManagerMust be called before a successful createRoot call.
setMBeanServer in interface ManagedObjectManagerserver - The MBeanServer to set as the MBeanServer for this
ManagedObjectManager.public javax.management.MBeanServer getMBeanServer()
ManagedObjectManagerMay be called at any time.
getMBeanServer in interface ManagedObjectManagerpublic void setResourceBundle(java.util.ResourceBundle rb)
ManagedObjectManagerMust be called before a successful call to a createRoot method.
setResourceBundle in interface ManagedObjectManagerrb - The resource bundle to use. May be null.public java.util.ResourceBundle getResourceBundle()
ManagedObjectManagerMay be called at any time.
getResourceBundle in interface ManagedObjectManagerpublic java.lang.String getDescription(EvaluatedDeclaration element)
getDescription in interface ManagedObjectManagerInternalpublic void addAnnotation(java.lang.reflect.AnnotatedElement element,
java.lang.annotation.Annotation annotation)
ManagedObjectManageraddAnnotation in interface ManagedObjectManagerelement - The annotated element (class or method for our purposes).annotation - The annotation we wish to add to the element.public void addInheritedAnnotations(java.lang.Class<?> cls)
ManagedObjectManageraddInheritedAnnotations in interface ManagedObjectManagercls - Class to analyze for inherited annotations.public <T extends java.lang.annotation.Annotation> T getFirstAnnotationOnClass(EvaluatedClassDeclaration element, java.lang.Class<T> type)
getFirstAnnotationOnClass in interface ManagedObjectManagerInternalpublic <T extends java.lang.annotation.Annotation> T getAnnotation(java.lang.reflect.AnnotatedElement element,
java.lang.Class<T> type)
getAnnotation in interface ManagedObjectManagerInternalpublic java.util.Collection<java.lang.annotation.Annotation> getAnnotations(java.lang.reflect.AnnotatedElement elem)
getAnnotations in interface ManagedObjectManagerInternalpublic org.glassfish.pfl.basic.contain.Pair<EvaluatedClassDeclaration,EvaluatedClassAnalyzer> getClassAnalyzer(EvaluatedClassDeclaration cls, java.lang.Class<? extends java.lang.annotation.Annotation> annotationClass)
ManagedObjectManagerInternalgetClassAnalyzer in interface ManagedObjectManagerInternalcls - The class for which we need a EvaluatedClassAnalyzer.annotationClass - The annotation that must be present on cls or
a superclass or superinterface.public java.util.List<InheritedAttribute> getInheritedAttributes(EvaluatedClassAnalyzer ca)
ManagedObjectManagerInternalgetInheritedAttributes in interface ManagedObjectManagerInternalca - The ClassAnalyzer to check for InheritedAttribute(s).public <K,V> void putIfNotPresent(java.util.Map<K,V> map,
K key,
V value)
putIfNotPresent in interface ManagedObjectManagerInternalpublic org.glassfish.pfl.basic.contain.Pair<java.util.Map<java.lang.String,AttributeDescriptor>,java.util.Map<java.lang.String,AttributeDescriptor>> getAttributes(EvaluatedClassAnalyzer ca, ManagedObjectManagerInternal.AttributeDescriptorType adt)
getAttributes in interface ManagedObjectManagerInternalpublic void setRegistrationDebug(ManagedObjectManager.RegistrationDebugLevel level)
ManagedObjectManagerMay be called at any time.
setRegistrationDebug in interface ManagedObjectManagerlevel - 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).public void setJMXRegistrationDebug(boolean flag)
ManagedObjectManagersetJMXRegistrationDebug in interface ManagedObjectManagerflag - True to enalbed registration tracing.public void setRuntimeDebug(boolean flag)
ManagedObjectManagerMay be called at any time.
setRuntimeDebug in interface ManagedObjectManagerflag - true to enable runtime debug, false to disable.public void setTypelibDebug(int level)
ManagedObjectManagerMay be called at any time.
setTypelibDebug in interface ManagedObjectManagerlevel - 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.public java.lang.String dumpSkeleton(java.lang.Object obj)
ManagedObjectManagerMust be called after a successful call to a createRoot method.
dumpSkeleton in interface ManagedObjectManagerobj - The registered object whose skeleton should be displayed.public boolean registrationDebug()
registrationDebug in interface ManagedObjectManagerInternalpublic boolean registrationFineDebug()
registrationFineDebug in interface ManagedObjectManagerInternalpublic boolean runtimeDebug()
runtimeDebug in interface ManagedObjectManagerInternalpublic boolean jmxRegistrationDebug()
jmxRegistrationDebug in interface ManagedObjectManagerInternalpublic void stripPrefix(java.lang.String... args)
ManagedObjectManagerstripPrefix in interface ManagedObjectManagerargs - Class package name to strip from type name.public <T extends EvaluatedDeclaration> org.glassfish.pfl.basic.func.UnaryPredicate<T> forAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation, java.lang.Class<T> cls)
forAnnotation in interface ManagedObjectManagerInternalpublic AMXMetadata getDefaultAMXMetadata()
getDefaultAMXMetadata in interface ManagedObjectManagerInternalpublic boolean isAMXAttributeName(java.lang.String name)
isAMXAttributeName in interface ManagedObjectManagerInternalpublic void suppressDuplicateRootReport(boolean suppressReport)
ManagedObjectManagerMust be called before a successful call to a createRoot method.
suppressDuplicateRootReport in interface ManagedObjectManagerpublic org.glassfish.pfl.tf.timer.spi.ObjectRegistrationManager getObjectRegistrationManager()
ManagedObjectManagerCan be called at any time.
getObjectRegistrationManager in interface ManagedObjectManager