We had to do a lot of direct XML config file updating in the as4 plugin,
because it didn't provide a JMX API to update most of its configs. One
of our goals was to preserve comments and whitespace in the files to
minimize diffs and not lose valuable comments. We ended up using jdom to
do the updating, since it made it fairly easy to preserve comments and
whitespace. Classes you can look at (all under
modules/plugins/jboss-as/src/main/java/org/rhq/plugins/jbossas/util/):
AbstractMessagingConfigurationEditor
DatasourceConfigurationEditor
ConnectionFactoryConfigurationEditor
etc..
-Ian
On 08/25/2011 11:23 AM, Stefan Negrea wrote:
Hello Everybody,
mod_cluster does not have support for persisting configuration changes in JBoss 4.2 and
5.1. The only solution is to explicitly update config files. I searched the code base for
previous work on updating files but I did not find something that fits my use case. So, I
will need a little bit of help (code review and questions).
JBoss EAP 5.1.x - Code Review
There is almost nothing exposed through JMX; everything is in the mod_cluster config file
(${JBoss512}/jboss-as/server/all/deploy/mod_cluster.sar/META-INF/mod_cluster-jboss-beans.xml).
I wrote a simple utility to update this file.
Because the file is only used by the mod_cluster module, I assumed that there is no other
RHQ plugin that would attempt to update it simultaneously. Is this a good assumption?
I would appreciate a code review for the following two classes:
ModClusterBeanFile:
http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=blob;f=modules/plugins/m...
AbstractConfigurationFile:
http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=blob;f=modules/plugins/m...
JBoss 4.2.x - Design Question
The mod_cluster interface is completely different and allows settings to be updated over
JMX. The problem is that after a server restart everything is reverted to default. The
only way to persist configuration changes is to update the Listener tag in server.xml
(${JBoss42}/server/all/deploy/jboss-web.deployer/server.xml). The mod_cluster bean
configuration file is not available in this case (the module is deployed as a packaged jar
and the interface is completely different).
I searched the code base but I could not find any other JBoss plugin that updates/reads
this file. I want to follow the same pattern as JBoss 5.1.x but I have a couple of
questions. Is the assumption that this file is not updated by any other plugin a good
assumption? And, is there code that I could reuse for this purpose (just want to make sure
I did not miss anything with my search)?
If I am to write the code from scratch, it would be even simpler than ModClusterBeanFile
(there is only one tag with various attributes to update) and would be based on the
AbstractConfigurationFile.
Here is the package I created to updating config files:
http://git.fedorahosted.org/git/?p=rhq/rhq.git;a=tree;f=modules/plugins/m...
I attached sample config files for each server:
mod_cluster-jboss-beans.xml - JBoss 5.1
server.xml - JBoss 4.2
Thank you,
Stefan Negrea
Software Engineer
_______________________________________________
rhq-devel mailing list
rhq-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/rhq-devel
--
Ian Springer
Principal Software Developer
JBoss Operations Network
Red Hat
ian.springer(a)redhat.com