[jboss-user] [JBoss jBPM] - Re: Solution: JBPM3 and Spring Integration

mr_magoo do-not-reply at jboss.com
Wed Aug 19 19:32:23 EDT 2009


The next is the object factory. We use a map object to store the various nebulous properties that are required as well as getting those core, spring injected service factories in there.
The map makes specifying boolean and string properties a little cleaner and allows us to remove some ugly naming in our core spring config file that would otherwise be needed.

public class SpringObjectFactory implements ObjectFactory, ApplicationContextAware {
  | 
  |     private ApplicationContext applicationContext;
  |     private Map<String, Object> jbpmProperties;
  | 
  |     @Override
  |     public Object createObject(String objectName) {
  |         if (getJbpmProperties().containsKey(objectName)) {
  |             return getJbpmProperties().get(objectName);
  |         }
  |         else if (getApplicationContext().containsBean(objectName)) {
  |             return getApplicationContext().getBean(objectName);
  |         }
  |         else {
  |             return null;
  |         }
  |     }
  |     @Override
  |     public boolean hasObject(String objectName) {
  |         return
  |             getJbpmProperties().containsKey(objectName)||
  |             getApplicationContext().containsBean(objectName);
  |     }
  |     public void setJbpmProperties(Map<String, Object> jbpmProperties) {
  |         this.jbpmProperties = jbpmProperties;
  |     }
  |     public Map<String, Object> getJbpmProperties() {
  |         return jbpmProperties;
  |     }
  |     @Override
  |     public void setApplicationContext(ApplicationContext applicationContext) {
  |         this.applicationContext = applicationContext;
  |     }
  |     public ApplicationContext getApplicationContext() {
  |         return applicationContext;
  |     }
  | }
  | 

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

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250514



More information about the jboss-user mailing list