Java Doc for AbstractPreferences.java in  » Apache-Harmony-Java-SE » java-package » java » util » prefs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.util.prefs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.prefs.Preferences
      java.util.prefs.AbstractPreferences

All known Subclasses:   java.util.prefs.RegistryPreferencesImpl,  java.util.prefs.FilePreferencesImpl,
AbstractPreferences
abstract public class AbstractPreferences extends Preferences (Code)
This class is partly implementation of Preferences, which can be used to simplify Preferences provider's implementation.

This class define nine abstract SPI methods, which must be implemented by preference provider. And provider can also override other methods of this class. Some SPI methods will throw BackingStoreException, including childrenNamesSpi(), flushSpi(), keysSpi(), removeNodeSpi(), syncSpi(); getSpi(String, String) never throws any exceptions; the last SPI methods, putSpi(String), removeSpi(String) and childSpi(String) won't throw BackingStoreException, but in some implementations, they may throw SecurityException due to lacking the permission to access backing end storage.


since:
   1.4
See Also:   Preferences


Field Summary
final protected  Objectlock
     The object used to lock this node.
protected  booleannewNode
     This field is true if this node is created while it doesn't exist in the backing store.
 booleanuserNode
    

Constructor Summary
protected  AbstractPreferences(AbstractPreferences parent, String name)
     Construct a new AbstractPreferences instance using given parent node and node name.

Method Summary
public  StringabsolutePath()
    
public  voidaddNodeChangeListener(NodeChangeListener ncl)
    
public  voidaddPreferenceChangeListener(PreferenceChangeListener pcl)
    
final protected  AbstractPreferences[]cachedChildren()
     Return arrays of all cached children node.
abstract protected  AbstractPreferenceschildSpi(String name)
     Return the child preference node with the given name, and create new one if it does not exist.
public  String[]childrenNames()
    
abstract protected  String[]childrenNamesSpi()
     Return names of this node's all children , or empty array if this node has no child.
public  voidclear()
    
public  voidexportNode(OutputStream ostream)
    
public  voidexportSubtree(OutputStream ostream)
    
public  voidflush()
    
abstract protected  voidflushSpi()
     Flush changes of this node to the backing store.
public  Stringget(String key, String deflt)
    
public  booleangetBoolean(String key, boolean deflt)
    
public  byte[]getByteArray(String key, byte[] deflt)
    
protected  AbstractPreferencesgetChild(String name)
     Return the child node with given name, or null if it doesn't exist.
public  doublegetDouble(String key, double deflt)
    
public  floatgetFloat(String key, float deflt)
    
public  intgetInt(String key, int deflt)
    
public  longgetLong(String key, long deflt)
    
abstract protected  StringgetSpi(String key)
     Get the preference value mapped to the given key.
protected  booleanisRemoved()
     Return true if and only if this node has been removed by invoking AbstractPreferences.removeNode() removeNode .
public  booleanisUserNode()
    
public  String[]keys()
    
abstract protected  String[]keysSpi()
     Return all keys of this node's preferences, or empty array if no preference found on this node.
public  Stringname()
    
public  Preferencesnode(String name)
    
public  booleannodeExists(String name)
    
public  Preferencesparent()
    
public  voidput(String key, String value)
    
public  voidputBoolean(String key, boolean value)
    
public  voidputByteArray(String key, byte[] value)
    
public  voidputDouble(String key, double value)
    
public  voidputFloat(String key, float value)
    
public  voidputInt(String key, int value)
    
public  voidputLong(String key, long value)
    
abstract protected  voidputSpi(String name, String value)
     Put the given key-value pair into this node.
public  voidremove(String key)
    
public  voidremoveNode()
    
public  voidremoveNodeChangeListener(NodeChangeListener ncl)
    
abstract protected  voidremoveNodeSpi()
     Remove this node from the preference hierarchy tree.
public  voidremovePreferenceChangeListener(PreferenceChangeListener pcl)
    
abstract protected  voidremoveSpi(String key)
     Remove the preference with the given key.
public  voidsync()
    
abstract protected  voidsyncSpi()
     Synchronize this node with the backing store.
public  StringtoString()
    

Field Detail
lock
final protected Object lock(Code)
The object used to lock this node.



newNode
protected boolean newNode(Code)
This field is true if this node is created while it doesn't exist in the backing store. This field's default value is false, and it is checked when the node creation is completed, and if it is true, the node change event will be fired for this node's parent.



userNode
boolean userNode(Code)
true if this node is in user preference hierarchy




Constructor Detail
AbstractPreferences
protected AbstractPreferences(AbstractPreferences parent, String name)(Code)
Construct a new AbstractPreferences instance using given parent node and node name.
Parameters:
  parent - the parent node of this node, can be null, which means this node is root
Parameters:
  name - the name of this node, can be empty(""), which means this node is root
