src/macosx/classes/java/util/prefs/MacOSXPreferences.java

Print this page

        

*** 33,52 **** // CF preferences file name for Java nodes with short names // This value is also in MacOSXPreferencesFile.c private static final String defaultAppName = "com.apple.java.util.prefs"; // true if this node is a child of userRoot or is userRoot ! private boolean isUser; // true if this node is userRoot or systemRoot ! private boolean isRoot; // CF's storage location for this node and its keys ! private MacOSXPreferencesFile file; // absolutePath() + "/" ! private String path; // User root and system root nodes private static MacOSXPreferences userRoot = null; private static MacOSXPreferences systemRoot = null; --- 33,52 ---- // CF preferences file name for Java nodes with short names // This value is also in MacOSXPreferencesFile.c private static final String defaultAppName = "com.apple.java.util.prefs"; // true if this node is a child of userRoot or is userRoot ! private final boolean isUser; // true if this node is userRoot or systemRoot ! private final boolean isRoot; // CF's storage location for this node and its keys ! private final MacOSXPreferencesFile file; // absolutePath() + "/" ! private final String path; // User root and system root nodes private static MacOSXPreferences userRoot = null; private static MacOSXPreferences systemRoot = null;
*** 71,110 **** } // Create a new root node. Called by getUserRoot() and getSystemRoot() // Synchronization is provided by the caller. ! private MacOSXPreferences(boolean newIsUser) ! { ! super(null, ""); ! isUser = newIsUser; ! isRoot = true; ! ! initFields(); } // Create a new non-root node with the given parent. // Called by childSpi(). ! private MacOSXPreferences(MacOSXPreferences parent, String name) ! { ! super(parent, name); ! isUser = isUserNode(); ! isRoot = false; ! ! initFields(); } ! private void initFields() { path = isRoot ? absolutePath() : absolutePath() + "/"; file = cfFileForNode(isUser); newNode = file.addNode(path); } - // Create and return the MacOSXPreferencesFile for this node. // Does not write anything to the file. private MacOSXPreferencesFile cfFileForNode(boolean isUser) { String name = path; --- 71,114 ---- } // Create a new root node. Called by getUserRoot() and getSystemRoot() // Synchronization is provided by the caller. ! private MacOSXPreferences(boolean newIsUser) { ! this(null, "", false, true, newIsUser); } // Create a new non-root node with the given parent. // Called by childSpi(). ! private MacOSXPreferences(MacOSXPreferences parent, String name) { ! this(parent, name, false, false, false); } + private MacOSXPreferences(MacOSXPreferences parent, String name, + boolean isNew) + { + this(parent, name, isNew, false, false); + } ! private MacOSXPreferences(MacOSXPreferences parent, String name, ! boolean isNew, boolean isRoot, boolean isUser) { + super(parent, name); + this.isRoot = isRoot; + if (isRoot) + this.isUser = isUser; + else + this.isUser = isUserNode(); path = isRoot ? absolutePath() : absolutePath() + "/"; file = cfFileForNode(isUser); + if (isNew) + newNode = isNew; + else newNode = file.addNode(path); } // Create and return the MacOSXPreferencesFile for this node. // Does not write anything to the file. private MacOSXPreferencesFile cfFileForNode(boolean isUser) { String name = path;
*** 202,213 **** protected AbstractPreferences childSpi(String name) { // Add to parent's child list here and disallow sync // because parent and child might be in different files. synchronized(MacOSXPreferencesFile.class) { ! file.addChildToNode(path, name); ! return new MacOSXPreferences(this, name); } } // AbstractPreferences override @Override --- 206,217 ---- protected AbstractPreferences childSpi(String name) { // Add to parent's child list here and disallow sync // because parent and child might be in different files. synchronized(MacOSXPreferencesFile.class) { ! boolean isNew = file.addChildToNode(path, name); ! return new MacOSXPreferences(this, name, isNew); } } // AbstractPreferences override @Override