On 5/21/07, Eran Chinthaka <[EMAIL PROTECTED]> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Azeez, How abt leaving that method, but making it immutable when you are returning it. One possible implementation is like this. final Map propertiesMap = new HashMap(properties); return propertiesMap;
This won't work. Only the pointer is final. The contents of the Map can be changed/removed/added. One other way is to do Collections.unmodifiableMap(propertiesMap). This also will not work since anybody can retrieve an object from this Map and change that object. The person who uses it has to pay for it as this method copies the whole
thing, but this is better than nothing. One of the reasons why I like this is that you can see/list all the properties in it. If you use this way
The proper way to do this now is use the getPropertyNames() method which will give an iterator over the keys. Next use getProperty(String) to retrieve the value. 1. there won't be any API changes
2. you get what you want as there won't be any non-trackable changes to property map so you are happy 3. viewServiceContext.jsp doesn't need any modifications so Deepal is happy ;) Chinthaka Afkham Azeez wrote: > When it comes to replicating properties in the context hierarchy, we > should only transmit the differences, i.e. only > additions/updates/removals to/from the properties object should be sent > to the group. > > However, AbstractContext#getProperties() is public. Anybody who gets > hold of this Map can add items to it, remove items from it, or update > items in it. This makes it impossible for us to track the changes to the > properties Map. Also, this is bad encapsulation. Users can add any > object as the key to this Map which will break many things. I suggest we > remove this method(or deprecate it?) and introduce the following; > > public Iterator getPropertyNames(); // Will return only the property > names (keys in the Map) > public void removeProperty(String key); > public Object getProperty(String key); > public void setProperty(String key, Object value); > > Without such a change, we may not be able to properly handle replication > of the properties. > -- > Thanks > Afkham Azeez > > http://www.wso2.org > GPG Fingerprint: 643F C2AF EB78 F886 40C9 B2A2 4AE2 C887 665E 0760 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGURNMjON2uBzUhh8RAknAAKCsme7yHONBVaeFPXosVek3Z25IJgCdHWvc rmIGPz0Gk9DIMQR3ZPDl0fc= =wYj1 -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Thanks Afkham Azeez http://www.wso2.org GPG Fingerprint: 643F C2AF EB78 F886 40C9 B2A2 4AE2 C887 665E 0760
