2 Replies Latest reply on Jan 30, 2006 2:54 PM by katador

    deploying actions on process definitions

    katador

      Hello,

      I'm deploying a process definition with this code:
      import java.util.List;

      import org.jbpm.db.GraphSession;
      import org.jbpm.db.JbpmSession;
      import org.jbpm.db.JbpmSessionFactory;
      import org.jbpm.graph.def.ProcessDefinition;
      import org.jbpm.graph.exe.ProcessInstance;
      import org.jbpm.graph.exe.Token;

      public class despliegue {
      static JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.buildJbpmSessionFactory();

      /** Creates a new instance of despliegue */
      public despliegue() {
      }
      public static void main(String args[]){
      ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
      " <process-definition"+
      " name='flujo_fac_elec'>"+
      " <start-state name='est_inicio' >"+
      " "+
      " </start-state>"+
      " "+
      " "+
      " "+
      " "+
      " "+
      " "+
      " "+
      " "+
      " "+
      " "+
      " "+
      " "+
      " <end-state name='fin'></end-state>"+
      " </process-definition>"
      );

      // Let's open a new persistence session
      JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();
      // ... and begin a transaction on the persistence session
      jbpmSession.beginTransaction();

      // Save the process definition in the database
      jbpmSession
      .getGraphSession()
      .saveProcessDefinition(processDefinition);

      // Commit the transaction
      jbpmSession.commitTransaction();
      // And close the jbpmSession.
      jbpmSession.close();

      but what's up with actions??? because, doesn't it's deployed on database?... how save actions deployer process on eclipse...? insert actions on database? classpath? if i use this code i must put class files on classpath??

      thanks for any help or idea,

      Ktdr

        • 1. Re: deploying actions on process definitions
          fmuhlenberg

          To deploy your process definitions, you can write your own deployer:

           BufferedReader rdr = new BufferedReader(new FileReader( fname ) );
           JpdlXmlReader jxr = new JpdlXmlReader( rdr );
           ProcessDefinition pd = jxr.readProcessDefinition();
          

          and save as you already did.

          Or you could use the Ant task that others have referenced (in the websale example I think) for deploying your process definitions.

          As for the action classes, if you want to use them, they need to be available through your classpath (like any other Java class).


          • 2. Re: deploying actions on process definitions
            katador

            Hi!

            Thanks for answer. That fname it's the processdefnition.xml file?

            thanks!

            Ktdr.