Automatic domain configuration - a design question
simplex-software May 14, 2013 7:44 AMGreetings,
We have a production system running JBoss 7.1.3.Final. Our domain structure being quite complex, we would like to get automatic the process of creation this domain out of a vanilla JBoss install. In doing this we considered the following alternatives:
- Using CLI scripts. The problem is that, CLI not being a real programming language, it completely lacks, at least in this release, facilities like if-then-else or try-catch structures. Consequently, we cannot seriously consider it for writing robust scripts.
- Using shell scripts with CLI commands in it. It seems quite acrobatic as one have to launch a CLI command, to retrieve its output in a file, to process the file, etc.
- Using Java code.
- Simply copying XML files that we carrefully tag in a SCM.
Finally, we opted foe using Java code as it seemed the most solid. After that, we started to question ourself what should be the input for our domain configuration engine. Since we were in an "agile", interactive approach, we started with the system properties configuration and it was easy to load our .properties files and to generate CLI commands to create them. Next, we tried to do the same with the logging configuration. This was much more complicated as we noticed we couldn't describe the logging configuration in anything else than XML grammars satisfying the schema urn:jboss:domain:1.3;
So we decided to use XML files in input, to compile them with JAXB compiler, to unmarshall them into a Java domain and now trying to use this domain generated by JAXB to generate CLI commands. But the JAXB generated Java domain seems quite complex especially because, for the logging susbsystem for example, it has several type of loggers, several types of handlers, each one having quite specific parameters and there is no an obvious possibility to generalize anuthing there, we need to treat that case by case. hence a code like "if my root element is a file handler do this, else if my root element is root logger do that, etc". very ugly ! And we are only at the logging subsystem and there are still several dozens of subsystems we need to configure.
So, all this story to ask what would be the most appropriated design here ? How could we implement a domain configuration engine to process here input XML files and to generate, in a different part of the world, exactly the same XML configuration files, given that we prefer to not to have to deal with XML fragments copies. The JBoss Native Management API, beside the fact that it's poorly or not at all documented, is so detyped that it doesn't seem to help much. For example, is there a way that, given an Logger class obtained by unmarshalling the XML logging description, to use directly such that to construct the required CLI command for creating it ?
Many thanks in advance,
Nicolas DUMINIL