Name: rmT116609 Date: 06/25/2003
A DESCRIPTION OF THE REQUEST :
The method, java.util.prefs.Preferences.importPreferences(), imports from an XML stream into the static Preferences.userNode or Preferences.systemNode. This is not useful when trying to import preferences into a separate preferences tree (for example one that stores default settings). Since all of the work for importing XML into a Preferences node has already been implemented in java.util.prefs.XmlSupport, it would be useful to expose this capability in a non-static manner. Specifically, it would be simple to overload like:
XmlSupport.importPreferences(InputStream is, Preferences node)
XmlSupport.importPreferences(InputStream is)
where the former defaults to Preferences.userNode/systemNode if the node parameter is null and latter calls the former with node set to null.
Then you can add a method to Preferences called import(InputStream) to import into the current node. Alternately, if you're worried about attempts to import a system tree into a user tree (and visa versa), you can add a method to PreferencesFactory that returns the root to the tree imported from the XML stream.
JUSTIFICATION :
Having XML import work only on the Preferences.userNode/systemNode is a pointlessly restricts some useful functionality.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Supported ability to import an XML document into a specified Preferences node.
ACTUAL -
This ability doesn't exist.
CUSTOMER SUBMITTED WORKAROUND :
Write this support yourself and keep it current with the latest XML schemas used by Preferences.
(Review ID: 189267)
======================================================================
###@###.### 11/3/04 20:41 GMT
A DESCRIPTION OF THE REQUEST :
The method, java.util.prefs.Preferences.importPreferences(), imports from an XML stream into the static Preferences.userNode or Preferences.systemNode. This is not useful when trying to import preferences into a separate preferences tree (for example one that stores default settings). Since all of the work for importing XML into a Preferences node has already been implemented in java.util.prefs.XmlSupport, it would be useful to expose this capability in a non-static manner. Specifically, it would be simple to overload like:
XmlSupport.importPreferences(InputStream is, Preferences node)
XmlSupport.importPreferences(InputStream is)
where the former defaults to Preferences.userNode/systemNode if the node parameter is null and latter calls the former with node set to null.
Then you can add a method to Preferences called import(InputStream) to import into the current node. Alternately, if you're worried about attempts to import a system tree into a user tree (and visa versa), you can add a method to PreferencesFactory that returns the root to the tree imported from the XML stream.
JUSTIFICATION :
Having XML import work only on the Preferences.userNode/systemNode is a pointlessly restricts some useful functionality.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Supported ability to import an XML document into a specified Preferences node.
ACTUAL -
This ability doesn't exist.
CUSTOMER SUBMITTED WORKAROUND :
Write this support yourself and keep it current with the latest XML schemas used by Preferences.
(Review ID: 189267)
======================================================================
###@###.### 11/3/04 20:41 GMT