throws:
  IllegalArgumentException - if name contains slash, or be empty if parent is not null




Method Detail
absolutePath
public String absolutePath()(Code)



addNodeChangeListener
public void addNodeChangeListener(NodeChangeListener ncl)(Code)



addPreferenceChangeListener
public void addPreferenceChangeListener(PreferenceChangeListener pcl)(Code)



cachedChildren
final protected AbstractPreferences[] cachedChildren()(Code)
Return arrays of all cached children node. arrays of all cached children node.



childSpi
abstract protected AbstractPreferences childSpi(String name)(Code)
Return the child preference node with the given name, and create new one if it does not exist. Invoker of this method should assure that the given name are valid as well as this node is not removed. Invocation of this method implies that the node with given name is not cached(or, has been removed.) If the named node has just been removed, implementation of this method must create a new one instead of reactivated the removed one.

The new creation is not required to be persisted immediately until the flush method is invoked.


Parameters:
  name - AbstractPreferences



childrenNames
public String[] childrenNames() throws BackingStoreException(Code)



childrenNamesSpi
abstract protected String[] childrenNamesSpi() throws BackingStoreException(Code)
Return names of this node's all children , or empty array if this node has no child. Cached children name is not required to be returned. names of this node's all children
throws:
  BackingStoreException - if backing store is unavailable or causes operation failure



clear
public void clear() throws BackingStoreException(Code)



exportNode
public void exportNode(OutputStream ostream) throws IOException, BackingStoreException(Code)



exportSubtree
public void exportSubtree(OutputStream ostream) throws IOException, BackingStoreException(Code)



flush
public void flush() throws BackingStoreException(Code)



flushSpi
abstract protected void flushSpi() throws BackingStoreException(Code)
Flush changes of this node to the backing store. This method should only flush this node, and should not include the descendant nodes. The implementation which want to flush all nodes at once should override AbstractPreferences.flush() flush() method.
throws:
  BackingStoreException - if backing store is unavailable or causes operation failure



get
public String get(String key, String deflt)(Code)



getBoolean
public boolean getBoolean(String key, boolean deflt)(Code)



getByteArray
public byte[] getByteArray(String key, byte[] deflt)(Code)



getChild
protected AbstractPreferences getChild(String name) throws BackingStoreException(Code)
Return the child node with given name, or null if it doesn't exist. The given name must be valid and this node cannot be removed. Invocation of this method implies that the node with given name is not cached(or, has been removed.)
Parameters:
  name - the given child name to be got the child node with given name, or null if it doesn't exist
throws:
  BackingStoreException - if backing store is unavailable or causes operation failure



getDouble
public double getDouble(String key, double deflt)(Code)



getFloat
public float getFloat(String key, float deflt)(Code)



getInt
public int getInt(String key, int deflt)(Code)



getLong
public long getLong(String key, long deflt)(Code)



getSpi
abstract protected String getSpi(String key)(Code)
Get the preference value mapped to the given key. Invoker of this method should assure that given key are valid as well as this node is not removed. This method should not throw exceptions, but if it does, the invoker should catch it and deal with it as null return value.
Parameters:
  key - the given key to be searched for the preference value mapped to the given key



isRemoved
protected boolean isRemoved()(Code)
Return true if and only if this node has been removed by invoking AbstractPreferences.removeNode() removeNode . true if and only if this node has been removed by invoking AbstractPreferences.removeNode() removeNode



isUserNode
public boolean isUserNode()(Code)



keys
public String[] keys() throws BackingStoreException(Code)



keysSpi
abstract protected String[] keysSpi() throws BackingStoreException(Code)
Return all keys of this node's preferences, or empty array if no preference found on this node. Invoker of this method should assure that this node is not removed. all keys of this node's preferences
throws:
  BackingStoreException - if backing store is unavailable or causes operation failure



name
public String name()(Code)



node
public Preferences node(String name)(Code)



nodeExists
public boolean nodeExists(String name) throws BackingStoreException(Code)



parent
public Preferences parent()(Code)



put
public void put(String key, String value)(Code)



putBoolean
public void putBoolean(String key, boolean value)(Code)



putByteArray
public void putByteArray(String key, byte[] value)(Code)



putDouble
public void putDouble(String key, double value)(Code)



putFloat
public void putFloat(String key, float value)(Code)



putInt
public void putInt(String key, int value)(Code)



putLong
public void putLong(String key, long value)(Code)



putSpi
abstract protected void putSpi(String name, String value)(Code)
Put the given key-value pair into this node. Invoker of this method should assure that both the given values are valid as well as this node is not removed.
Parameters:
  name - the given preference key
Parameters:
  value - the given preference value



remove
public void remove(String key)(Code)



removeNode
public void removeNode() throws BackingStoreException(Code)



