org.apache.commons.modeler

Class JndiJmx

Implemented Interfaces:
MBeanRegistration, ModelMBean, NotificationListener

public class JndiJmx
extends BaseModelMBean
implements NotificationListener

Link between JNDI and JMX. JNDI can be used for persistence ( it is an API for storing hierarchical data and a perfect fit for that ), as well as an alternate view of the MBean registry. If this component is enabled, all MBeans will be registered in JNDI, and all attributes that are set via JMX can be stored in a DirContext. This acts as a "recorder" for creation of mbeans and attribute changes done via JMX. XXX How can we control ( filter ) which mbeans will be registere ? Or attributes ? XXX How can we get the beans and attributes loaded before jndijmx ? The intended use: - do whatever you want to start the application - load JndiJmx as an mbean - make changes via JMX. All changes are recorded - you can use JndiJmx to save the changes in a Jndi context. - you can use JndiJmx to load changes from a JndiContext and replay them. The main benefit is that only changed attributes are saved, and the Jndi layer can preserve most of the original structure of the config file. The alternative is to override the config files with config info extracted from the live objects - but it's very hard to save only what was actually changed and preserve structure and comments.
Author:
Costin Manolache

Field Summary

(package private) Hashtable
attributes
protected Context
componentContext
protected Context
configContext
protected Context
descriptorContext
(package private) Hashtable
instances
private static Log
log
(package private) MBeanServer
mserver

Fields inherited from class org.apache.commons.modeler.BaseModelMBean

NO_ARGS_PARAM, NO_ARGS_PARAM_SIG, attributeBroadcaster, attributes, generalBroadcaster, getAttMap, info, invokeAttMap, log, oname, registry, resource, resourceType, setAttMap, source

Constructor Summary

JndiJmx()
Protected constructor to require use of the factory create method.

Method Summary

String
dumpStatus()
void
handleNotification(Notification notification, Object handback)
void
init()
void
replay()
void
setComponentContext(Context ctx)
If a JNDI context is set, all components will be registered in the context.
void
setConfigContext(Context ctx)
JNDI context where attributes will be stored for persistence
void
setDescriptorContext(Context ctx)
JNDI context for component descriptors ( metadata ).

Methods inherited from class org.apache.commons.modeler.BaseModelMBean

addAttributeChangeNotificationListener, addNotificationListener, createDefaultModelMBeanInfo, createResource, getAttribute, getAttributeClass, getAttributes, getClassName, getMBeanInfo, getManagedResource, getModelerType, getNotificationInfo, getObjectName, getRegistry, initModelInfo, invoke, isModelMBeanInfoValid, load, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, removeAttributeChangeNotificationListener, removeNotificationListener, removeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, sendNotification, setAttribute, setAttributes, setManagedResource, setModelMBeanInfo, setModeledType, setRegistry, store, toString

Field Details

attributes

(package private)  Hashtable attributes

componentContext

protected Context componentContext

configContext

protected Context configContext

descriptorContext

protected Context descriptorContext

instances

(package private)  Hashtable instances

log

private static Log log

mserver

(package private)  MBeanServer mserver

Constructor Details

JndiJmx

public JndiJmx()
            throws MBeanException
Protected constructor to require use of the factory create method.

Method Details

dumpStatus

public String dumpStatus()
            throws Exception

handleNotification

public void handleNotification(Notification notification,
                               Object handback)

init

public void init()
            throws Exception

replay

public void replay()
            throws Exception

setComponentContext

public void setComponentContext(Context ctx)
If a JNDI context is set, all components will be registered in the context.
Parameters:
ctx -

setConfigContext

public void setConfigContext(Context ctx)
JNDI context where attributes will be stored for persistence

setDescriptorContext

public void setDescriptorContext(Context ctx)
JNDI context for component descriptors ( metadata ).
Parameters:
ctx -

Copyright (c) 2001-2003 - Apache Software Foundation