Sure I can, Ronald.
For what we need, as Tom said, we really didn't want to persist our process 
definition, or the execution of the process instances, or anything at all, so 
while I was working out the JUnit test you asked me for, and trying to figure 
out how to make my engine work, I did what you asked me for, create an inline 
String  with my processdefinition, and feed it to my process engine. Also, 
because I was working outside an AS, I look at the examples, and saw that there 
is a way to create a ProcessInstance without a JBPMContext. So I did this, and 
voila, it worked without persistance at all, so I modified my engine, and 
instead of loading process definitions from database, I load them from a memory 
repository, through an MBean. I create my repository when I deploy the jboss 
.sar that holds the definition, implementing action handlers, and web service 
facade.

We have done lots of stuff for it to work inside JBossAS.

Now it runs as we expected. Until we need real persitence for processes, will 
keep on this. Probably we will keep our previous implementation for something 
as statefull processes, we will need in the future.

This is kinda the method we use now. 

  |    public Object executeProcessInstance(String processName, Map request) 
throws Exception{
  |          // Get process definition
  |          ProcessDefinition processDefiniton = 
myMBean.findLatestProcessDefinition(processName);
  |          if (processDefiniton == null) {
  |             throw new Exception("Process definition not found");
  |          }
  |          
  |          ProcessInstance instance = new ProcessInstance(processDefiniton);
  |          instance.getContextInstance().setTransientVariable("REQUEST", 
request);
  |          
  |          // Execute process
  |          do{
  |             instance.getRootToken().signal();
  |          }while (!instance.getRootToken().hasEnded());
  |          
  |          // Check that execution is on a end state. if not, throw exception
  |          if (!EndState.class.isAssignableFrom(instance.getRootToken()
  |          .getNode().getClass())) {
  |             throw new Exception("Process finished not in an End Node");
  |          }
  |          
  |          Object response = 
instance.getContextInstance().getTransientVariable("RESPONSE");
  |          return response;
  |    }
  | 


It would be great if we could use the database to store our process 
definitions, and load the process definition from there, but as I see, for now 
it's hibernate for all or nothing. :-(

Also, we did have to keep signaling our home made action handlers. Probably we 
have done something wrong, but that belongs to other post, I think. ;-)

Thank you very much for both of you.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4024756#4024756

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4024756
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to