3 Replies Latest reply on May 14, 2013 12:42 PM by ssilvert

    Automatic domain configuration - a design question

    simplex-software

      Greetings,

       

      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:

       

      1. 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.
      2. 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.
      3. Using Java code.
      4. 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

        • 1. Re: Automatic domain configuration - a design question
          ssilvert

          I won't get into how you should design your particular system, but there are some tools and techniques you may not have considered.

           

          First, you can use the latest WildFly CLI and run it against AS 7.1.3.  Most people don't realize this, but it works well because the underlying DMR protocol is the same.  See Using the CLI remote client jar.  If you get the latest CLI jar then you can use the latest CLI scripting constructs.

           

          In fact, the way I work each day is to have CLI GUI always running from a stand-alone jar.  Without restarting CLI GUI, I can start and stop different versions of AS/WildFly and it just talks to whatever AS instance is running on my machine.  You can do this with plain CLI as well.

           

          If CLI scripts are not powerful enough then you can combine the CLI jar with java or your favorite JVM scripting language.  See Advanced CLI scripting with Groovy, Rhino, Jython, etc.

           

          Hope that helps,

           

          Stan

          • 2. Re: Automatic domain configuration - a design question
            simplex-software

            Unfortunatelly, using another CLI release than the one which comes out-of-the-box with the server is not an option. And using any scripting languages won't be neither better nore easier than using Java. So we're using Java with the JBoss Native Management API and the question is again:  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 ?

            • 3. Re: Automatic domain configuration - a design question
              ssilvert

              nicolas duminil wrote:

               

              Unfortunatelly, using another CLI release than the one which comes out-of-the-box with the server is not an option. And using any scripting languages won't be neither better nore easier than using Java. So we're using Java with the JBoss Native Management API and the question is again:  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 ?

              No.  You would need to write that yourself.  There is code in CLI that takes CLI syntax and converts it to DMR.  There is code in the Logging Subsystem that takes XML and converts that to DMR.  But nobody has yet written code that turns DMR into CLI syntax. 

               

              And as far as I know, nobody has written code that turns an XML config file like standalone.xml directly into CLI.  I've heard others who wanted to do this and it would be really cool but I don't think anyone has done it yet.

               

              Stan