14 Replies Latest reply on Oct 17, 2005 12:58 PM by Ronald van Kuijk

    ActionHandler / jbpm.files.dir

    Carine Courbis Newbie


      Hi,

      I wanted to put my action handlers in the jbpm.files.dir directory as
      I did not want to store them in the database.
      Unfortunalety whereas I have modified the jbpm.properties file of
      the server/jbpm/deploy/jbpm.sar/jbpm-3.0.jar, the jbpm.files.dir property
      is still null at runtime.

      Where should I initiate this property? Is there a way to modify
      JbpmConfiguration?

      Thanks a lot for your help

      Carine

      PS: this post http://www.jboss.com/index.html?module=bb&op=viewtopic&t=67302
      seems relative to the problem.

        • 1. Re: ActionHandler / jbpm.files.dir
          Carine Courbis Newbie

          Hi again,

          Does anyone use the jbpm.files.dir property (except in the ant deploypar task)? I still do not know how/where to initialize it correctly for the jbpm-server (v 3.0). It is always null in the class FileDefinition. There is nothing about a bug on this property in the Jira system.

          Any information on how to initialize this property will be very appreciated.
          Thanks

          Carine

          • 2. Re: ActionHandler / jbpm.files.dir
            Koen Aers Master

            Carine,

            You should simply uncomment the appropriate line in the jbpm.properties file and point to the right folder. Are you sure you are editing the right jbpm.properties file? What happens if you tweak other properties such as jbpm.hibernate.cfg.xml for instance?

            Regards,
            Koen

            • 3. Re: ActionHandler / jbpm.files.dir
              Carine Courbis Newbie

              Hi Koen,

              You were right: I was not modifying the right jbpm.properties file.
              It should be the one in jbpm.sar, not the one in jbpm.
              Thanks a lot.

              I have now a new problem as each time a new instance is created the
              system looks for class and gpd.xml files in a different directory.
              It increments files-{i} as said in
              http://www.jboss.com/index.html?module=bb&op=viewtopic&t=67302

              with jbpm.files.dir=d:/Carine/jbpm/tmp
              16:00:04,981 INFO [STDOUT] Caused by: java.io.FileNotFoundException:
              d:\Carine\jbpm\tmp\files-6\gpd.xml (The system cannot find the file specified)
              Caused by: java.io.FileNotFoundException: d:\Carine\jbpm\tmp\files-7\classes\test\CallerImpl.class (The system cannot find the file specified)

              Any idea how to bypass this problem?
              Thanks in advance for your help

              Carine

              • 4. Re: ActionHandler / jbpm.files.dir
                Carine Courbis Newbie

                Hi again,

                The problem is the class FileDefinition (line 193)

                private boolean isStoredOnFileSystem() {
                boolean isStoredOnFileSystem = (rootDir != null);
                // if files should be stored on the file system and no directory has been
                // created yet...
                if ((isStoredOnFileSystem) && (dir == null)) {
                // create a new directory
                dir = findNewDirName();
                new File(rootDir + "/" + dir).mkdirs();
                }
                return isStoredOnFileSystem;
                }

                dir is always null, so the system creates a new directory (files-{i}).

                Carine

                • 5. Re: ActionHandler / jbpm.files.dir
                  Alejandro Guizar Master

                  Please open a JIRA issue for this. I'm already investigating the cause of the problem.

                  • 7. Re: ActionHandler / jbpm.files.dir
                    Tom Baeyens Master

                    do you need the file system ?

                    originally it was introduced because some dbs (oracle) couldn't handle binary data in a standard way. now we have found a solution for that. so binary data storage should now be portable for all db's.

                    i was thinking of making the file system storage deprecated.

                    regards, tom.

                    • 8. Re: ActionHandler / jbpm.files.dir
                      Alejandro Guizar Master

                      So, Carine, do you really need file system storage, or would you prefer the issue described in topic http://www.jboss.com/index.html?module=bb&op=viewtopic&t=67302 resolved?

                      • 9. Re: ActionHandler / jbpm.files.dir
                        Carine Courbis Newbie

                        Hi

                        Sorry for the delay.

                        I would like to have the file system as I add actions dynamically
                        after deployment. Maybe this is incompatible with the "philosophy"
                        of a business process management tool where everything is versionned.
                        I think that if the actions (such as monitoring or the display of data)
                        have no influence upon the workflow, they can be added (vs. removed) at
                        runtime and thus stored on the file system instead of in the db.

                        If you remove the file system storage, that means that the actions of
                        runtimeAction are fixed at the deployment of the process definition.
                        Do you plan to add them via the admin page of the Web Application ?

                        I think that your classloader should look for the classes first in the
                        db than in the filesystem. In most of the time, the classes will be in
                        the db (better performance, I think).

                        I am not an expert in classloaders but maybe it will be useful to have
                        another class between java.lang.ClassLoader and
                        org.jbpm.instantiation.ProcessClassLoader to be able to share objects
                        (such as actions) between processes.

                        Regards

                        Carine

                        • 10. Re: ActionHandler / jbpm.files.dir
                          Alejandro Guizar Master

                          I find this use case interesting. The support for runtime actions should be accompanied with the ability to add new action handlers at runtime. Nonetheless, relying on the file system storage for this purpose is abusing it.

                          As you point out, the solution is a class loader above the ProcessClassLoader. There is no need to write a new one, tough. You can use the class loaders already present in the Java VM and the application server.

                          For JBoss AS, you can package your classes in a JAR and drop them in the JBOSS_HOME/server/JBOSS_CONFIG/deploy directory. JBoss will load them.

                          • 11. Re: ActionHandler / jbpm.files.dir
                            Ronald van Kuijk Master

                            sharing actions between processes can be done by putting them on the default classpath.

                            I myself are thinking of a default actionhandler which takes a jndi name and some other parameters to call a shared ejb as an action

                            • 12. Re: ActionHandler / jbpm.files.dir
                              Alejandro Guizar Master

                              Carine, you might want to check this topic: RuntimeAction? What is it for?
                              It discusses requirements similar to yours.

                              • 13. Re: ActionHandler / jbpm.files.dir
                                Carine Courbis Newbie

                                Thanks Alex for the link. I had already read it with interest.
                                Maybe it would be possible to create the new event to add to node1 (from your code, 2nd post).

                                ProcessInstance processInstance = ...;
                                ProcessDefinition processDefinition = processInstance.getProcessDefinition();
                                Node node1 = processDefinition.getNode("node1");
                                Event event = node1.addEvent(new Event(Event.EVENTTYPE_NODE_ENTER));
                                Action action = processDefinition.getAction("gotocheetahs");
                                processInstance.addRuntimeAction(new RuntimeAction(event, action));

                                I have not tried to execute a runtimeAction since a while (version 3.0 beta I think).
                                I guess the bug on it was fixed (the action handler was executed more than one time).
                                __________________

                                Ronald, I still do not see how you can share action instances between processes.
                                Could you, please, elaborate more on this topic if you have time?

                                It seems to me that an action handler instance is created each time it is needed. The
                                only way to "store" data in an action handler is to have a static variable. In this way,
                                the data can be used for another call either in the same process instance (if the
                                action is referenced in the PD) or another one. Is that right?

                                Thanks in advance, Carine

                                • 14. Re: ActionHandler / jbpm.files.dir
                                  Ronald van Kuijk Master

                                  make an actionhandler that looksup an ejb. That ejb can have all kinds of data sharable by processes