Class MbeansSource
- java.lang.Object
-
- org.apache.commons.modeler.modules.ModelerSource
-
- org.apache.commons.modeler.modules.MbeansSource
-
- All Implemented Interfaces:
MbeansSourceMBean
public class MbeansSource extends ModelerSource implements MbeansSourceMBean
This will create mbeans based on a config file. The format is an extended version of MLET. Classloading. We don't support any explicit classloader tag. A ClassLoader is just an mbean ( it can be the standard MLetMBean or a custom one ). XXX add a special attribute to reference the loader mbean, XXX figure out how to deal with private loaders
-
-
Field Summary
-
Fields inherited from class org.apache.commons.modeler.modules.ModelerSource
location, source
-
-
Constructor Summary
Constructors Constructor Description MbeansSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()voidexecute()StringgetLocation()ListgetMBeans()Return the list of mbeans created by this source.ObjectgetSource()voidinit()Call the init method on all mbeans.voidload()Load the mbeans from the source.ListloadDescriptors(Registry registry, String location, String type, Object source)Load data, returns a list of items.voidsave()Store the mbeans.voidsetLocation(String loc)voidsetRegistry(Registry reg)voidsetSource(Object source)Set the source to be used to load the mbeansvoidsetType(String type)Used if a single component is loadedvoidstart()voidstop()voidupdateField(ObjectName oname, String name, Object value)Callback from the BaseMBean to notify that an attribute has changed.-
Methods inherited from class org.apache.commons.modeler.modules.ModelerSource
getInputStream, store
-
-
-
-
Method Detail
-
setRegistry
public void setRegistry(Registry reg)
-
setLocation
public void setLocation(String loc)
-
setType
public void setType(String type)
Used if a single component is loaded- Parameters:
type-
-
setSource
public void setSource(Object source)
Description copied from interface:MbeansSourceMBeanSet the source to be used to load the mbeans- Specified by:
setSourcein interfaceMbeansSourceMBean- Parameters:
source- File or URL
-
getSource
public Object getSource()
- Specified by:
getSourcein interfaceMbeansSourceMBean
-
getLocation
public String getLocation()
-
getMBeans
public List getMBeans()
Return the list of mbeans created by this source. It can be used to implement runtime services.- Specified by:
getMBeansin interfaceMbeansSourceMBean- Returns:
- List of ObjectName
-
loadDescriptors
public List loadDescriptors(Registry registry, String location, String type, Object source) throws Exception
Description copied from class:ModelerSourceLoad data, returns a list of items.- Overrides:
loadDescriptorsin classModelerSourcesource- Introspected object or some other source- Throws:
Exception
-
init
public void init() throws ExceptionDescription copied from interface:MbeansSourceMBeanCall the init method on all mbeans. Will call load if not done already- Specified by:
initin interfaceMbeansSourceMBean- Throws:
Exception
-
load
public void load() throws ExceptionDescription copied from interface:MbeansSourceMBeanLoad the mbeans from the source. Called automatically on init()- Specified by:
loadin interfaceMbeansSourceMBean- Throws:
Exception
-
updateField
public void updateField(ObjectName oname, String name, Object value)
Description copied from class:ModelerSourceCallback from the BaseMBean to notify that an attribute has changed. Can be used to implement persistence.- Overrides:
updateFieldin classModelerSource
-
save
public void save()
Store the mbeans. XXX add a background thread to store it periodically- Specified by:
savein interfaceMbeansSourceMBean
-
-