UtilProperties Idea - please comment

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

UtilProperties Idea - please comment

Adrian Crum
I've been working on the UtilProperties class to clean up some of the code, improving the cache
handling algorithm, improve support for i18n, and add support for the new XML properties file format.

I believe we could really improve the performance of OFBiz if we cached FastMap instances instead of
java.util.Properties instances. That would require a slight change in the UtilProperties API -
UtilProperties.getProperties(...) would return a Map instance instead of a Properties instance.

Doing so wouldn't have a large impact on the existing code base - there are only a handful of places
where UtilProperties.getProperties(...) is called. The problem would be legacy installations -
custom code that calls UtilProperties.getProperties(...) would break.

Should I change the existing method signature, or add the new methods and deprecate the old ones?

-Adrian

Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

jonwimp
Adrian,

How about getting FlexibleProperties to implement Map, in addition to Properties?

Jonathon

Adrian Crum wrote:

> I've been working on the UtilProperties class to clean up some of the
> code, improving the cache handling algorithm, improve support for i18n,
> and add support for the new XML properties file format.
>
> I believe we could really improve the performance of OFBiz if we cached
> FastMap instances instead of java.util.Properties instances. That would
> require a slight change in the UtilProperties API -
> UtilProperties.getProperties(...) would return a Map instance instead of
> a Properties instance.
>
> Doing so wouldn't have a large impact on the existing code base - there
> are only a handful of places where UtilProperties.getProperties(...) is
> called. The problem would be legacy installations - custom code that
> calls UtilProperties.getProperties(...) would break.
>
> Should I change the existing method signature, or add the new methods
> and deprecate the old ones?
>
> -Adrian
>
>

Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

Adrian Crum
Jonathon,

Properties extends Map. I ended up having two methods - one that returns a Map in addition to the
original.

I've been using it for nearly a week and everything seems to be working well. I'll post it to Jira
in the next few days.

-Adrian

Jonathon -- Improov wrote:

> Adrian,
>
> How about getting FlexibleProperties to implement Map, in addition to
> Properties?
>
> Jonathon
>
> Adrian Crum wrote:
>
>> I've been working on the UtilProperties class to clean up some of the
>> code, improving the cache handling algorithm, improve support for
>> i18n, and add support for the new XML properties file format.
>>
>> I believe we could really improve the performance of OFBiz if we
>> cached FastMap instances instead of java.util.Properties instances.
>> That would require a slight change in the UtilProperties API -
>> UtilProperties.getProperties(...) would return a Map instance instead
>> of a Properties instance.
>>
>> Doing so wouldn't have a large impact on the existing code base -
>> there are only a handful of places where
>> UtilProperties.getProperties(...) is called. The problem would be
>> legacy installations - custom code that calls
>> UtilProperties.getProperties(...) would break.
>>
>> Should I change the existing method signature, or add the new methods
>> and deprecate the old ones?
>>
>> -Adrian
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

jonwimp
Adrian,

Method overriding is only possible with different parameters, not with different returns, I believe?

Rather than deprecating one of those 2 methods, might I suggest that you retain just one? One
method that will serve both the old and the new usages.

Here's how it works.

If Properties continues to extend FlexibleProperties, your original method signature works for old
usages. What about the new ones requiring a Map to be returned?

If FlexibleProperties implements Properties, then it can be viewed as a "type of Properties". If
it also implements Map, then it can be cast into a Map!

One class (FlexibleProperties), 2 perspectives. Everybody is happy. :)

Hope that is clear. It's some Java stuff. Check out multiple interfaces for a single class.

Not that you don't know Java (you've certainly done lots for Widget Engine!!). I'm just hoping to
keep the coding as Java-OO as possible. Neat and clean. There are certainly many ways of going
about it.

Jonathon

Adrian Crum wrote:

