org.apache.tomcat.util.modeler.modules.package.html Maven / Gradle / Ivy
org.apache.commons.modeler.modules
Implementation classes - should not be used directly. The API is not stable
but eventually the code will be refactored as a collection of mbeans that will be useable
( more or less ) indepedently.
The MbeanDescriptors* classes are used to extract metadata from different sources. They
are result of few stages of refactoring - now they look very similar with ant tasks and are
close to normal mbeans, with an execute() method. DOM, SER, Introspection and Dynamic mbean
will load metadata from the corresponding sources.
MbeansSource will load an extended MLET file, similar with jboss. It is not completely
implemented - only modeler mbeans and dynamic mbeans are loaded. The important characteristic
is that all declared mbeans will be registered in the mbean server as model mbeans. For
regular java classes, the description will be used to construct the model mbean. DynamicMbeans
metadata will be converted to model mbean and the model mbean wrapper will be loaded.
The goal of MbeansSource is to implement a simple persistence mechanism. Since all components
are model mbeans, we can detect all changes. The source will be loaded as DOM and modifications
will be made to the tree. The save() method will save the DOM tree - preserving all comments
and having only the changes that are needed.
There are few remaining issues. First, we need to use the persistence metadata to avoid
saving transient fields ( we save an attribute when we detect a change - but we don't know
if this attribute should be saved ). The solution is to use the persistence fields in the
spec - with some reasonable defaults or patterns for introspection or backward compat.
Another problem is implementing adding and removing components. In catalina, a
factory is used to create the components, and save will operate on all mbeans.
For creation we need to also use a factory - using the "Type" as a parameter. This
will also work very well with Ant1.6 where we can use the component factory to
do a "natural" mapping ( i.e. mbeans can be treated as tasks, with attributes as
task attributes ). The second part can be solve by either using a parameter on
the factory method ( saveTo ? ), or by having a single mbeans source per domain.