4 Replies Latest reply on Oct 20, 2009 5:45 AM by emuckenhuber

    jboss-admin-rest

    cvasilak

      Hi there,

      over the last couple of weeks I have been working on a small project(in my free time) to provide RESTful access to some common management/metrics tasks for JBoss(currently tested on 5.1.0.GA). An early access build can be found on the project web site http://code.google.com/p/jboss-admin-rest/ just copy "jboss-admin-rest-1.0-SNAPSHOT.war" to your jboss deploy directory and off you go.

      The interface allows for remote deployment of artifacts(war, ear, etc) and components (DataSource, ConnectionFactory etc) as well as inspecting(where appropriate) some useful metrics. Full information is provided for WAR, DataSource and EAR, for other types of deployments we just display some basic info. Further, access to server logs and general server information is provided. XML representation is returned(we have partial support for JSON) for the inspection. I suggest you use firefox/ie that they have built-in support for displaying xml.

      I tried to comply with rest principles e.g. posting a new artifact results in "201 Created", undeployment results in "200 OK", artifact not found results in "404 Not Found" etc but we still need some work if we want to be fully compliant. There is doc.txt file that contains a TODO list on what we want to provide. On the project's web site you can find a list of all supported operations with their respective urls.

      The project uses JBoss RESTEasy JAX-RS implementation(of course ;) and the new Management API's introduced in JBoss 5. Information on how things work on the management api, was extracted from the jboss-as-5 jopr/embjopr plugin as well as the unit tests in http://anonsvn.jboss.org/repos/jbossas/branches/Branch_5_x/testsuite/src/main/org/jboss/test/profileservice/test/. Further we are maven based so you can easily compile/install (hopefully ;). I use jdk 1.6 as my primary jdk for development. If you want to run it jdk1.5 remove the "exclusions" from the pom file. These are the activation and jaxb api's that they already come with jdk 1.6.

      In the subversion repository(trunk) there is a folder "testapps" that contains some deployment artifacts(war, ear, datasource, ejb3) that were used for testing. You can use them to play around. Information on how can you access the svn repository is provided in http://code.google.com/p/jboss-admin-rest/source/checkout. They also provide web-based browsing of source code.

      As a final note, keep in mind that I am newcomer both in JAX-RS, JAXB and management api's so don't expect to have come up with the "best" solution. But I am willing to learn and I would be glad if I can have feedback so that I can improve this work.

      Document, explain, blog, experiment, test-drive, have fun and spread the word :-)

      Regards,
      Christos


      P.S I hope developers excuse me for using "org.jboss.admin.rest" package name. If there is any problem using it I can rename it.

        • 1. Re: jboss-admin-rest
          emuckenhuber

          Hi Christos,

          this is interesting. We are planning to provide a REST interface for ProfileService in future as well, but haven't started on that.

          In your TODO list i read that you have problems starting a stopped component. I remember that we had to do some work there as well, but i'm not sure if this fix made it into 5.1.0.GA. It is fixed in the 5_x branch and in the upcoming 5.2.0.Beta1 release though - this might be related.

          Briefly looking into your application i noticed that you have a implementation for some of our known Components. I think a more generic mapping between ManagedObjects/Components with their ManagedProperties to xml would be good.
          This would be needed to allow multiple management clients to reuse the same REST api without further interpretation of the exposed information. In general this mapping should be quite easy and you would be able to handle everything ProfileService exposes.

          Of course depending on your needs you might want to provide some specific implementations for certain ComponentTypes to simplify the usage.

          If you are interested in that you can look at some similar code i wrote creating a xml representation of the MetaValues:

          http://anonsvn.jboss.org/repos/jbossas/branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/xml/ for the MetaValue JAXB model.

          and http://anonsvn.jboss.org/repos/jbossas/branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AbstractValuePersistence.java
          as well as http://anonsvn.jboss.org/repos/jbossas/branches/Branch_5_x/system/src/main/org/jboss/system/server/profileservice/persistence/AbstractValueRecreation.java for the transformation.

          This was written for a different purpose so a few more properties about Components would be definitely needed. Still it should give you a starting point in case you want to look at that.

          Thanks,
          Emanuel

          • 2. Re: jboss-admin-rest
            emuckenhuber

             

            "cvasilak" wrote:

            P.S I hope developers excuse me for using "org.jboss.admin.rest" package name. If there is any problem using it I can rename it.


            I'm not sure about this - in general i would say that usage of "org.jboss.*" should be avoided. I'll see if i can find out more about that.

            • 3. Re: jboss-admin-rest
              cvasilak

              Hi Emanuel,
              thanks a lot for your response!

              I agree a more generic approach is needed, allow me some time to have a look at the API's you posted (very interesting) and get back to you soon.

              Regards,
              Christos

              • 4. Re: jboss-admin-rest
                emuckenhuber

                 

                "cvasilak" wrote:

                I agree a more generic approach is needed, allow me some time to have a look at the API's you posted (very interesting) and get back to you soon.


                Sure, no problem - take your time. In case you have questions feel free to ask and i'll see if i can help.

                In general what i posted is not a public API and not intended to be one. It's something we internally use to map a ManagedObject values to xml - but i think it could help you creating a generic mapping for your REST interface.

                There are a couple of improvements we plan for AS6, but in case you think something could done differently feel free to suggest changes as well.