> Jonathon,
>
> Properties extends Map. I ended up having two methods - one that returns
> a Map in addition to the original.
>
> I've been using it for nearly a week and everything seems to be working
> well. I'll post it to Jira in the next few days.
>
> -Adrian
>
> Jonathon -- Improov wrote:
>> Adrian,
>>
>> How about getting FlexibleProperties to implement Map, in addition to
>> Properties?
>>
>> Jonathon
>>
>> Adrian Crum wrote:
>>
>>> I've been working on the UtilProperties class to clean up some of the
>>> code, improving the cache handling algorithm, improve support for
>>> i18n, and add support for the new XML properties file format.
>>>
>>> I believe we could really improve the performance of OFBiz if we
>>> cached FastMap instances instead of java.util.Properties instances.
>>> That would require a slight change in the UtilProperties API -
>>> UtilProperties.getProperties(...) would return a Map instance instead
>>> of a Properties instance.
>>>
>>> Doing so wouldn't have a large impact on the existing code base -
>>> there are only a handful of places where
>>> UtilProperties.getProperties(...) is called. The problem would be
>>> legacy installations - custom code that calls
>>> UtilProperties.getProperties(...) would break.
>>>
>>> Should I change the existing method signature, or add the new methods
>>> and deprecate the old ones?
>>>
>>> -Adrian
>>>
>>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

jonwimp
In reply to this post by Adrian Crum
Oh, I missed this.

Yeah, Properties implements Map. Isn't it possible to get a Properties from method
getProperties(...), and the cast it to a Map?

In FlexibleProperties, override the Hashtable methods in Properties. That is, in
FlexibleProperties, encapsulate one FastMap, and make sure all Map interfaces use that FastMap.

Jonathon

Adrian Crum wrote:

> Jonathon,
>
> Properties extends Map. I ended up having two methods - one that returns
> a Map in addition to the original.
>
> I've been using it for nearly a week and everything seems to be working
> well. I'll post it to Jira in the next few days.
>
> -Adrian
>
> Jonathon -- Improov wrote:
>> Adrian,
>>
>> How about getting FlexibleProperties to implement Map, in addition to
>> Properties?
>>
>> Jonathon
>>
>> Adrian Crum wrote:
>>
>>> I've been working on the UtilProperties class to clean up some of the
>>> code, improving the cache handling algorithm, improve support for
>>> i18n, and add support for the new XML properties file format.
>>>
>>> I believe we could really improve the performance of OFBiz if we
>>> cached FastMap instances instead of java.util.Properties instances.
>>> That would require a slight change in the UtilProperties API -
>>> UtilProperties.getProperties(...) would return a Map instance instead
>>> of a Properties instance.
>>>
>>> Doing so wouldn't have a large impact on the existing code base -
>>> there are only a handful of places where
>>> UtilProperties.getProperties(...) is called. The problem would be
>>> legacy installations - custom code that calls
>>> UtilProperties.getProperties(...) would break.
>>>
>>> Should I change the existing method signature, or add the new methods
>>> and deprecate the old ones?
>>>
>>> -Adrian
>>>
>>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

jonwimp
In reply to this post by jonwimp
Ignore my post here. See the other one. Even simpler solution.

Jonathon

Jonathon -- Improov wrote:

