I split the transform properties file into two: frameworkTransforms and applicationTransforms.
I changed the try-catch logic so that a failure to load one class doesn't stop the whole process.
> FreeMarkerWorker.java flexibility
> ---------------------------------
>
> Key: OFBIZ-273
> URL:
https://issues.apache.org/jira/browse/OFBIZ-273> Project: OFBiz
> Issue Type: Improvement
> Components: framework
> Affects Versions: SVN trunk
> Reporter: Marco Risaliti
> Assignee: Jacques Le Roux
> Priority: Minor
> Attachments: FreeMarkerWorker.patch, freemarkerworker.patch, freemarkerworker.properties
>
>
> Copy of the old Jira issue
http://jira.undersunconsulting.com/browse/OFBIZ-848 from Oleg Kozyrev
> =================================================
> Ftl transforms loading in org.ofbiz.base.util.template.FreeMarkerWorker is not really flexible at the moment.
> Now classes to load are hard-coded, like this:
> ftlTransforms.put("ofbizUrl", loader.loadClass("org.ofbiz.webapp.ftl.OfbizUrlTransform").newInstance());
> ftlTransforms.put("ofbizContentUrl", loader.loadClass("org.ofbiz.webapp.ftl.OfbizContentTransform").newInstance());
> ftlTransforms.put("ofbizCurrency", loader.loadClass("org.ofbiz.webapp.ftl.OfbizCurrencyTransform").newInstance());
> ftlTransforms.put("ofbizAmount", loader.loadClass("org.ofbiz.webapp.ftl.OfbizAmountTransform").newInstance());
> So, if we need to add new class we need to recompile all the component. This is not right way, I think.
> I suggest to create separate properties file, like:
> ofbizUrl=org.ofbiz.webapp.ftl.OfbizUrlTransform
> ofbizContentUrl=org.ofbiz.webapp.ftl.OfbizContentTransform
> ofbizCurrency=org.ofbiz.webapp.ftl.OfbizCurrencyTransform
> and load them using UtilProperties class.
> FreeMarkerWorker.java patch
> Comment by Oleg Kozyrev [18/Apr/06 01:05 AM] [ Permlink ]
> freemarkerworker.properties file is attached
> This could live in frameworker/webapp/config as a suggession.
> Comment by Oleg Kozyrev [18/Apr/06 01:06 AM] [ Permlink ]
> I have tested all this stuff. I works fine here.
> Could someone test it too?
> Thanks,
> Oleg.
> Comment by Jacopo Cappellato [12/Sep/06 01:54 PM] [ Permlink ]
> Can we commit this patch? I think it's a nice feature to have.
> Comment by Oleg Kozyrev [13/Sep/06 10:45 PM] [ Permlink ]
> Surely we can commit the patch.
> It was waiting for ages to be commited :)