4632N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 4632N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4632N/A * This code is free software; you can redistribute it and/or modify it 4632N/A * under the terms of the GNU General Public License version 2 only, as 4632N/A * published by the Free Software Foundation. Oracle designates this 4632N/A * particular file as subject to the "Classpath" exception as provided 4632N/A * by Oracle in the LICENSE file that accompanied this code. 4632N/A * This code is distributed in the hope that it will be useful, but WITHOUT 4632N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4632N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4632N/A * version 2 for more details (a copy is included in the LICENSE file that 4632N/A * You should have received a copy of the GNU General Public License version 4632N/A * 2 along with this work; if not, write to the Free Software Foundation, 4632N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4632N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4632N/A * or visit www.oracle.com if you need additional information or have any 4632N/A Hierarchical storage layout: 4632N/A <string>/foo's value</string> 4632N/A Java pref nodes are stored in several different files. Pref nodes 4632N/A are stored in a CF prefs file with the first three components as the name. 4632N/A This way, all preferences for MyApp end up in com.MyCompany.MyApp.plist . 4632N/A The filesystem is assumed to be case-insensitive (like HFS+). 4632N/A Java pref node names are case-sensitive. If two pref node names differ 4632N/A only in case, they may end up in the same pref file. This is ok 4632N/A because the CF keys identifying the node span the entire absolute path 4632N/A to the node and are case-sensitive. 4632N/A Java node names may contain '.' . When mapping to the CF file name, 4632N/A these dots are left as-is, even though '/' is mapped to '.' . 4632N/A This is ok because the CF key contains the correct node name. 4632N/A// Throw an OutOfMemoryError with the given message. 4632N/A// If var is NULL, throw an OutOfMemoryError and goto badvar. 4632N/A// var must be a variable. env must be the current JNIEnv. 4632N/A// fixme throw BackingStoreExceptions sometimes? 4632N/A// Converts CFNumber, CFBoolean, CFString to CFString 4632N/A// returns NULL if value is of some other type 4632N/A// throws and returns NULL on memory error 4632N/A// result must be released (even if value was already a CFStringRef) 4632N/A // Java Preferences API expects "true" and "false" for boolean values. 4632N/A // unknown type - return NULL 4632N/A// Create a Java string from the given CF string. 4632N/A// returns NULL if cfString is NULL 4632N/A// throws and returns NULL on memory error 4632N/A// Create a CF string from the given Java string. 4632N/A// returns NULL if javaString is NULL 4632N/A// throws and returns NULL on memory error 4632N/A// Create an empty Java string array of the given size. 4632N/A// Throws and returns NULL on error. 4632N/A// Java accessors for CF constants. 4632N/A// Does not store the node in any prefs file. 4632N/A// returns NULL on memory error 4632N/A// Create a string that consists of path minus its last component. 4632N/A// The result will end in '/' (unless path itself is '/') 4632N/A// Create a string that consists of path's last component. 4632N/A// The result will end in '/'. 4632N/A// The result will not start with '/' (unless path itself is '/') 4632N/A// Return the first three components of path, with leading and trailing '/'. 4632N/A// If path does not have three components, return NULL. 4632N/A// path must begin and end in '/' 4632N/A// Copy the CFPreferences key and value at the base of path's tree. 4632N/A// topKey or topValue may be NULL 4632N/A// Returns NULL on error or if there is no tree for path in this file. 4632N/A // Top-level file. Only key "/" is an acceptable root. 4632N/A // Second-level file. Key must be the first three components of path. 4632N/A // (key, value) is acceptable 4632N/A// Find the node for path in the given tree. 4632N/A// Returns NULL on error or if path doesn't have a node in this tree. 4632N/A // guaranteed to succeed because path must end in '/' 4632N/A// Return a retained copy of the node at path from the given file. 4632N/A// returns NULL if node doesn't exist. 4632N/A// returns NULL if the value for key "path" isn't a valid node. 4632N/A// Create a new tree that would store path in the given file. 4632N/A// Only the root of the tree is created, not all of the links leading to path. 4632N/A// Return a mutable copy of the tree containing path and the dict for 4632N/A// path itself. *outTopKey and *outTopValue can be used to write the 4632N/A// modified tree back to the prefs file. 4632N/A// *outTopKey and *outTopValue must be released iff the actual return 4632N/A // guaranteed to succeed because path must end in '/' 4632N/A // didn't find target node - add it and continue 4632N/A // copyMutableNode creates the node if necessary 4632N/A // root node is not allowed to be removed, so parentName is never empty 4632N/A // might be trying to remove the root itself in a non-root file 4632N/A // like addNode, but can put a three-level-deep dict into the root file 4632N/A // copyMutableNode creates the node if necessary 4632N/A // fixme optimization: check whether old value and new value are identical 4632N/A // key doesn't exist, or other error - no Java errors available 4632N/A // memory error in copyToCFString 4632N/A // bogus value type in prefs file - no Java errors available 4632N/A// CFDictionary applier function that builds an array of Java strings 4632N/A// from a CFDictionary of CFPropertyListRefs. 4632N/A// If args->allowSlash, only strings that end in '/' are added to the array, 4632N/A// with the slash removed. Otherwise, only strings that do not end in '/' 4632N/A// args->result must already exist and be large enough to hold all 4632N/A// strings from the dictionary. 4632N/A// After complete application, args->result may not be full because 4632N/A// some of the dictionary values weren't convertible to string. In 4632N/A// this case, args->used will be the count of used elements. 4632N/A // memory error in copyToCFString 4632N/A // bogus value type in prefs file - no Java errors available 4632N/A // array construction succeeded 4632N/A // finished array is smaller than expected. 4632N/A // Make a new array of precisely the right size. 4632N/A// Returns false on error instead of throwing.