> Adrian,
>
> Method overriding is only possible with different parameters, not with
> different returns, I believe?
>
> Rather than deprecating one of those 2 methods, might I suggest that you
> retain just one? One method that will serve both the old and the new
> usages.
>
> Here's how it works.
>
> If Properties continues to extend FlexibleProperties, your original
> method signature works for old usages. What about the new ones requiring
> a Map to be returned?
>
> If FlexibleProperties implements Properties, then it can be viewed as a
> "type of Properties". If it also implements Map, then it can be cast
> into a Map!
>
> One class (FlexibleProperties), 2 perspectives. Everybody is happy. :)
>
> Hope that is clear. It's some Java stuff. Check out multiple interfaces
> for a single class.
>
> Not that you don't know Java (you've certainly done lots for Widget
> Engine!!). I'm just hoping to keep the coding as Java-OO as possible.
> Neat and clean. There are certainly many ways of going about it.
>
> Jonathon
>
> Adrian Crum wrote:
>> Jonathon,
>>
>> Properties extends Map. I ended up having two methods - one that
>> returns a Map in addition to the original.
>>
>> I've been using it for nearly a week and everything seems to be
>> working well. I'll post it to Jira in the next few days.
>>
>> -Adrian
>>
>> Jonathon -- Improov wrote:
>>> Adrian,
>>>
>>> How about getting FlexibleProperties to implement Map, in addition to
>>> Properties?
>>>
>>> Jonathon
>>>
>>> Adrian Crum wrote:
>>>
>>>> I've been working on the UtilProperties class to clean up some of
>>>> the code, improving the cache handling algorithm, improve support
>>>> for i18n, and add support for the new XML properties file format.
>>>>
>>>> I believe we could really improve the performance of OFBiz if we
>>>> cached FastMap instances instead of java.util.Properties instances.
>>>> That would require a slight change in the UtilProperties API -
>>>> UtilProperties.getProperties(...) would return a Map instance
>>>> instead of a Properties instance.
>>>>
>>>> Doing so wouldn't have a large impact on the existing code base -
>>>> there are only a handful of places where
>>>> UtilProperties.getProperties(...) is called. The problem would be
>>>> legacy installations - custom code that calls
>>>> UtilProperties.getProperties(...) would break.
>>>>
>>>> Should I change the existing method signature, or add the new
>>>> methods and deprecate the old ones?
>>>>
>>>> -Adrian
>>>>
>>>>
>>>
>>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

Adrian Crum-2
In reply to this post by jonwimp
Jonathon,

Thank you for the ideas. Actually, I ended up getting rid of references to FlexibleProperties - it didn't do anything special and only one other class is using it.

-Adrian

Jonathon -- Improov <[hidden email]> wrote: Oh, I missed this.

Yeah, Properties implements Map. Isn't it possible to get a Properties from method
getProperties(...), and the cast it to a Map?

In FlexibleProperties, override the Hashtable methods in Properties. That is, in
FlexibleProperties, encapsulate one FastMap, and make sure all Map interfaces use that FastMap.

Jonathon

Adrian Crum wrote:

> Jonathon,
>
> Properties extends Map. I ended up having two methods - one that returns
> a Map in addition to the original.
>
> I've been using it for nearly a week and everything seems to be working
> well. I'll post it to Jira in the next few days.
>
> -Adrian
>
> Jonathon -- Improov wrote:
>> Adrian,
>>
>> How about getting FlexibleProperties to implement Map, in addition to
>> Properties?
>>
>> Jonathon
>>
>> Adrian Crum wrote:
>>
>>> I've been working on the UtilProperties class to clean up some of the
>>> code, improving the cache handling algorithm, improve support for
>>> i18n, and add support for the new XML properties file format.
>>>
>>> I believe we could really improve the performance of OFBiz if we
>>> cached FastMap instances instead of java.util.Properties instances.
>>> That would require a slight change in the UtilProperties API -
>>> UtilProperties.getProperties(...) would return a Map instance instead
>>> of a Properties instance.
>>>
>>> Doing so wouldn't have a large impact on the existing code base -
>>> there are only a handful of places where
>>> UtilProperties.getProperties(...) is called. The problem would be
>>> legacy installations - custom code that calls
>>> UtilProperties.getProperties(...) would break.
>>>
>>> Should I change the existing method signature, or add the new methods
>>> and deprecate the old ones?
>>>
>>> -Adrian
>>>
>>>
>>
>>
>
>



       
---------------------------------
Never miss a thing.   Make Yahoo your homepage.
Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

jonwimp
That's a bit destructive.

Last count of usage: Debug, UtilProperties, VelocityViewHandler.

Well, long as it works. :)

Jonathon

Adrian Crum wrote:

