1 Reply Latest reply on Aug 15, 2011 7:51 AM by Chris Melas

    ProcessMgmtFacade.java - Custom REST Call

    Tobias Wittur Newbie

      Hi,

       

      I am trying to do a REST call that basically triggers a message based process start. Therefore, I want to implement my own REST API.

       

      I came across this post:

       

      http://community.jboss.org/message/612597#612597

       

      Here, the recommendation is to go to

       

      jbpm\jboss-5.1.0.GA\server\default\deploy\jbpm-gwt-console-server\WEB-INF\classes\org\jboss\bpm\console\server

       

      and edit the ProcessMgmtFacade.java file.

       

      First, is this not bad practice, since any update would overwrite my changes? I thought I would rather write my own file and leave the old file untouched?! How would you solve this issue?

       

      Therefore I would like to know:

       

      Hhow can I for example route http://localhost:8080/gwt-console-server/rs/process/definitions to my own java file?

       

      Where is it defined, that http://localhost:8080/gwt-console-server/rs/process/definitions points to ProcessMgmtFacade.java ?

       

      Just for trial, I tried to import it as a project into eclipse. However, I noticed it is not a java project. Is there a versoin with .project availalbe?

       

      I would be grateful for hints.

       

      Best regards and thank you for help in advance,

       

      Tobias

        • 1. Re: ProcessMgmtFacade.java - Custom REST Call
          Chris Melas Apprentice

          Hello,

          In order to add your own REST API all you have to do, more or less, is to add classes with jax-rs annotations specifying the urls of your services (take a look at the existing ProcessMgmtFacade as well as the modifications done  by priyakpandey to get the idea), in addition take a look in web.xml entries related to jax-rs and resteasy you might need to add something related to your additional url paths. Maybe also add your classes in

          jax-rs Application class org.jboss.bpm.console.server.ConsoleServerApplication as singleton (check the code of ConsoleServerApplication regarding the other jax-rs classes).

           

          Since you use the gwt-console-server API you'll need the objects created inside ProcessMgmtFacade so if you want to change existing functionality the simplest approach is to modify that (by adding new methods or changing existing ones as described in http://community.jboss.org/message/612597).

           

          If you want to use your own class to override functionality you could extend ProcessMgmtFacade with your own class and add all your new logic there. However in order to overide the urls you would have to define the same jax-rs paths in your file and maybe remove the same ones from ProcessMgmtFacade and probably have to modify the jax-rs Application class org.jboss.bpm.console.server.ConsoleServerApplication to add your class as singleton....haven't tried it to be honest and it gets a little messy.

           

          The fact is that on each update of jbpm, since you use the gwt-console-server, whether you make the changes in the existing code or on your own file, you will either have to make those changes or add your file each time. Not a good practice for large scale changes etc indeed but  unfortunately no other extension points, to the existing REST API system i think.