org.apache.commons.modeler.modules

Class MbeansSource

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

private Document
document
(package private) long
lastUpdate
(package private) static boolean
loaderLoaded
(package private) boolean
loading
private static Log
log
(package private) List
mbeans
private HashMap
object2Node
(package private) Registry
registry
(package private) String
type
(package private) long
updateInterval

Fields inherited from class org.apache.commons.modeler.modules.ModelerSource

location, source

Method Summary

void
destroy()
void
execute()
String
getLocation()
List
getMBeans()
Return the list of mbeans created by this source.
Object
getSource()
void
init()
void
load()
List
loadDescriptors(Registry registry, String location, String type, Object source)
Load data, returns a list of items.
private void
processArg(Node mbeanN)
private void
processAttribute(MBeanServer server, Node descN, String objectName)
void
save()
Store the mbeans.
void
setLocation(String loc)
void
setRegistry(Registry reg)
void
setSource(Object source)
void
setType(String type)
Used if a single component is loaded
void
start()
void
stop()
void
updateField(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, loadDescriptors, store, updateField

Field Details

document

private Document document

lastUpdate

(package private)  long lastUpdate

loaderLoaded

(package private) static boolean loaderLoaded

loading

(package private)  boolean loading

log

private static Log log

mbeans

(package private)  List mbeans

object2Node

private HashMap object2Node

registry

(package private)  Registry registry

type

(package private)  String type

updateInterval

(package private)  long updateInterval

Method Details

destroy

public void destroy()
            throws Exception

execute

public void execute()
            throws Exception

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:
getMBeans in interface MbeansSourceMBean

getSource

public Object getSource()
Specified by:
getSource in interface MbeansSourceMBean

init

public void init()
            throws Exception
Specified by:
init in interface MbeansSourceMBean

load

public void load()
            throws Exception
Specified by:
load in interface MbeansSourceMBean

loadDescriptors

public List loadDescriptors(Registry registry,
                            String location,
                            String type,
                            Object source)
            throws Exception
Load data, returns a list of items.
Overrides:
loadDescriptors in interface ModelerSource
Parameters:
registry -
location -
type -
source - Introspected object or some other source

processArg

private void processArg(Node mbeanN)

processAttribute

private void processAttribute(MBeanServer server,
                              Node descN,
                              String objectName)

save

public void save()
Store the mbeans. XXX add a background thread to store it periodically
Specified by:
save in interface MbeansSourceMBean

setLocation

public void setLocation(String loc)

setRegistry

public void setRegistry(Registry reg)

setSource

public void setSource(Object source)
Specified by:
setSource in interface MbeansSourceMBean

setType

public void setType(String type)
Used if a single component is loaded
Parameters:
type -

start

public void start()
            throws Exception

stop

public void stop()
            throws Exception

updateField

public void updateField(ObjectName oname,
                        String name,
                        Object value)
Callback from the BaseMBean to notify that an attribute has changed. Can be used to implement persistence.
Overrides:
updateField in interface ModelerSource
Parameters:
oname -
name -
value -

Copyright (c) 2001-2003 - Apache Software Foundation