> Jonathon,
>
> Thank you for the ideas. Actually, I ended up getting rid of references to FlexibleProperties - it didn't do anything special and only one other class is using it.
>
> -Adrian
>
> Jonathon -- Improov <[hidden email]> wrote: Oh, I missed this.
>
> Yeah, Properties implements Map. Isn't it possible to get a Properties from method
> getProperties(...), and the cast it to a Map?
>
> In FlexibleProperties, override the Hashtable methods in Properties. That is, in
> FlexibleProperties, encapsulate one FastMap, and make sure all Map interfaces use that FastMap.
>
> Jonathon
>
> Adrian Crum wrote:
>> Jonathon,
>>
>> Properties extends Map. I ended up having two methods - one that returns
>> a Map in addition to the original.
>>
>> I've been using it for nearly a week and everything seems to be working
>> well. I'll post it to Jira in the next few days.
>>
>> -Adrian
>>
>> Jonathon -- Improov wrote:
>>> Adrian,
>>>
>>> How about getting FlexibleProperties to implement Map, in addition to
>>> Properties?
>>>
>>> Jonathon
>>>
>>> Adrian Crum wrote:
>>>
>>>> I've been working on the UtilProperties class to clean up some of the
>>>> code, improving the cache handling algorithm, improve support for
>>>> i18n, and add support for the new XML properties file format.
>>>>
>>>> I believe we could really improve the performance of OFBiz if we
>>>> cached FastMap instances instead of java.util.Properties instances.
>>>> That would require a slight change in the UtilProperties API -
>>>> UtilProperties.getProperties(...) would return a Map instance instead
>>>> of a Properties instance.
>>>>
>>>> Doing so wouldn't have a large impact on the existing code base -
>>>> there are only a handful of places where
>>>> UtilProperties.getProperties(...) is called. The problem would be
>>>> legacy installations - custom code that calls
>>>> UtilProperties.getProperties(...) would break.
>>>>
>>>> Should I change the existing method signature, or add the new methods
>>>> and deprecate the old ones?
>>>>
>>>> -Adrian
>>>>
>>>>
>>>
>>
>
>
>
>        
> ---------------------------------
> Never miss a thing.   Make Yahoo your homepage.
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM

Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

Adrian Crum-2
No, it's not destructive - the class is still there. It's just that UtilProperties doesn't use it any more.

-Adrian

Jonathon -- Improov <[hidden email]> wrote: That's a bit destructive.

Last count of usage: Debug, UtilProperties, VelocityViewHandler.

Well, long as it works. :)

Jonathon

Adrian Crum wrote:

> Jonathon,
>
> Thank you for the ideas. Actually, I ended up getting rid of references to FlexibleProperties - it didn't do anything special and only one other class is using it.
>
> -Adrian
>
> Jonathon -- Improov  wrote: Oh, I missed this.
>
> Yeah, Properties implements Map. Isn't it possible to get a Properties from method
> getProperties(...), and the cast it to a Map?
>
> In FlexibleProperties, override the Hashtable methods in Properties. That is, in
> FlexibleProperties, encapsulate one FastMap, and make sure all Map interfaces use that FastMap.
>
> Jonathon
>
> Adrian Crum wrote:
>> Jonathon,
>>
>> Properties extends Map. I ended up having two methods - one that returns
>> a Map in addition to the original.
>>
>> I've been using it for nearly a week and everything seems to be working
>> well. I'll post it to Jira in the next few days.
>>
>> -Adrian
>>
>> Jonathon -- Improov wrote:
>>> Adrian,
>>>
>>> How about getting FlexibleProperties to implement Map, in addition to
>>> Properties?
>>>
>>> Jonathon
>>>
>>> Adrian Crum wrote:
>>>
>>>> I've been working on the UtilProperties class to clean up some of the
>>>> code, improving the cache handling algorithm, improve support for
>>>> i18n, and add support for the new XML properties file format.
>>>>
>>>> I believe we could really improve the performance of OFBiz if we
>>>> cached FastMap instances instead of java.util.Properties instances.
>>>> That would require a slight change in the UtilProperties API -
>>>> UtilProperties.getProperties(...) would return a Map instance instead
>>>> of a Properties instance.
>>>>
>>>> Doing so wouldn't have a large impact on the existing code base -
>>>> there are only a handful of places where
>>>> UtilProperties.getProperties(...) is called. The problem would be
>>>> legacy installations - custom code that calls
>>>> UtilProperties.getProperties(...) would break.
>>>>
>>>> Should I change the existing method signature, or add the new methods
>>>> and deprecate the old ones?
>>>>
>>>> -Adrian
>>>>
>>>>
>>>
>>
>
>
>
>        
> ---------------------------------
> Never miss a thing.   Make Yahoo your homepage.
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM



       
---------------------------------
Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.
Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

