[jboss-user] [JBoss jBPM] - Is this a bug/weird coding/am I reading this wrong?
pjodev
do-not-reply at jboss.com
Sat Apr 14 20:24:18 EDT 2007
I am looking at the code for JbpmConfiguration.java, specifically the getInstance(String resource) method. It appears that even if you pass in a specific resource (filename) it will STILL attempt to use the defaults at first.
public static JbpmConfiguration getInstance(String resource) {
|
| JbpmConfiguration instance = null;
|
| synchronized(instances) {
| if (resource==null) {
| resource = "jbpm.cfg.xml";
| }
|
| instance = (JbpmConfiguration) instances.get(resource);
| if (instance==null) {
|
| if (defaultObjectFactory!=null) {
| log.debug("creating jbpm configuration from given default object factory '"+defaultObjectFactory+"'");
| instance = new JbpmConfiguration(defaultObjectFactory);
|
| } else {
|
| try {
| log.info("using jbpm configuration resource '"+resource+"'");
| InputStream jbpmCfgXmlStream = ClassLoaderUtil.getStream(resource);
|
| ObjectFactory objectFactory = parseObjectFactory(jbpmCfgXmlStream);
| instance = createJbpmConfiguration(objectFactory);
|
| } catch (RuntimeException e) {
| throw new JbpmException("couldn't parse jbpm configuration from resource '"+resource+"'", e);
| }
| }
|
| instances.put(resource, instance);
| }
| }
|
| return instance;
| }
this line
ObjectFactory objectFactory = parseObjectFactory(jbpmCfgXmlStream);
Goes to the method
| protected static ObjectFactory parseObjectFactory(InputStream inputStream) {
| log.debug("loading defaults in jbpm configuration");
| ObjectFactoryParser objectFactoryParser = new ObjectFactoryParser();
| ObjectFactoryImpl objectFactoryImpl = new ObjectFactoryImpl();
| objectFactoryParser.parseElementsFromResource("org/jbpm/default.jbpm.cfg.xml", objectFactoryImpl);
|
| if (inputStream!=null) {
| log.debug("loading specific configuration...");
| objectFactoryParser.parseElementsStream(inputStream, objectFactoryImpl);
| }
|
| return objectFactoryImpl;
| }
Now it looks like it attempts to build the entire configuration from the default.jbpm.cfg.xml file which is giving me that Message.hbm.xml error What the hell is Message.hbm.xml? WHERE DO I USE IT? (see my other post!!!)
Wouldn't it be better form to try the inputStream first, then if that fails, try to load the default?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4037339#4037339
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4037339
More information about the jboss-user
mailing list