APEX preferences API

I've used APEX preferences API call to set/get the user preferences with the following call. But, when I exported the application to a different production system, the user preferences are not available. is it possible to export these user preferences to the new system?. any ideas are appreciated.
htmldb_util.set_preference(p_preference => 'layout_pref', p_value => :p100_type, p_user => v('APP_USER'));
thanks for your help,
Surya

Hi Surya,
You can look at extracting your preferences from: FLOWS_030100.WWV_FLOW_PREFERENCES$
Where FLOWS_030100 is your APEX schema (I'm using 3.1.2)
You'd need to write a query to isolate the preferences you want then you could create an external table, load them and run a procedure that loops over each preference and re-inserts them using the apex_util.set_preference procedure as you mentioned below.
I've never tried this before so I highly suggest you test this before doing it.
Martin
[http://apex-smb.blogspot.com/]

Similar Messages

  • Java.utils.prefs.Preferences API throws exception on Mac, not Windows

    This is a Mac-specific problem. Is it a bug, or am I misusing the java.utils.prefs.Preferences API?
    The Preferences flush() API call always throws a BackingStoreException if a system tree preferences root has been read. The system tree has not been modified or written to, but the flush() call is nevertheless throwing an exception. This occurs when running as a normal user without the ability to write to /Library/Preferences.
    See sample code below. Note that I only want to read the system prefs tree. The user tree write flush fails. If the system tree node is not created, the user flush() succeeds.
    Steps to Reproduce
    Delete any existing Java prefs files:
    ~/Library/Preferences/com.apple.java.util.prefs.plist
    ~/Library/Preferences/com.mycompany.prefstest
    /Library/Preferences/com.apple.java.util.prefs.plist
    /Library/Preferences/com.mycompany.prefstest
    Run the following Java code:
    package com.mycompany.prefstest;
    import java.util.prefs.BackingStoreException;
    import java.util.prefs.Preferences;
    public class PrefsTest {
          * @param args
         public static void main(String[] args) {
              String strKey1 = "com/mycompany/prefstest/one/two/three/four/key1";
              Preferences systemRoot = Preferences.systemRoot();
              Preferences userRoot = Preferences.userRoot();
              // Get a value for user prefs.
              String value1 = userRoot.get(strKey1, "missing");
              // Fall back to system prefs if it is not defined.
              if (value1.equals("missing"))
                   value1 = systemRoot.get(strKey1, "missing");
              System.out.println("key1 --> " + value1);
              // If still not defined, set a user-specific value
              if (value1.equals("missing"))
                   userRoot.put(strKey1, "value1");
                   try {
                        userRoot.flush();
                        System.out.println("flushed prefs successfully");
                   catch (BackingStoreException e)
                        System.out.println("Exception: " + e.toString());
    Expected Results
    Should produce the output:
    key --> missing
    flushed prefs successfully
    Actual Results
    Console output is
    key --> missing
    Exception: java.util.prefs.BackingStoreException: Synchronization failed for node '/'
    Notes
    $ java -version
    java version "1.6.0_29"
    Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
    Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
    also tested with:
    java version "1.7.0_04-ea"
    Java(TM) SE Runtime Environment (build 1.7.0_04-ea-b16)
    Java HotSpot(TM) 64-Bit Server VM (build 23.0-b17, mixed mode)
    Mac OS X 10.7.3.
    The "Expected Results" are correctly obtained running the same code on MS-Windows.
    Running the jar as sudo works (with write access to /Library/Preferences), as expected.

    Just for fun, try a key without slashes in it (but for example dots if you must use such a long key).
    I say that because a quick Google search points out that Apple stores the preferences in a file hierarchy in the user home folder. I can already see how using keys which look like a file path are going to cause nuclear reactors to meltdown...

  • Application setting - properties files, user settings - Preferences API

    HI!
    I have 2 rules:
    1. All application settings (e.g. debug level, path to resources - icons, images, path to localization resources) I store in properties files.In other words all information that user CAN NOT change I store use a properties files.
    2. All user settings (e.g. language, skin and so on) I store with Preferences API. In other words all information that user CAN change I store a use Preferences API.
    Is this a good rules?

    a_subscriber wrote:
    HI!
    I have 2 rules:
    1. All application settings (e.g. debug level, path to resources - icons, images, path to localization resources) I store in properties files.In other words all information that user CAN NOT change I store use a properties files.
    2. All user settings (e.g. language, skin and so on) I store with Preferences API. In other words all information that user CAN change I store a use Preferences API.
    Is this a good rules?Sounds good.

  • Preference API in windows when registry is blocked

    Hi All,
    I have a requirement to save the user preferences of a swing based medical application at the user end and the Preferences API seemed clean to fit the bill.
    However after going live, we found that some workstations have been denied user access to the registry. In such cases the entire application seems to fail. Please suggest some way out. It is exteremely important as we have already gone live with the software in place and some doctors may not be able to use the system. For the time being I could start using a properties file as a back up and storing using the random-access file api. Please help......
    Thanks in advance,
    Zeus

    A cursory look at the Preferences.java source leads me to believe that it should be possible to change where the values are stored. This code interrogates the os.name and chooses either the Windows Registry or something else (I assume a file it creates.)
    // 3. Use platform-specific system-wide default
    String platformFactory =
        System.getProperty("os.name").startsWith("Windows")
        ? "java.util.prefs.WindowsPreferencesFactory"
        : "java.util.prefs.FileSystemPreferencesFactory";
    try {
        return (PreferencesFactory)
         Class.forName(platformFactory, false, null).newInstance();
    } catch (Exception e) {
        InternalError error = new InternalError(
         "Can't instantiate platform default Preferences factory "
         + platformFactory);
        error.initCause(e);
        throw error;
    }You should be able to subclass this class and change so that the Registry isn't used.

  • Setting logging.config.class via Preferences API

    The Javadoc for LogManager says:
    In addition, the LogManager uses two optional system properties that allow more control over reading the initial configuration:
    * "java.util.logging.config.class"
    * "java.util.logging.config.file"
    These two properties may be set via the Preferences API, or as command line property definitions to the "java" command, or as system property definitions passed to JNI_CreateJavaVM.
    http://java.sun.com/j2se/1.4/docs/api/java/util/logging/LogManager.html
    So, how can I set the "java.util.logging.config.class" system property via the Preferences API? How can I set any system property via the Preferences API? I think this is a documentation bug, but I would like to know how to do it, otherwise.
    http://java.sun.com/j2se/1.4/docs/api/java/util/prefs/Preferences.html

    I don't know why I couldn't find it when I looked before,
    but it is a filed bug.
    http://developer.java.sun.com/developer/bugParade/bugs/4691587.html
    This help me find a work-around.
    http://developer.java.sun.com/developer/bugParade/bugs/4506094.html

  • Java Preferences api jndi / jdbc implementations?

    We have a requirement to save users gui layout preferences (swing client) in a central location (through a j2ee ejb container). the users should be allowed to log into any company workstation, and have the gui client come up with the users preferences restored.
    does anyone know of commercial or open source implementations of the java preferences api that might accomplish this? (hoping not to re-invent...)
    Thanks
    Joe e.

    I am sure this is not a difficult thing to implement, you might actually spend more time looking for open source implementations rather than do it on your own. I am sure you want to save things like window/frame positions, size, colours, look and feel etc. You can simply save this information in a property file/object. Just any idea...

  • Using the Preferences API

    I've never used this API before, so excuse my ignorance. I have a web application that I have been using a properties file to store base app info, such as the backend database, the url for the ldap, etc. This has been working fine, but after reading about the Preferences API, I thought that this might be the better place to store this info. However, I'm having permission problems that I haven't been able to figure out.
    I've got a development copy of everything on a single computer (using Windows XP), Sun One App Server, and Oracle.
    I created a small test class to see if I could load preferences from an xml file. Here's the class
    package portal.common;
    import java.util.*;
    import java.util.prefs.*;
    import java.io.*;
    import java.lang.*;
    public class PortalPreferences{
         Preferences sysPreferencesRoot;
         public void prefs() throws SecurityException{
    sysPreferencesRoot = Preferences.systemRoot();
         public void uploadPrefs(String file) throws IOException, InvalidPreferencesFormatException{
         FileInputStream fis = new FileInputStream(file);
         RuntimePermission rpermiss = new RuntimePermission("preferences.*");
         Preferences.importPreferences(fis);
         public Preferences getPrefs(){
         return sysPreferencesRoot;
    I then used a jsp to instantiate the class and call the uploadPrefs method. The class instantiates without error, but when I try to load the xml file I get the following error:
    access denied (java.lang.RuntimePermission preferences)
    I've never done anything with the security manager before so I'm not sure how to get around this. I tried creating a RuntimePermission object above, but that didn't work.
    If anyone has any ideas, I'd much appreciate it.

    No, actually I've got the Sun One App server loaded on a desktop I built that I'm using as a test box - its not a server. The Sun server is running fine, as is Oracle. The only problem I'm having is figuring out how to use the Preferences API. Maybe this API isn't the right thing to be using, that's why I'm asking for advice as well as how to get around the security issue that I'm having. My goal is to have application level information that can be stored somewhere other than in a database - this is because one of the pieces of app info is the database that's being used. This app will work with any backend. Currently, this info is stored in a properties file inside the WEB-INF directory. This works fine as is. However, my issue with that is that in order to load the properties file, I've got to have a real drive path. This again isn't that much of an issue except when trying to access from a class that doesn't have the servlet context, however, I am looking for an alternative solution to the properties file. The Preferences seemed like a good solution.

  • Preferences API - utility program

    Is there a utility program (similar to regedit) for setting and maintaining preference data?

    Not sure if this is what you're looking for - but you could write something up using the Preferences API
    http://java.sun.com/j2se/1.4.2/docs/guide/lang/preferences.html

  • Preferences API

    Just a small question: I'm using the preferences API to store settings. I just looked around, but I didn't find where these preferences are saved... I mean in what file!
    Can anyone give me a small hint????
    Thnks a lot!

    It is in the users directory. On windows try looking for the env var HOMEPATH at the command line.
    If you print out the system environment in java it is in there as well (although the name is different.)

  • Preferences API Faulty Implementation

    Hello.
    I am tyring to use te Preferences API. I feel the implementation is faulty. See if you agree:
    In order to use the API, you must invoke one of xxNodeForPackage(Class) or xxRoot(). All 4 of these methods throw SecurityException. How can you make a fallback mechanism?
    Basically this problem is that when you go to get the Preferences, if it's not there you end up with nothing but a null reference -- you can't force-feed an instance with some file you might have containing defaults. You can't come up with even a noop implementation in reality.
    So what are you supposed to do -- go around checking if (myPrefs != null) through all your code?! This is my dilemma.

    I'm glad someone found this post!
    The problem is in the SecurityException. An example looks like this:
    To create the preferences object, we go looking on disk. We use:
    Preferences.userNodeForPackage(Class)or systemNode.. or ..Root. Now: we must catch the SecurityException. So our code will go something like this:
    Preferences userPref = null;
    try {
        userPref = Preferences.userNodeForPackage(getClass());
    catch (SecurityException e) {
         * userPref stays null.
         * And: we have no way to provide a default object or to
         * "force-feed" default values into one somehow.
    }Here you see, in the case where that exception is thrown, we can't create any kind of Preferences object that we could use to just return default values (or some similar fallback technique). -- In all future attempts to get preference data from that node, we would have to check if we actually did get the object. (That's what I said about checking for null.) So, every time we want a pref we would have to test something like this:
    boolean theRealDefault = false;
    if (userPref != null) {
        setState(userPref.getBoolean("state", theRealDefault);
    else {
        setState(theRealDefault);
    }Which is just silly -- but I can't see the way around it!
    Maybe I'm missing something?
    Thanks for the help!
    - Steev.

  • Disabling backing store on Preferences API

    I'm working with a third-party API that makes heavy use of the Java Preferences API.
    However for the application I'm building persistent storage of preferences makes no sense. Therefore I want to disable the backing store so that my "preferences" becomes something that lives in memory only. I also want to avoid the hassle that might come from not having write permission to the backing store.
    I can find lots of examples on the Internet for disabling the Preferences API all-together. This is done by creating a new PrefencesFactory that does absolutely nothing and using this factory instead of the default.
    (all references on the Internet seem to ultimately come from this article: http://www.allaboutbalance.com/disableprefs/)
    I'm not sure what is in that article is what I want. I do not want to disable the Preferences API all-together, I only want to disable the backing store. I'm uncertain if that is what I get from the above mentioned DisabledPreferences implementation.
    Any ideas of how I can disable the backing store ?
    Thanks.

    Thanks, Kaj.
    My question was not entirely clear. As I understand Sun's Preferences API in its standard form it holds the data both in memory (cache) and in the persistent backing store. Therefore I'm not sure it is even required to build a backing store that holds data in memory, i.e. I can use DisabledPreferences in its unmodified form.
    If I'm lucky then all the "get" methods do not in fact go to the backing store to get the value but instead answer with a value from cache. I would expect the backing store to be asked only if the question cannot be answered from cache. If true I will not have to implement my own memory-based backing store.
    But why do I waste your time with this when a simple test will quickly reveal what is going on. :-)
    Stay tuned.
    Thanks.

  • Preferences API: renaming node

    How can I rename a node?
    If this function is not available, I will have to copy the all hierarchy recursively to the new node and then remove the old one. It's more difficult and dirty.

    im now learning the preferences api,but i find
    nothing about this topic in java tutorial,n doc is
    also lack of infomation,anyone know more about this
    api?,n where can i find more detial with this?http://www.google.com/search?q=java+preferences

  • Preferences API On 1.3

    Hi, we are restricted to jdk 1.3 for a few months yet, but
    I'd like to use the preferences api for a new project. Is
    it possible to install the preferences packages on 1.3?
    Bill.

    You may run into class mismatches and such.
    You can also take a look at the source code to find out if there are other dependencies... but if I were you, I'd keep it clean. Mixing and matching packages will only muddy things up ... and if you happen to write work-arounds to make the java.util.pref package work ... if may effect your eventual migration to 1.4

  • Preferences API: How to implement Preferences modifications methods?

    I want to implement methods in Preferences API like putSpi, removeSpi and flushSpi. Backend where all preferences exists is LDAP and XML. At present I have only prefs accessing methods. Please provide me some guidance in this regards.
    Regards,
    Varun

    found it out myself:
    private Preferences prefs = Preferences.userRoot().node(MyClass.class.getName());

  • Preferences API storage

    (I'm posting this question here because noone in the beginners forum could answer me)
    I'm using the new (since j2sdk 1.4) Preferences API to store a small number of prefs. I use user nodes (as opposed tot system nodes), and in Windows everything works correct, but linux users get problems with the backingstore (BackingStoreException). The root user does not have this problem.
    The good point about the preferences also seems a bad point: I don't know where the data is stored, so I can't advise on setting a certain directory readable/writable.
    Preferences prefs = Preferences.userNodeForPackage(auteurstool.Auteursomgeving.class);
    boolean someChoice = prefs.getBoolean("some choice", true);And I'm getting these errors:
    13-nov-2002 16:44:59 java.util.prefs.FileSystemPreferences syncWorld
    WARNING: Couldn't flush user
    prefs: java.util.prefs.BackingStoreException: java.lang.ClassCastException:
    org.apache.xerces.dom.DeferredCommentImpl
    13-nov-2002 16:45:00 java.util.prefs.FileSystemPreferences
    checkLockFile0ErrorCode
    WARNING: Could not lock System prefs.Unix error code 135399620.
    13-nov-2002 16:45:00 java.util.prefs.FileSystemPreferences syncWorld
    WARNING: Couldn't flush system
    prefs: java.util.prefs.BackingStoreException: Couldn't get file lock.
    java.util.prefs.BackingStoreException: Couldn't get file lock.
    Any suggestions?

    There was an answer in the forum
    http://forum.java.sun.com/thread.jsp?forum=32&thread=325325
    that was also quite interesting.

Maybe you are looking for

  • Safari 4.0.5 Flash Crashes

    Process: WebKitPluginHost [8334] Path: /System/Library/Frameworks/WebKit.framework/WebKitPluginHost.app/Contents/MacOS /WebKitPluginHost Identifier: com.apple.WebKit.PluginHost Version: 6531.22 (6531.22.2) Build Info: WebKitPluginHost-65312202~2 Code

  • Replacing dead HD...what to do next

    All: last week I discovered my aluminum imac had a white screen...after doing the repair disk (from the Disk Utilities) my problem was temporarily solved, only to go back to a white screen later...now when I get to the Disk Utility and attempt to 're

  • Acrobat XI Pro Subscription

    I have a saved pdf contract that I'm trying to edit. I previously had the trial version of Acrobat XI Pro. After the trial ran out, yesterday I did the subscription for $20 per month. Now when I try to "open with" Acrobat XI Pro, it keeps telling me

  • Additional PR release step while using standard workflow WS20000077

    Our current PR release strategy is overall release and based on 3 characteristics: doc type, creation indicator and total value of PR. Release code is relevant to standard workflow WS20000077 with role resolution using user-exit.  User exit is based

  • Is there any place in Pages that will let me make a family tree chart?

    Is there any place in Pages that will let me make a family tree chart?