jonwimp
Oh, ok. I think it's perfectly alright. Have you checked usages of method
UtilProperties.getProperties(...)? Those will need to be changed to expect Map.

If you keep the original getProperties(...), and enhance FlexibleProperties to internally use
FastMap, the change propagation will not be needed.

Jonathon

Adrian Crum wrote:

> No, it's not destructive - the class is still there. It's just that UtilProperties doesn't use it any more.
>
> -Adrian
>
> Jonathon -- Improov <[hidden email]> wrote: That's a bit destructive.
>
> Last count of usage: Debug, UtilProperties, VelocityViewHandler.
>
> Well, long as it works. :)
>
> Jonathon
>
> Adrian Crum wrote:
>> Jonathon,
>>
>> Thank you for the ideas. Actually, I ended up getting rid of references to FlexibleProperties - it didn't do anything special and only one other class is using it.
>>
>> -Adrian
>>
>> Jonathon -- Improov  wrote: Oh, I missed this.
>>
>> Yeah, Properties implements Map. Isn't it possible to get a Properties from method
>> getProperties(...), and the cast it to a Map?
>>
>> In FlexibleProperties, override the Hashtable methods in Properties. That is, in
>> FlexibleProperties, encapsulate one FastMap, and make sure all Map interfaces use that FastMap.
>>
>> Jonathon
>>
>> Adrian Crum wrote:
>>> Jonathon,
>>>
>>> Properties extends Map. I ended up having two methods - one that returns
>>> a Map in addition to the original.
>>>
>>> I've been using it for nearly a week and everything seems to be working
>>> well. I'll post it to Jira in the next few days.
>>>
>>> -Adrian
>>>
>>> Jonathon -- Improov wrote:
>>>> Adrian,
>>>>
>>>> How about getting FlexibleProperties to implement Map, in addition to
>>>> Properties?
>>>>
>>>> Jonathon
>>>>
>>>> Adrian Crum wrote:
>>>>
>>>>> I've been working on the UtilProperties class to clean up some of the
>>>>> code, improving the cache handling algorithm, improve support for
>>>>> i18n, and add support for the new XML properties file format.
>>>>>
>>>>> I believe we could really improve the performance of OFBiz if we
>>>>> cached FastMap instances instead of java.util.Properties instances.
>>>>> That would require a slight change in the UtilProperties API -
>>>>> UtilProperties.getProperties(...) would return a Map instance instead
>>>>> of a Properties instance.
>>>>>
>>>>> Doing so wouldn't have a large impact on the existing code base -
>>>>> there are only a handful of places where
>>>>> UtilProperties.getProperties(...) is called. The problem would be
>>>>> legacy installations - custom code that calls
>>>>> UtilProperties.getProperties(...) would break.
>>>>>
>>>>> Should I change the existing method signature, or add the new methods
>>>>> and deprecate the old ones?
>>>>>
>>>>> -Adrian
>>>>>
>>>>>
>>
>>
>>        
>> ---------------------------------
>> Never miss a thing.   Make Yahoo your homepage.
>>
>>
>> ------------------------------------------------------------------------
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM
>
>
>
>        
> ---------------------------------
> Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM

Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

