[Gvsig_english] Preferences Class or getPersistentXML()
jaume domínguez faus
jaume.dominguez at iver.es
Thu Jul 26 08:30:44 CEST 2007
Hi Simone,
In fact you/we should use getPersistentXML() always. As far as I know
everywhere the Java's Preferences is used is because otherwise we would
produce cross dependencies between distinct Eclipse projects which are
semantically incorrect such as:
- upwards dependecy between a library and an extension which are
first tier and second tier, in this case only downwards dependency are
allowed
- cross dependency between libraries; libraries should not have any
external dependency
It is just a 3-tier architecture issue...
Using Java's Preferences help us to keep this modules isolated from
others since the Preferences are widely scoped and accessible from
everywhere due to the Java language specs. And everywhere we use them,
in fact, they don't restore data from previous sessions but *they are
initialized from values of previous sessions stored in the
getPersistentXML() in loading time*. And when exiting all the values are
dumped back to the getPersistentXML() and stored in the xml file
(plugin-persistence.xml).
We could have a wrapper for the Preferences object called Andami (or
something like that) and take values from there, but again what we would
get are the same unacceptable dependencies. So, in this case the use we
do with the Preferences is more or less acceptable.
So, as above, the directions for the developer in this way are: "Yes,
you have to use getPersistentXML() and, if you can, avoid to use
Preferences. At least, don't use only Preferences".
Hope to be useful.
Salut!
Simone Casciaroli wrote:
> Hi gvSig developer,
> I have seen that some preference page use Java Preferences class and
> some other the getPersistentXML() functionality, do you use some role
> for decide what kind of persistence to use? I think would be better if
> all the Preferences stay in a file location (that is using the
> persistent method provided by Adami) because in this way I can change
> the computer and bring with me my preferences. I'm not sure that there
> are other reasons for choice one of the two persistence, open my mind
> with your suggestion.
> Regards
>
> Simone
> _______________________________________________
> Gvsig_internacional mailing list
> Gvsig_internacional at runas.cap.gva.es
> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional
--
Jaume Dominguez Faus
Àrea de Software Lliure
Equip gvSIG
Iver TI
C. Salamanca, 52
46005 València
Telf: 902 25 25 40 Fax: 96 316 27 16
(Spain)
More information about the Gvsig_internacional
mailing list