Discussion: Remove org.ofbiz.base.location Package

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Discussion: Remove org.ofbiz.base.location Package

Adrian Crum-3
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 | Threaded
Open this post in threaded view
|

Re: Discussion: Remove org.ofbiz.base.location Package

Jacques Le Roux
Administrator
Did not look into details yet, but at 1st glance (browsing the article) it sounds good to me

Jacques

Le 06/01/2015 22:55, Adrian Crum a écrit :

> 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?
>