removeNodeChangeListener
public void removeNodeChangeListener(NodeChangeListener ncl)(Code)



removeNodeSpi
abstract protected void removeNodeSpi() throws BackingStoreException(Code)
Remove this node from the preference hierarchy tree. The invoker of this method should assure that this node has no child node, which means the Preferences.removeNode Preferences.removeNode() should invoke this method multi-times in bottom-up pattern. The removal is not required to be persisted at once until the it is flushed.
throws:
  BackingStoreException - if backing store is unavailable or causes operation failure



removePreferenceChangeListener
public void removePreferenceChangeListener(PreferenceChangeListener pcl)(Code)



removeSpi
abstract protected void removeSpi(String key)(Code)
Remove the preference with the given key. Invoker of this method should assure that given key are valid as well as this node is not removed.
Parameters:
  key - the given key to removed



sync
public void sync() throws BackingStoreException(Code)



syncSpi
abstract protected void syncSpi() throws BackingStoreException(Code)
Synchronize this node with the backing store. This method should only synchronize this node, and should not include the descendant nodes. The implementation which want to synchronize all nodes at once should override AbstractPreferences.sync() sync() method.
throws:
  BackingStoreException - if backing store is unavailable or causes operation failure



toString
public String toString()(Code)



Fields inherited from java.util.prefs.Preferences
final public static int MAX_KEY_LENGTH(Code)(Java Doc)
final public static int MAX_NAME_LENGTH(Code)(Java Doc)
final public static int MAX_VALUE_LENGTH(Code)(Java Doc)

Methods inherited from java.util.prefs.Preferences
abstract public String absolutePath()(Code)(Java Doc)
abstract public void addNodeChangeListener(NodeChangeListener ncl)(Code)(Java Doc)
abstract public void addPreferenceChangeListener(PreferenceChangeListener pcl)(Code)(Java Doc)
abstract public String[] childrenNames() throws BackingStoreException(Code)(Java Doc)
abstract public void clear() throws BackingStoreException(Code)(Java Doc)
abstract public void exportNode(OutputStream ostream) throws IOException, BackingStoreException(Code)(Java Doc)
abstract public void exportSubtree(OutputStream ostream) throws IOException, BackingStoreException(Code)(Java Doc)
abstract public void flush() throws BackingStoreException(Code)(Java Doc)
abstract public String get(String key, String deflt)(Code)(Java Doc)
abstract public boolean getBoolean(String key, boolean deflt)(Code)(Java Doc)
abstract public byte[] getByteArray(String key, byte[] deflt)(Code)(Java Doc)
abstract public double getDouble(String key, double deflt)(Code)(Java Doc)
abstract public float getFloat(String key, float deflt)(Code)(Java Doc)
abstract public int getInt(String key, int deflt)(Code)(Java Doc)
abstract public long getLong(String key, long deflt)(Code)(Java Doc)
public static void importPreferences(InputStream istream) throws InvalidPreferencesFormatException, IOException(Code)(Java Doc)
abstract public boolean isUserNode()(Code)(Java Doc)
abstract public String[] keys() throws BackingStoreException(Code)(Java Doc)
abstract public String name()(Code)(Java Doc)
abstract public Preferences node(String path)(Code)(Java Doc)
abstract public boolean nodeExists(String path) throws BackingStoreException(Code)(Java Doc)
abstract public Preferences parent()(Code)(Java Doc)
abstract public void put(String key, String value)(Code)(Java Doc)
abstract public void putBoolean(String key, boolean value)(Code)(Java Doc)
abstract public void putByteArray(String key, byte[] value)(Code)(Java Doc)
abstract public void putDouble(String key, double value)(Code)(Java Doc)
abstract public void putFloat(String key, float value)(Code)(Java Doc)
abstract public void putInt(String key, int value)(Code)(Java Doc)
abstract public void putLong(String key, long value)(Code)(Java Doc)
abstract public void remove(String key)(Code)(Java Doc)
abstract public void removeNode() throws BackingStoreException(Code)(Java Doc)
abstract public void removeNodeChangeListener(NodeChangeListener ncl)(Code)(Java Doc)
abstract public void removePreferenceChangeListener(PreferenceChangeListener pcl)(Code)(Java Doc)
abstract public void sync() throws BackingStoreException(Code)(Java Doc)
public static Preferences systemNodeForPackage(Class c)(Code)(Java Doc)
public static Preferences systemRoot()(Code)(Java Doc)
abstract public String toString()(Code)(Java Doc)
public static Preferences userNodeForPackage(Class c)(Code)(Java Doc)
public static Preferences userRoot()(Code)(Java Doc)

Methods inherited from java.lang.Object
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object object)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final public Class<? extends Object> getClass()(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
final public void notify()(Code)(Java Doc)
final public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final public void wait(long millis, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait(long millis) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.