12 Replies Latest reply on Oct 29, 2009 7:56 AM by Joram Barrez

    Using JBPM for document workflow in a Java/Flex CMS software

    Sebastien Deleuze Newbie


      I plan to use JBPM in Igenko, an open source CMS software based on Jackrabbit (JSR 170), Spring 2.5, Flex and Graniteds (Open source solution for communication between the Java core and the Flex front end).

      JBPM will be mainly used to manage document (page, content ...) workflows. I have seen that JBPM can store JCR nodes to achieve this goal.

      I just begin to work with Jackrabbit and JCR so excuse me if my question is stupid ;-)

      After reading JBPM documentation (http://docs.jboss.com/jbpm/v3/userguide/docmgmt.html), I found that it was possible to store a reference to a JCR node as a variable instance. A typical use case for me will be to find documents associated to a task (validation for example).

      Another use case will be to know the state for each document in my JCR. For good performance, I should store the document state in JCR, as an attribute of my node, but having 2 document states stored (JBPM and JCR) is a bad idea I think.

      How is the best way to manage and to store the document state in my case in a performant and robust way ?

      Thanks in advance for your answer,
      Sébastien Deleuze

        • 1. Re: Using JBPM for document workflow in a Java/Flex CMS soft
          Jim Rigsbee Newbie

          I would need to know more details of your use case to answer best. But I'll give you some general ideas and let you go from there.

          If the state of the document is part of your workflow, store it in a process variable as part of the context of the current state of your workflow. In this way you only have the state in one place.

          If you need to access the repo via processes other than jBPM workflows, and need to know the current status of that document, then store the state there. When you get the current workflow step, it should be a quick matter to get the node from the repository service in JBPM and make the appropriate call (don't remember off hand) to get the attribute in the content repository that corresponds to the status of the document.

          Please post what you decide and why so that others can benefit from your experience.

          Jim Rigsbee
          Red Hat Inc.

          • 2. Re: Using JBPM for document workflow in a Java/Flex CMS soft
            mayank sahai Newbie

            i too want to do the same thing. my requirement is that
            1) a user logs in and uploads few documents , i create a process instance and saves the documents in jcr repository.
            2) over the lifecycle of process old documents will be refered and new will be added with different set of properties.
            3) Main concern is able to track all documents associated with a process,throughout the life cycle of process....

            my design philosphy is :

            1) i can have a jackrabbit remote or local repository , for each customer i will create a folder(jcr node) ,unique to his name or having a unique key.
            2) over the lifecycle of process all docs will be added beneath this unique key folder,for a process.
            3) i can store this node as process variable within jbpm so that if any document is required for a process, i have a direct reference to it in jbpm.

            Please suggest if any there is scope for improvement or suggestions...

            Technical challenge is ::

            1) what is good way to integrate JCR into jbpm

            a) i though of writing my own service interface that will interact with JCR remote repository and inject them into application through spring and perform document
            management completely outside JBPM scope.
            b) OR i should use JBPM Context service support to integrate Jackrabbit repository.
            problem is that i have not seen any example over the net , on how it can be done.
            no information is available on integrating remoteJCR repository into jbpm

            my question is that can i write my own service classes , offering a way into JCR repositoryand can inject them into jbpm context as JCR service.

            Can someone please suggest me how this can be done ?

            • 3. Re: Using JBPM for document workflow in a Java/Flex CMS soft
              Ronald van Kuijk Master

              Why not look at something like Alfresco? It uses jBPM, JCR, Spring etc...

              • 4. Re: Using JBPM for document workflow in a Java/Flex CMS soft
                noicangi Novice

                i'm investigating something like this, my idea is to integrate my jpdl model (jbpm4, jb5, mysql, eclipse galileo) with some flex web pages.

                If Anyone is trying this or has ideas it would be helpfull.

                thanks in advance,


                • 5. Re: Using JBPM for document workflow in a Java/Flex CMS soft
                  Sebastien Deleuze Newbie

                  Even if the project is currently changing (no more Flex for Front layer), we could find some related topics on Igenko http://code.google.com/p/igenko/.

                  I think a nice way to integrate JCR and JBPM is to use ORM framwork like JCROM for JCR side. I don't know deeply JBPM4 so it may bring new solutions that were not available last year with JBPM3 ...

                  • 6. Re: Using JBPM for document workflow in a Java/Flex CMS soft
                    mayank sahai Newbie

                    @kukeltje i am not using alfresco because in view of my problem--- business process if completely different from Document workflow. in my case documents can or can not be part of workflow , i think alfresco supports documents workflow , process flow sits on top of jcr.
                    @noicangi , i think we both are working on the same problem set. i am using struts2,spring,mysql and jbpm3.3GA and tryint to integrate Jackrabbit with it.

                    my motivation comes down from the fact that document management solution is tested wih jackrabbit.
                    @noicangi i am planning to configure service within jbpm context , for example jcr service
                    and if i am able to get an handle and do all this then perform repository operation then there could be a way forward.
                    Other option is to use spring module , that is what i have done , but in this case keping a link between process flow and jcr node will come down to a manual db table mapping.

                    if anyone can suggest something else ..please do the needful

                    • 7. Re: Using JBPM for document workflow in a Java/Flex CMS soft
                      Ronald van Kuijk Master

                      I'm well aware that Document workflow is a specific case of workflow, but Alfresco has some nice api's and other functionality on top of jcr that could be called from jBPM.

                      Mappings like you describe will most likely always be needed unless you want jcr to be tightly integrated which I would not do. Most is not different then from having a normal external (to jBPM) datamodel

                      • 8. Re: Using JBPM for document workflow in a Java/Flex CMS soft
                        mayank sahai Newbie

                        i have done few things till now and will need bit help from kukeltje :)

                        i have integrated jcrTemplate using spring and now i am able to play with repository,able to add node and all.
                        according to jbpm document i can add jcrnode as process variable.
                        now issue will come up once i try to retrieve store jcrNode from process variable ---

                        getObject() method is jcrNodeInstance.class says that jbpm will try to get configured services in its context and will try to find a jcrService and once service instance is found then few matching things will be performed and object can be retrieved.

                        Main problem left down is configuring a JCR Service is JBPMContext :

                        1) i tried extending jbpmContext and tried to add my service (Extending JcrService)

                        protected JbpmContext getContext() {
                        JbpmContext context = super.getContext();
                        return context;
                        here i do not see anyway to attach a jcrService instance.

                        2) i then went to figure out a way in jbpm.cfg.xml . i checked that JackRabbitServiceFactory requires a configuration ----i think it is repository.xml and directory---may be home dir to create a service.

                        i am unable to configure service in jbpm.cfg.xml.
                        i added the service like this :::




                        i get :: unable to Parse jbpm.cfg.xml

                        Code of service factory says ::
                        protected synchronized Repository getRepository() {
                        if (repository==null) {
                        try {
                        InputStream stream = ClassLoaderUtil.getStream(configuration);
                        RepositoryConfig config = RepositoryConfig.create(stream, directory);
                        repository = RepositoryImpl.create(config);
                        } catch (Exception e) {
                        // NOTE that Error's are not caught because that might halt the JVM and mask the original Error.
                        throw new JbpmException("couldn't create new jackrabbit repository with configResource '"+configuration+"' and directory '"+directory+"'", e);
                        return repository;

                        can someone help on this .....

                        • 9. Re: Using JBPM for document workflow in a Java/Flex CMS soft
                          mayank sahai Newbie

                          jbpm cfg is not correctly show in previous post:

                          service name="jcr"
                          bean class="org.jbpm.jcr.jackrabbit.JackrabbitJcrServiceFactory"
                          field name="configuration" classpath:repository.xml
                          field name="directory" /home/mayank/jackrabbit

                          • 11. Re: Using JBPM for document workflow in a Java/Flex CMS soft
                            noicangi Novice

                            hi everyone, finally i decided myself to use jbpm3.2.6SP1 with mysql 5 and eclipse galileo + JBoss tools 3.1 m3.

                            My question is i don't know how to integrate jbpm to a flex aplication, i understand i need to "send" a signal from a task or state node to flex...and then "receive" the complete signal to continue though my process diagram definition.

                            how can i do that? i think i need to modify the simple process.java file....i'm correct? or i'm doing all wrong.



                            • 12. Re: Using JBPM for document workflow in a Java/Flex CMS soft
                              Joram Barrez Master

                              Since jBPM is a plain jar, you an do whatever you want... Also see my post http://www.jorambarrez.be/blog/2009/09/13/jbpm_architectural/

                              The easiest for Flex development, is wrapping jBPM into a service which translates input/output to xml... at least that was 2 years ago when I ded some Flexing ;-)