I just spent some time debugging FlexibleLocation.java. That, plus the recent work I did on EntityClassLoader has made me come to the conclusion that FlexibleLocation.java and the entire org.ofbiz.base.location package are not needed.

All of the org.ofbiz.base.location package functionality already exists in Java's java.net.URL functionality. That functionality is extensible so that applications can add custom protocol handlers easily. Here is one tutorial I found:

http://accu.org/index.php/journals/1434

In addition to the org.ofbiz.base.location package being unnecessary, the code it contains is very inefficient. I have done some code optimizations in the past, but it would be best to just eliminate it entirely.

From a developers perspective, the API would change from:

URL someFileUrl = FlexibleLocation.resolveLocation("component://foo/bar/someFile.xml");

to:

URL someFileUrl = new URL("component://foo/bar/someFile.xml");

We could deprecate the methods for now and log warnings, then eventually remove the package.

What do you think?

--
Adrian Crum
Sandglass Software
www.sandglass-software.com

Reply via email to