Adrian Crum-2
Jonathon,

I've already answered the question I originally posted. The rest of the details will be obvious when I submit the patch. Be patient.

-Adrian

Jonathon -- Improov <[hidden email]> wrote: Oh, ok. I think it's perfectly alright. Have you checked usages of method
UtilProperties.getProperties(...)? Those will need to be changed to expect Map.

If you keep the original getProperties(...), and enhance FlexibleProperties to internally use
FastMap, the change propagation will not be needed.

Jonathon

Adrian Crum wrote:

> No, it's not destructive - the class is still there. It's just that UtilProperties doesn't use it any more.
>
> -Adrian
>
> Jonathon -- Improov  wrote: That's a bit destructive.
>
> Last count of usage: Debug, UtilProperties, VelocityViewHandler.
>
> Well, long as it works. :)
>
> Jonathon
>
> Adrian Crum wrote:
>> Jonathon,
>>
>> Thank you for the ideas. Actually, I ended up getting rid of references to FlexibleProperties - it didn't do anything special and only one other class is using it.
>>
>> -Adrian
>>
>> Jonathon -- Improov  wrote: Oh, I missed this.
>>
>> Yeah, Properties implements Map. Isn't it possible to get a Properties from method
>> getProperties(...), and the cast it to a Map?
>>
>> In FlexibleProperties, override the Hashtable methods in Properties. That is, in
>> FlexibleProperties, encapsulate one FastMap, and make sure all Map interfaces use that FastMap.
>>
>> Jonathon
>>
>> Adrian Crum wrote:
>>> Jonathon,
>>>
>>> Properties extends Map. I ended up having two methods - one that returns
>>> a Map in addition to the original.
>>>
>>> I've been using it for nearly a week and everything seems to be working
>>> well. I'll post it to Jira in the next few days.
>>>
>>> -Adrian
>>>
>>> Jonathon -- Improov wrote:
>>>> Adrian,
>>>>
>>>> How about getting FlexibleProperties to implement Map, in addition to
>>>> Properties?
>>>>
>>>> Jonathon
>>>>
>>>> Adrian Crum wrote:
>>>>
>>>>> I've been working on the UtilProperties class to clean up some of the
>>>>> code, improving the cache handling algorithm, improve support for
>>>>> i18n, and add support for the new XML properties file format.
>>>>>
>>>>> I believe we could really improve the performance of OFBiz if we
>>>>> cached FastMap instances instead of java.util.Properties instances.
>>>>> That would require a slight change in the UtilProperties API -
>>>>> UtilProperties.getProperties(...) would return a Map instance instead
>>>>> of a Properties instance.
>>>>>
>>>>> Doing so wouldn't have a large impact on the existing code base -
>>>>> there are only a handful of places where
>>>>> UtilProperties.getProperties(...) is called. The problem would be
>>>>> legacy installations - custom code that calls
>>>>> UtilProperties.getProperties(...) would break.
>>>>>
>>>>> Should I change the existing method signature, or add the new methods
>>>>> and deprecate the old ones?
>>>>>
>>>>> -Adrian
>>>>>
>>>>>
>>
>>
>>        
>> ---------------------------------
>> Never miss a thing.   Make Yahoo your homepage.
>>
>>
>> ------------------------------------------------------------------------
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM
>
>
>
>        
> ---------------------------------
> Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM



       
---------------------------------
Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.
Reply | Threaded
Open this post in threaded view
|

Re: UtilProperties Idea - please comment

jonwimp
In your original post, you mentioned a concern about breaking legacy codes.

