5 Replies Latest reply on Dec 9, 2005 10:59 PM by davidsan1001

    How do you save action class on dynamically created process?

    davidsan1001

      I know that must sound cryptic so here is my code.

      processdefinition.xml

      <process-definition
       xmlns="http://jbpm.org/3/jpdl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
       name="Task_Creates_Process">
       <start-state name="Create Process">
       <task>
       <controller>
       <variable name="random_name" mapped-name="Just click Save and Close" />
       </controller>
       </task>
      
       <transition name="tr1" to="end1">
       <action name="CreateProcessActionHandler" class="com.regutrack.rohsbud.action.CreateProcessActionHandler"></action>
       </transition>
       </start-state>
       <end-state name="end1"></end-state>
      </process-definition>
      

      So far this is just a task that launches an action class, but here is the action class. What I'm trying to do in this action class is create another process definition that also has an action class. I save it, reload it then kick it off with processInstance.signal. What this does is kick off its own action class "MessageToLogActionHandler" The class loader cannot load this action class so it throws an error.
      package com.regutrack.rohsbud.action;
      
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      //import org.jbpm.context.def.ContextDefinition;
      //import org.jbpm.context.exe.ContextInstance;
      import org.jbpm.graph.def.ActionHandler;
      import org.jbpm.graph.def.ProcessDefinition;
      import org.jbpm.graph.exe.ExecutionContext;
      import org.jbpm.graph.exe.ProcessInstance;
      //import org.jbpm.graph.def.Action;
      //import org.jbpm.instantiation.Delegation;
      //import org.jbpm.scheduler.def.CreateTimerAction;
      //import org.jbpm.tc.ContextBuilder;
      import org.jbpm.tc.db.JbpmSessionContext;
      //import org.jbpm.db.AbstractDbTestCase;
      import org.jbpm.db.GraphSession;
      import org.jbpm.db.JbpmSessionFactory;
      import org.jbpm.db.JbpmSession;
      
      public class CreateProcessActionHandler implements ActionHandler {
      
       private static final long serialVersionUID = 1L;
      
       // protected GraphSession graphSession = null;
      
      
       public void execute(ExecutionContext executionContext) throws Exception {
      
       log.info("###############################################");
       log.info("### This is coming from CreateProcessActionHandler before its done");
       log.info("###############################################");
      
      
       ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       " <event type='process-start'>" +
       " <action class='com.regutrack.rohsbud.action.MessageToLogActionHandler' />" +
       " </event>" +
       " <start-state name='start'>" +
       " <transition to='end'/>" +
       " </start-state>" +
       " <end-state name='end'/>" +
       "</process-definition>"
       );
      
       JbpmSessionFactory jbpmSessionFactory = JbpmSessionFactory.buildJbpmSessionFactory();
       JbpmSession jbpmSession = jbpmSessionFactory.openJbpmSession();
       GraphSession graphSession = jbpmSession.getGraphSession();
      
       log.info("###############################################");
       log.info("### Just after getting graphSession before saving Process ");
       log.info("###############################################");
      
       jbpmSession.beginTransaction();
       graphSession.saveProcessDefinition(processDefinition);
       jbpmSession.commitTransaction();
      
       log.info("###############################################");
       log.info("### Do we even get here after saving Definition????? ");
       log.info("###############################################");
      
       jbpmSession.beginTransaction();
       graphSession.loadProcessDefinition(processDefinition.getId());
       jbpmSession.commitTransaction();
      
       log.info("###############################################");
       log.info("### How about after loading it back, then can we make a process Instance????? ");
       log.info("###############################################");
      
      
       ProcessInstance processInstance = processDefinition.createProcessInstance();
      
       processInstance.signal();
      
      
       }
      
       private static final Log log = LogFactory.getLog(CreateProcessActionHandler.class);
      }
      

      Here is the error
      18:01:53,719 DEBUG [LogFilter] request http://localhost:8080/jbpm/faces/task.jsp
      18:01:53,720 DEBUG [LogFilter] request parameter [taskform:_link_hidden_]=
      18:01:53,720 DEBUG [LogFilter] request parameter [taskform:taskInstanceId]=1
      18:01:53,720 DEBUG [LogFilter] request parameter [taskform_SUBMIT]=1
      18:01:53,720 DEBUG [LogFilter] request parameter [taskform:transitionButton]=Save and Close Task
      18:01:53,720 DEBUG [LogFilter] request parameter [taskform:_id2_0:_id8]=sadfsd
      18:01:53,720 DEBUG [LogFilter] session parameter [taskFormParameters]=[(Just click Save and Close,null)]
      18:01:53,720 DEBUG [LogFilter] session parameter [org.apache.myfaces.application.jsp.JspStateManagerImpl.SERIALIZED_VIEW-/task.jsp]=[Ljava.lang.Object;@1205042
      18:01:53,720 DEBUG [LogFilter] session parameter [javax.faces.request.charset]=ISO-8859-1
      18:01:53,720 DEBUG [LogFilter] session parameter [userBean]=org.jbpm.webapp.bean.UserBean@11eb50b
      18:01:53,721 DEBUG [PersistenceContext] beginning transaction
      18:01:53,734 DEBUG [TaskBean] saving the task parameters [(Just click Save and Close,sadfsd)]
      18:01:53,818 DEBUG [TaskBean] submitting [Just click Save and Close]=sadfsd
      18:01:54,135 DEBUG [JbpmSessionInterceptor] storing jbpm sessions in the context
      18:01:54,217 DEBUG [JbpmSessionInterceptor] removing jbpm sessions from the context
      18:01:54,218 DEBUG [TaskBean] Submitted button:Save and Close Task
      18:01:54,219 WARN [StatefulPersistenceContext] Narrowing proxy to class org.jbpm.graph.node.StartState - this operation breaks ==
      18:01:54,220 DEBUG [GraphElement] event 'task-end' on 'Task(Create Process)' for 'Token(/)'
      18:01:54,231 DEBUG [TaskInstance] completion of task 'Create Process' results in taking the default transition
      18:01:54,234 DEBUG [GraphElement] event 'before-signal' on 'StartState(Create Process)' for 'Token(/)'
      18:01:54,235 DEBUG [GraphElement] event 'node-leave' on 'StartState(Create Process)' for 'Token(/)'
      18:01:54,235 DEBUG [GraphElement] event 'transition' on 'Transition(tr1)' for 'Token(/)'
      18:01:54,305 DEBUG [GraphElement] executing action 'action[CreateProcessActionHandler]'
      18:01:54,335 INFO [CreateProcessActionHandler] ###############################################
      18:01:54,335 INFO [CreateProcessActionHandler] ### This is coming from CreateProcessActionHandler before its done
      18:01:54,335 INFO [CreateProcessActionHandler] ###############################################
      18:01:54,352 DEBUG [SchemaValidationHelper] activating schema validation...
      18:01:54,407 DEBUG [GraphElement] event 'process-start' on 'ProcessDefinition(196649c)' for 'Token(/)'
      18:01:54,407 DEBUG [GraphElement] executing action 'MessageToLogActionHandler'
      18:01:54,409 ERROR [Delegation] couldn't load delegation class 'com.regutrack.rohsbud.action.MessageToLogActionHandler'
      java.lang.ClassNotFoundException: class 'com.regutrack.rohsbud.action.MessageToLogActionHandler' could not be found by the process classloader
       at org.jbpm.instantiation.ProcessClassLoader.findClass(ProcessClassLoader.java:39)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at org.jbpm.instantiation.Delegation.instantiate(Delegation.java:105)
       at org.jbpm.instantiation.Delegation.getInstance(Delegation.java:90)
       at org.jbpm.graph.def.Action.execute(Action.java:94)
       at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:186)
       at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:149)
       at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:133)
       at org.jbpm.graph.exe.ProcessInstance.<init>(ProcessInstance.java:103)
       at org.jbpm.graph.def.ProcessDefinition.createProcessInstance(ProcessDefinition.java:102)
       at com.regutrack.rohsbud.action.CreateProcessActionHandler.execute(CreateProcessActionHandler.java:38)
       at org.jbpm.graph.def.Action.execute(Action.java:95)
       at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:186)
       at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:149)
       at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:133)
       at org.jbpm.graph.def.Transition.take(Transition.java:79)
       at org.jbpm.graph.def.Node.leave(Node.java:360)
       at org.jbpm.graph.node.StartState.leave(StartState.java:49)
       at org.jbpm.graph.def.Node$$FastClassByCGLIB$$d187eeda.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
       at org.jbpm.graph.def.Node$$EnhancerByCGLIB$$1951760b.leave(<generated>)
       at org.jbpm.graph.exe.Token.signal(Token.java:140)
       at org.jbpm.graph.exe.Token.signal(Token.java:94)
       at org.jbpm.graph.exe.Token$$FastClassByCGLIB$$74df1c6e.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
       at org.jbpm.graph.exe.Token$$EnhancerByCGLIB$$aa21dd9f.signal(<generated>)
       at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:459)
       at org.jbpm.taskmgmt.exe.TaskInstance.end(TaskInstance.java:376)
       at org.jbpm.taskmgmt.exe.TaskInstance$$FastClassByCGLIB$$cb2c21af.invoke(<generated>)
       at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
       at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:136)
       at org.jbpm.taskmgmt.exe.TaskInstance$$EnhancerByCGLIB$$c20aef60.end(<generated>)
       at org.jbpm.webapp.bean.TaskBean.saveAndClose(TaskBean.java:156)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
       at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
       at javax.faces.component.UICommand.broadcast(UICommand.java:106)
       at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
       at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
       at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:271)
       at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:94)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:25)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.PersistenceFilter.doFilter(PersistenceFilter.java:28)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.ContextFilter.doFilter(ContextFilter.java:19)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jbpm.webapp.filter.LogFilter.doFilter(LogFilter.java:38)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      18:01:54,413 ERROR [Delegation] couldn't instantiate delegation class 'com.regutrack.rohsbud.action.MessageToLogActionHandler'
      java.lang.NullPointerException
      

      It fair to ask why I'm even doing this. What I'm really after is a timer in which the due date and repeat values are dynamically created. Eventually the top level task will gather data on the timer due date and repeat value, pass it on the the action class which takes that information and creates a process definition, instantiates the procdef and starts it. Starting it will kick off the "nested" ActionHandler. How can I get the class loader to find that nested ActionHandler?

        • 1. Re: How do you save action class on dynamically created proc
          koen.aers

          Dave,

          Either you should 'deploy' the processdefinition by assembling the par archive (instead of merely saving it) and include the class binary for your actionhandler in the archive. Or you should make the class of your actionhandler available on the classpath of the client application that kicks off your nested process.

          Regards,
          Koen

          • 2. Re: How do you save action class on dynamically created proc
            kukeltje

            Koen.

            I tried the latter once myself (putting an actionhandler on the classpath) but it did not work. Got the same error. Also tried putting it in the war (not using jbpm.sar) but this also did not work. This was with 3.0 and I did not try to find the cause. I'll try this again tonight.

            • 3. Re: How do you save action class on dynamically created proc
              davidsan1001

              If I deploy a seperate process archive, can I pass parameters into it. In this case I would want to pass values for timer "due" and "repeat" values.

              Another idea that came to me was to use a <process-state> but I can't quite figure out how to pass values that will actually be part of the subprocess.

              My eventual goal for this would be to create an open ended workflow. Anyone assigned a task could assign a subtask "on the fly." An assignment email action would notify this person that a task has been assigned, a timer action would send emails on the due date and repeat dates so tasks don't "fall between the cracks."

              • 4. Re: How do you save action class on dynamically created proc
                davidsan1001

                To clarify further where I am going with this, below is a processdefinition that works like I want except the timer "due" and "repeat" values are hard coded.

                <?xml version="1.0" encoding="UTF-8"?>
                
                <process-definition
                 xmlns="http://jbpm.org/3/jpdl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://jbpm.org/3/jpdl http://jbpm.org/xsd/jpdl-3.0.xsd"
                 name="Call_Me">
                
                 <swimlane name="compliance manager">
                 <assignment class='com.regutrack.rohsbud.assignment.GenericAssignmentHandler' />
                 </swimlane>
                
                 <start-state name="Send Email">
                 <task swimlane="compliance manager">
                 <controller>
                 <variable name="sendee_name" mapped-name="Name of Sendee" />
                 <variable name="email_recipient" mapped-name="Sendee Email Address" />
                 <variable name="email_subject" mapped-name="Email Subject" />
                 <variable name="email_body" mapped-name="Email Body" />
                 <variable name="sender_name" mapped-name="Your Name" />
                 <variable name="sender_email_address" mapped-name="Your Email Address token changes" />
                 <variable name="sender_phone_number" mapped-name="Your Phone Number" />
                 </controller>
                 </task>
                
                 <transition name="tr1" to="Achknowledge Receiving Call">
                
                 <action name="Initial_Email" class="com.regutrack.rohsbud.action.InitialEmailActionHandler"></action>
                
                 </transition>
                 </start-state>
                
                 <task-node name="Achknowledge Receiving Call">
                 <task swimlane="compliance manager">
                 <controller>
                 <variable name="sendee_name" access="read" mapped-name="Name of Sendee" />
                 <variable name="email_subject" mapped-name="Email Subject" />
                 <variable name="ques_called_back" mapped-name="Have they called back?" />
                 </controller>
                
                 <timer name='reminder'
                 duedate='10 minutes'
                 repeat='10 minutes'
                 transition='time-out-transition' >
                 <action class='com.regutrack.rohsbud.action.ReminderEmailActionHandler' />
                 </timer>
                
                 </task>
                 <transition name="tr1" to="end1"></transition>
                 </task-node>
                
                 <end-state name="end1"></end-state>
                </process-definition>
                

                What I would like to do is add two more parameters to the "Send Mail" task asking for a "due" and "repeat" values Then the transition action class would create a new process (or perhaps subprocess) using the "due" and "repeat" values the user submitted in the definition of the process.

                • 5. Re: How do you save action class on dynamically created proc
                  davidsan1001

                  I've tried a million methods for trying to create and deploy a .Par file from within an ActionHandler. Does anyone have sample code that accomplishes this?

                  Here is my code that never quite works (you can see all the different methods I used by looked at the commented code.)

                  package com.sample.action;
                  
                  import java.io.File;
                  import java.io.FileInputStream;
                  import java.io.FileOutputStream;
                  import java.io.FileWriter;
                  import java.io.BufferedWriter;
                  import java.io.IOException;
                  import java.io.BufferedInputStream;
                  import java.io.InputStream;
                  import java.util.zip.ZipInputStream;
                  import java.util.zip.ZipOutputStream;
                  import java.util.zip.ZipEntry;
                  import com.sample.action.ZipUtilityDefinitiva;
                  
                  import org.jbpm.instantiation.ClassLoaderUtil;
                  import org.jbpm.jpdl.par.ProcessArchive;
                  import org.jbpm.jpdl.par.ProcessArchiveDeployerDbTest;
                  
                  import org.apache.commons.logging.Log;
                  import org.apache.commons.logging.LogFactory;
                  
                  
                  import org.jbpm.graph.def.ActionHandler;
                  import org.jbpm.graph.def.ProcessDefinition;
                  import org.jbpm.graph.exe.ExecutionContext;
                  import org.jbpm.jpdl.par.ProcessArchiveDeployer;
                  
                  public class CreateEmailPestActionHandler implements ActionHandler {
                  
                   static final int BUFFERSIZE = 4096;
                  
                   private static void addEntry(ZipOutputStream zipOutputStream, String entryName, String resource) throws IOException {
                   FileInputStream fi = new FileInputStream(resource);
                   InputStream inputStream = fi;
                   //InputStream inputStream = ClassLoaderUtil.getStream(resource);
                   byte[] bytes = readBytes(inputStream);
                   addEntry(zipOutputStream, entryName, bytes);
                   }
                  
                   private static void addEntry(ZipOutputStream zipOutputStream, String entryName, byte[] content) throws IOException {
                   ZipEntry zipEntry = new ZipEntry(entryName);
                   zipOutputStream.putNextEntry(zipEntry);
                   zipOutputStream.write(content);
                   }
                  
                   private static final long serialVersionUID = 1L;
                  
                  /**
                   * Logger for this class
                   */
                  private static final Log logger = LogFactory.getLog(CreateEmailPestActionHandler.class);
                  
                   //String email_pest_to;
                   //String from;
                   //String subject;
                   //String body;
                   //String timerDue;
                   //String repeatTimer;
                  
                   /**
                   * A message process variable is assigned the value of the message
                   * member. The process variable is created if it doesn't exist yet.
                   */
                  
                   //String getTestClassesDir() {
                   // return ProcessArchiveDeployerDbTest.class.getProtectionDomain().getCodeSource().getLocation().getFile();
                   //}
                  
                   static byte[] readBytes(InputStream inputStream) throws IOException {
                   byte[] bytes = null;
                   if (inputStream==null) {
                   throw new NullPointerException("inputStream is null in ProcessArchive.readBytes()");
                   }
                   byte[] buffer = new byte[BUFFERSIZE];
                   int bytesRead = 0;
                   while ( (bytesRead = inputStream.read(buffer)) != -1) {
                   if (bytes!=null) {
                   byte[] oldBytes = bytes;
                   bytes = new byte[oldBytes.length+bytesRead];
                   System.arraycopy(oldBytes, 0, bytes, 0, oldBytes.length);
                   System.arraycopy(buffer, 0, bytes, oldBytes.length, bytesRead);
                   } else {
                   bytes = new byte[bytesRead];
                   System.arraycopy(buffer, 0, bytes, 0, bytesRead);
                   }
                   }
                   return bytes;
                   }
                  
                   public void execute(ExecutionContext context) throws Exception {
                  
                   String to = context.getVariable("email_pest_to").toString();
                   String from = context.getVariable("email_pest_from").toString();
                   String subject = context.getVariable("email_pest_subject").toString();
                   String body = context.getVariable("email_pest_body").toString();
                   String time_due = context.getVariable("email_pest_due").toString();
                   String time_repeat = context.getVariable("email_pest_repeat").toString();
                   logger.debug("****updated???To: "+ to +" From: " + from +" Time Due: "+ time_due );
                  
                   try {
                   BufferedWriter out = new BufferedWriter(new FileWriter("/temp/processdefinition.xml"));
                   out.write(
                   //ProcessDefinition pd = ProcessDefinition.parseXmlString(
                   "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                   "<process-definition name=\"Email_Launcher\">\n" +
                   "<start-state name=\"Updated version from Actionclass\">\n" +
                   "<task>" +
                   "<controller>" +
                   "<variable name=\"email_pest_to\" access=\"write\" mapped-name=\"From Email Timer par\"></variable>" +
                   "</controller>" +
                   "</task>" +
                   "<transition name=\"tr1\" to=\"Task With Timer and Reminder\"></transition>\n" +
                   "</start-state>\n" +
                   "<task-node name=\"Task With Timer and Reminder\">\n" +
                   "<task name=\"Task Finished?\">\n" +
                   "<assignment class=\"com.sample.action.GenericAssignmentHandler\">\n" +
                   "</assignment>\n" +
                   "<controller>\n" +
                   "<variable name=\"finished\" mapped-name=\"differenceDid they finish task?\"></variable>\n" +
                   "</controller>\n" +
                   "<timer name=\"Email reminder\" duedate=\"30 seconds\" repeat=\"60 seconds\">\n" +
                   "<action class='com.sample.action.EmailTimerActionHandler'>\n" +
                   "<to>davidsan1@earthlink.net</to>\n" +
                   "<from>davidsan1@earthlink.net</from>\n" +
                   "<subject>Here is the subject from EmailActionHandler</subject>\n" +
                   "<body>Here is the body from EmailActionHandler</body>\n" +
                   "</action>\n" +
                   "</timer>\n" +
                   "</task>\n" +
                   "<transition name=\"tr1\" to=\"end1\"></transition>\n" +
                   "</task-node>\n" +
                   "<end-state name=\"end1\"></end-state>\n" +
                   "</process-definition>"
                   );
                  
                   //ProcessArchiveDeployer.deployProcessDefinition(pd);
                   out.close();
                   } catch (IOException e) {
                   }
                  
                   //FileInputStream fi = new FileInputStream("/usr/local/jbpm.3/src/processes.to.deploy/EmailTimerProcess.par/processdefinition.xml");
                   //BufferedInputStream bufferedInputStream = new BufferedInputStream(fi);
                   //ZipEntry entry = new ZipEntry("processdefinition.xml");
                   //ZipOutputStream zipOutputStream=null;
                  
                   //this.filesCompression("/temp/EmailTimerProcess.par","/usr/local/jbpm.3/src/processes.to.deploy/EmailTimerProcess.par");
                   //File anotherName = new File("/usr/local/jbpm.3/src/processes.to.deploy/EmailTimerProcess.par");
                  
                   //ZipUtilityDefinitiva.filesCompression(anotherName, "/temp/EmailTimerProcess.par" );
                  
                   // create a process archive file and save it to disk
                   //logger.debug("****************About to start creating .Par file***********");
                  
                   String fileName = "/usr/local/jbpm.3/build/EmailTimerClasses.par";
                   FileOutputStream fileOutputStream = new FileOutputStream(fileName);
                   ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream);
                   addEntry(zipOutputStream, "processdefinition.xml", "/temp/processdefinition.xml");
                   addEntry(zipOutputStream, "gpd.xml", "/temp/gpd.xml");
                   addEntry(zipOutputStream, "processimage.jpg", "/temp/processimage.jpg");
                   zipOutputStream.close();
                   logger.debug("*****It looks like the par file is being created okay, check it****");
                  
                  
                   //String parFileName = "/usr/local/jbpm.3/build/EmailTimerProcess.par";
                   //ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(parFileName));
                   //ZipEntry zipEntry = new ZipEntry(processdefbytearray);
                  
                  
                   ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream("/usr/local/jbpm.3/build/EmailTimerClasses.par"));
                   logger.debug("*****Zip file is being uptaken..next is deployment ****");
                   ProcessArchiveDeployer.deployZipInputStream(zipInputStream);
                  
                  
                  
                  
                  
                   }
                  }