View Full Version : old jbpm support moved to Spring Modules along with jbpm 3.1 support.
Costin Leau
Mar 2nd, 2006, 10:49 AM
Hi.
I've moved the Jbpm code from Spring project on SourceForge to SpringModules(http://springmodules.dev.java.net).
SpringModules is the new home of jbpm integration and it contains an update of the old jbpm 3.0 integration as well as integration for the newly released jbpm 3.1
Both modules are available under projects/jbpm30 and projects/jbpm31 folders.
Changes:
- the package names have changed from springframework to springmodules as well as from jbpm to jbpm30.
- SpringHandler has been renamed to JbpmHandler
- JbpmFactoryLocator was updated so that references to beanFactories can be GCed after being released.
- LocalJbpmSessionFactory has been improved to release JbpmSessions when running inside transactions.
- ProcessDefinitionFactoryBean only reads definition - for deploying at startup use LocalJbpmSessionFactory.setProcessDefinitions().
The new jbpm31 package contains support for jbpm 3.1. jbpmSession and jbpmSessionFactory are not used anymore since they are deprecated. The JbpmTemplate has been updated and JbpmContext is passed in inside the callback.
LocalJbpmConfigurationFactoryBean allows customizing the JbpmConfiguration without affecting the static fields used internally by JbpmConfiguration.
Any feedback is welcomed.
rosenjiang
Mar 8th, 2006, 02:46 AM
Thanks for your working, expecting production version release.
Regards,roenjiang
Costin Leau
Mar 8th, 2006, 05:32 AM
Feel free to give the code a try - feedback will increase the code stability.
lovening
Mar 9th, 2006, 01:15 AM
I have read your code and tested it,it is good! But I doubt some implements in JbpmTemplate:
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
// see if persistence is required
// we don't have any other way to get the services then by creating a jbpm context
// secured in try/finally block
JbpmContext dummy = getContext();
try {
Services services = dummy.getServices();
if (services.hasService(Services.SERVICENAME_PERSISTE NCE)) {
hasPersistenceService = true;
logger.debug("jBPM persistence service present");
}
}
finally {
dummy.close();
}
if (hibernateTemplate != null)
logger.debug("hibernateTemplate present - jBPM persistence service will be managed by Spring");
else
logger.debug("hibernateTemplate missing - jBPM will handle its own persistence");
}
I think you should judge if JbpmContext has PersistenceServiceFactory because PersistenceService is lazy-initiated, so when you first create a jbpmcontext by jbpmconfiguration, PersistenceService is always null. My code is:
try {
ServiceFactory persistenceServiceFactory =
(ServiceFactory)dummy.getServiceFactory("persistence");
if (persistenceServiceFactory != null) {
hasPersistenceService = true;
}
}
finally {
dummy.close();
}
what do you think about that? I hope to receive your idea.
Regards,lovening
Costin Leau
Mar 9th, 2006, 04:48 AM
Thanks. I'll look at the issue sometime today and then post the fix (if it's the case) on the CVS. I'll let you know when once it's done. I might be offline for a while so please use JIRA - this way the issues won't get lost.
Costin Leau
Mar 9th, 2006, 07:12 AM
Lovening, I looked at the Jbpm sources and the current implementation is working. Note that I am not retrieving the persistence service or serviceFactory - I am just calling the hasService method which in fact just looks if the key is present or not which should work even if lazy-loading is present.
If you have issues with the persistence detection, please create a test or describe a scenario that proves it and raise an issue on jira. Thanks.
lovening
Mar 9th, 2006, 08:24 PM
Lovening, I looked at the Jbpm sources and the current implementation is working. Note that I am not retrieving the persistence service or serviceFactory - I am just calling the hasService method which in fact just looks if the key is present or not which should work even if lazy-loading is present.
If you have issues with the persistence detection, please create a test or describe a scenario that proves it and raise an issue on jira. Thanks.
In my opinion, if JbpmContext has PersistenceServiceFactory, it must has PersistenceService, and I want use hibernateTemplate to do persistent operation, so I judge if JbpmContext has PersistenceServiceFactory.
In your implementation, hasService method always return false because services is null and it always will use jbpm persistent service, it is not my hope
Regards,lovening
Costin Leau
Mar 10th, 2006, 01:23 AM
I've reviewed the jbpm code and you are right - the services map will be null and hasService() will return false if getService() doesn't get called.
It would have been a faster process if you had submitted a test :). I'll put the fix today on the cvs.
Costin Leau
Mar 10th, 2006, 01:33 AM
You can track the issue here: http://opensource2.atlassian.com/projects/spring/browse/MOD-96
lovening
Mar 12th, 2006, 08:13 PM
I have seen it. Thank you for your work
joelkoz
Apr 12th, 2006, 03:08 PM
Any feedback is welcomed.
Costin -
I've been starting to look at the jBPM 3.1 integration code. So far, it looks pretty good!
One very small suggestion: for more consistency with the rest of the Spring class naming, I suggest you rename the class
JbpmHandler
to
JbpmHandlerProxy
and rename the "beanName" attribute to "targetBean" That would make the purpose to a Spring user a little more clear (at least in my mind).
As I said - very minor, but if its not an official API yet, and if you're looking for feedback...
-Joel
Costin Leau
Apr 12th, 2006, 03:32 PM
Hey, joelkoz. Feedback is welcomed - can you please raise an issue on Spring Modules JIRA? Thanks.
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.