I gave a suggestion that (if I'm not wrong) would fix the concern. Legacy codes will work, nothing
will be broken. Yet, the efficient FastMap will be used. Both ends of spectrum benefit.

I thought you wanted to address that concern.

I'll wait for the patch. :) I'm also currently systematically going through the framework codes.
Nice to see you making enhancements and wrapping up loose ends.

Jonathon

Adrian Crum wrote:

> Jonathon,
>
> I've already answered the question I originally posted. The rest of the details will be obvious when I submit the patch. Be patient.
>
> -Adrian
>
> Jonathon -- Improov <[hidden email]> wrote: Oh, ok. I think it's perfectly alright. Have you checked usages of method
> UtilProperties.getProperties(...)? Those will need to be changed to expect Map.
>
> If you keep the original getProperties(...), and enhance FlexibleProperties to internally use
> FastMap, the change propagation will not be needed.
>
> Jonathon
>
> Adrian Crum wrote:
>> No, it's not destructive - the class is still there. It's just that UtilProperties doesn't use it any more.
>>
>> -Adrian
>>
>> Jonathon -- Improov  wrote: That's a bit destructive.
>>
>> Last count of usage: Debug, UtilProperties, VelocityViewHandler.
>>
>> Well, long as it works. :)
>>
>> Jonathon
>>
>> Adrian Crum wrote:
>>> Jonathon,
>>>
>>> Thank you for the ideas. Actually, I ended up getting rid of references to FlexibleProperties - it didn't do anything special and only one other class is using it.
>>>
>>> -Adrian
>>>
>>> Jonathon -- Improov  wrote: Oh, I missed this.
>>>
>>> Yeah, Properties implements Map. Isn't it possible to get a Properties from method
>>> getProperties(...), and the cast it to a Map?
>>>
>>> In FlexibleProperties, override the Hashtable methods in Properties. That is, in
>>> FlexibleProperties, encapsulate one FastMap, and make sure all Map interfaces use that FastMap.
>>>
>>> Jonathon
>>>
>>> Adrian Crum wrote:
>>>> Jonathon,
>>>>
>>>> Properties extends Map. I ended up having two methods - one that returns
>>>> a Map in addition to the original.
>>>>
>>>> I've been using it for nearly a week and everything seems to be working
>>>> well. I'll post it to Jira in the next few days.
>>>>
>>>> -Adrian
>>>>
>>>> Jonathon -- Improov wrote:
>>>>> Adrian,
>>>>>
>>>>> How about getting FlexibleProperties to implement Map, in addition to
>>>>> Properties?
>>>>>
>>>>> Jonathon
>>>>>
>>>>> Adrian Crum wrote:
>>>>>
>>>>>> I've been working on the UtilProperties class to clean up some of the
>>>>>> code, improving the cache handling algorithm, improve support for
>>>>>> i18n, and add support for the new XML properties file format.
>>>>>>
>>>>>> I believe we could really improve the performance of OFBiz if we
>>>>>> cached FastMap instances instead of java.util.Properties instances.
>>>>>> That would require a slight change in the UtilProperties API -
>>>>>> UtilProperties.getProperties(...) would return a Map instance instead
>>>>>> of a Properties instance.
>>>>>>
>>>>>> Doing so wouldn't have a large impact on the existing code base -
>>>>>> there are only a handful of places where
>>>>>> UtilProperties.getProperties(...) is called. The problem would be
>>>>>> legacy installations - custom code that calls
>>>>>> UtilProperties.getProperties(...) would break.
>>>>>>
>>>>>> Should I change the existing method signature, or add the new methods
>>>>>> and deprecate the old ones?
>>>>>>
>>>>>> -Adrian
>>>>>>
>>>>>>
>>>
>>>        
>>> ---------------------------------
>>> Never miss a thing.   Make Yahoo your homepage.
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> No virus found in this incoming message.
>>> Checked by AVG Free Edition.
>>> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM
>>
>>
>>        
>> ---------------------------------
>> Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.
>>
>>
>> ------------------------------------------------------------------------
>>
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM
>
>
>
>        
> ---------------------------------
> Be a better pen pal. Text or chat with friends inside Yahoo! Mail. See how.
>
>
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.16.13/1169 - Release Date: 12/3/2007 10:56 PM