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.

Similar Messages

  • Location of application-specific properties files

    I am using Tomcat 4.0.3 under WinXP Pro, and I am trying to get my
    application to "find" an application-specific properties file. I am having problems trying to determine which directory to put this file in.
    Here is the Java code I am using for this class:
    import java.util.Properties;
    import java.io.FileInputStream;
    public class ForumProperties extends Properties {
       private static final String DEFAULT_FILENAME = "/WEB-INF/classes/mystuff.properties";
       private static ForumProperties globalProps;
       private ForumProperties() {
       private ForumProperties(String fileName) throws Exception {
          this();
          load(new FileInputStream(fileName));
       public static ForumProperties getInstance() throws Exception {
          try {
             if (globalProps == null)
                globalProps = new ForumProperties(DEFAULT_FILENAME);
          } catch (Exception ex) {
             ex.printStackTrace(System.out);
             throw new Exception("Error loading properties file");
          return globalProps;
    }I have put the properties file in just about every directory I can think of to try and find out where it's supposed to be, but I can't get it to work. I can put the file into the "user.home" System property (which turns out to be C:\Documents and Settings\Administrator) and have it pick it up, but I would prefer to put the file into the path of the application.
    I have tried four different methods to load this file:
    1. load(new FileInputStream(fileName)); (same as above)
    2. load(Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName));
    3. load(this.getClassLoader().getResourceAsStream(fileName));
    4. load(getServletContext().getResourceAsStream(fileName));
    All of them fail for not finding the file except #4, but that's not the
    optimal solution as it requires a servlet context, which for "genericness of code reasons", I DON'T want to do.
    As an aside, I pulled the "java.class.path" from the System properties to see where it's pointing, and all it has in it is
    "<CATALINA_HOME>\bin\bootstrap.jar" with no other paths included.
    Is there an attribute or something in the server.xml or web.xml file I am forgetting to set, or another approach I should be taking?
    Bob

    See if this code fragment helps.
              String MAIN_FILE_PATH = "./BlueGnome/demos/Properties/DemoPropertiesFile.properties";
              java.net.URL url = ClassLoader.getSystemClassLoader().getResource(MAIN_FILE_PATH);
              System.out.println("PATH: resolved name = " + url);
              // Get the file.
              // We could just use FileInputStream here.  Then we would have
              // to provide a path that was meaningful to the system like
              //     c:\java\BlueGnome\demos\Properties\DemoPropertiesFile.properties
              // Doing it this way allows us to use generic directory
              // seperators and allows for it to search for the file using
              // the CLASSPATH.  That also allows for it to be in a jar file.
              java.io.InputStream is;
              is = ClassLoader.getSystemClassLoader().getResourceAsStream(MAIN_FILE_PATH);
              if (is == null)
                   throw new Exception("Resource File "
                        + MAIN_FILE_PATH + " not found.");
              aProperties.load(is);

  • After Effects warning: Could not create the file '/Users/Library/Preferences/Adobe/After Effects/13.0/dummy

    I have just downloaded the trial After Effects CC. I'm running Mavericks 10.9.4 on my Macbook Pro.
    When I try to launch After Effects, this message appears:
    "After Effects warning: Could not create the file '/Users/Library/Preferences/Adobe/After Effects/13.0/dummy'"
    I have followed the advice from other posts on this issue regarding resetting all of the permissions in the Adobe folder in my library to read and write , but it doesn't change anything. I still get the same message when I try to launch the program. Moreover, there is no After Effects folder in my Adobe folder, even though it's clearly in my Applications folder.
    I also uninstalled After Effects and tried to reinstall it, but to no avail.
    I sure would like to give it a try, as I was planning on purchasing it, but this is just one more issue in a long irritating line of issues that have arisen since trying to download it from CC.
    Any help is much appreciated.
    Thanks.

    I am having this problem and this response does not make sense. I made the "Preferences" ,"Adobe" & "After Effects" folder along with the 10.0,11.0,13.0,13.2 folders all read/write. Can't seem to find an answer.

  • Application specific properties file

    Hello
              Can any body help me how to build application specific properties file
              so that we can have independent application specific server with its own
              java class path environment.I read the procedure in beasys manuals but i
              could'nt understand clearly.
              Setting application-specific properties
              The weblogic.properties file is only accessible by WebLogic; that is,
              you can't add application-specific properties to the weblogic.properties
              file and expect that they will be read at startup time. However, you can
              set properties for your own application by creating a separate
              properties file. This file can be created and used in two ways:
              Put your application-specific properties file in the same directory as
              your weblogic.properties file. You can then use the following code to
              access the properties:
              Properties props = new Properties();
              String propertiesName = "myapp.properties";
              T3ServicesDef services =
              T3Services.getT3Services();
              String location =
              services.config().getProperty("weblogic.system.home") +
              java.io.File.separator + propertiesName;
              props =
              props.load(new DataInputStream(new FileInputStream(location)));
              Thanks in advance
              Ravi
              

    Hi, Ravi.
              I think I am "WeiG".
              Basically, you can not put your own properties on weblogic.properties. Every
              property in weblogic.properties managed by WLAS is pre-registered in WLAS
              internally. WLAS will print "Fund undefined property ...." messages for the
              un-registered property in weblogic.properties files.
              To use your application-specific properties, the paragraph you read suggests
              you create your own file, put it in $WL_HOME, and use the example code to
              read your own file.
              Hope it helps.
              Cheers - Wei
              Ravi <[email protected]> wrote in message
              news:[email protected]...
              > Hi Purdy
              >
              > Who is WeiG,can you tell me please
              >
              > Thanks
              > Ravi
              >
              > Cameron Purdy wrote:
              >
              > > I know that WeiG has answered this before ... try to ask Wei directly.
              > >
              > > --
              > >
              > > Cameron Purdy
              > > http://www.tangosol.com
              > >
              > > "Ravi" <[email protected]> wrote in message
              > > news:[email protected]...
              > > > Hello
              > > >
              > > > Can any body help me how to build application specific properties file
              > > > so that we can have independent application specific server with its
              own
              > > > java class path environment.I read the procedure in beasys manuals but
              i
              > > > could'nt understand clearly.
              > > >
              > > > ************************
              > > > Setting application-specific properties
              > > > The weblogic.properties file is only accessible by WebLogic; that is,
              > > > you can't add application-specific properties to the
              weblogic.properties
              > > > file and expect that they will be read at startup time. However, you
              can
              > > > set properties for your own application by creating a separate
              > > > properties file. This file can be created and used in two ways:
              > > >
              > > > Put your application-specific properties file in the same directory as
              > > > your weblogic.properties file. You can then use the following code to
              > > > access the properties:
              > > >
              > > > Properties props = new Properties();
              > > > String propertiesName = "myapp.properties";
              > > >
              > > > T3ServicesDef services =
              > > > T3Services.getT3Services();
              > > > String location =
              > > > services.config().getProperty("weblogic.system.home") +
              > > > java.io.File.separator + propertiesName;
              > > > props =
              > > > props.load(new DataInputStream(new FileInputStream(location)));
              > > >
              > > > ****************************
              > > >
              > > >
              > > >
              > > >
              > > > Thanks in advance
              > > > Ravi
              > > >
              >
              

  • 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

  • Upgraded To Leopard, lost files & user settings?

    Trying to update from Panther to Leopard on 1.25 Ghz iMac, used the Archive & Install. It looked like a successful install until the very end, whereupon the warning "Installation Failed due to problem migrating user data, try again." Perhaps foolishly, I did try again. This time, no error messages.
    However, upon restart, the "Welcome" screen came up, as though I was a new user or had used the Erase option, which I hadn't. I thought this wasn't right, tried restarting in safe mode. This time, I tried to migrate data from existing volume. It came up with the user name, a good sign I thought. Then, it said that migration had failed, due to a folder buried in iPhoto with too long of a name.
    Thinking I was smart, I started up the computer in target firewire mode, connected to another computer. I found the folder, shortened the name, exited firewire mode and restarted. Also ran Diskwarrior to rebuild directories.
    After restart, migration from "another volume" worked fine, but now no documents folder, empty iPhoto folder, mail lost it's settings, etc. The only thing which remains is the user name.
    I noticed a folder with a lot of .plan files, decided to run the Leopard installer again, thinking that it would use these .plan files to resurrect the missing files/settings. No such luck.
    How can I retrieve the missing settings and files? The disk appears to be fine in disk 1st aid and DiskWarrior.
    Thanks!

    Welcome to the Apple Discussions.
    iLife is not part of the OS. iLife is on the system restore disks that came your Mac. You can restore it using these disks - do a Custom Install.
    Regards
    TD

  • Is this how to use a properties file?

    Hi:
    The following is how I intend to create and read a properties file, please verify for me that the idea is correct.
    1. create myProp.properties
    2. in myProp, the content is like such:
    a=myA
    b=myB
    c=myC
    3. In my application,
      FileInputStream in = new FileInputStream(getClass().getResourceAsStream("/myProp.properties"));
      Properties p = new Properties();
      p.load(in);
      String a = p.getProperty("a");
      String b = p.getProperty("b");
      String c = p.getProperty("c");Thanx!

    It depends on what youare doing but if you have a set of properties that you are going to always use from one running of the application to the next, they should generally be defined as static finals.
    For example, lets say you want a configuration file for an application that holds the user's preferences. You might want something like this:
    public class Preferences {
       private static final String ALWAYS_ON_TOP = "always on top";
       private Properities preferences = new Properties();
       static {
          //load the file
       public boolean setAlwaysOnTop(boolean alwaysOnTop) {
          preferences.put(ALWAYS_ON_TOP, String.valueOf(alwaysOnTop));
       public boolean getAlwaysOnTop() {
          return Boolean.valueOf(preferences.get(ALWAYS_ON_TOP));
       public void save() {
          /save file
    }

  • 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.

  • WDJ - Right click- User settings , not working at all times

    We are working on SAP Netweaver 7.4.
    We have developed WDJ applications in PO server and are displaying the application in SAP EP using the remote iview method.
    Our requirement: We need to show the users , right click ->User settings so that they can modify the view.
    Steps taken: The allowuserpersonalisation has been set to True.
    Issue:
    Not all of the remote WDJ application are showing the User settings.
    For e.g: If it is working for WDJ application A, it is not working for WDJ application B.
    Here is where it gets more confusing !!!:
    If role A contains WDJ application A and role B contains WDJ application B.
    then:
    1) if WDJ application B is assigned to the role A, then the User settings start working for it
    2) if WDJ application A is assigned to the role B, then the User settings still work for it
    3) if WDJ application B is assigned to the role C, then the User settings do not work.
    Can anyone please help?

    Hi,
    normal right mouseclick is disabled as of 710 I guess, I assume you mean the ctrl+alt+right mouse click, right?
    Also , I am not sure I fully understand your A-B-C example. Can you please elaborate it in a less abstract way? Can you show concrete examples what is not working regarding the end-user personalization? Are all wd java applications running in a non-standalone way when you test end-user personalization?
    Cheers,
    Ervin

  • Error reading Properties file

    I have a main method which i am using to call a servlet located in the same Development Component. Until recently i had the servlet location hard coded and it was working without issues. Now i decided to make the location configurable. For this i created an sap.application.global.properties file in the EAR DC which contains the WAR of this DC.
    The contents of the above file are as follows:
    SAP application properties
    SERVLET.LOCATION=http://<server-name>/ControllerServlet/servlet/com.nike.xapps.eqptsp.swem.controller.ControllerServlet
    The code i am using in the main method to call this properties file and access the property is as follows:
    Context ctx = new InitialContext();
    ApplicationConfigHandlerFactory cfgHdlr = (ApplicationConfigHandlerFactory)ctx.lookup("ApplicationConfiguration");          
    Properties props = cfgHdlr.getApplicationProperties();
    String servlet = props.getProperty("SERVLET.LOCATION");
    contained in a try...catch block.
    On dubugging i get a NoInitialContextException repeatedly in the statement where the lookup is performed.
    These are all the additions i have made for reading this properties file. Does anyone know if there is anything more that needs to be done for this to work.
    Thanks,
    Murtaza.

    thank for the help mangst. i guess the IO approach is also applicable ^^; i changed my code to:
    configFile.load( new FileInputStream( ".\\resources\\config.properties" ) );but i had a little trouble in debugging it since it starts the file search from the main project directory. however it works fine upon deployment. ^^; thanks again.
    Edited by: xnofate on Sep 23, 2008 6:21 PM

  • User Settings Not Retained

    Second Admin account with different user name. Set up desktop/user settings etc. Log out and log back in. Hard drive and other icons not on desktop. Dock apps revert to default. Safari history and bookmarks disappeared. Other anomalies.
    ???

    My apologizes on the below post - do you get the same response when you reboot the WLC and hit 'ESC' for additional boot options - and then clear the config this way?

  • Properties file not deploys the path correctly

    Hello,
    I am deploying a Web dynpro application with properties file.
    One of the properties contains a path that I am later using in my app, something like this:
    PATH =
    myserver
    folder1
    folder2
    The problem is that after deployment I see this property in the config tool with one backwards slash like this:
    PATH = \myserver
    older1\folder2\
    And I need it with
    in my app.
    Even after applying a custom value: "
    myserver
    folder1
    folder2
    " and clearing the cache it doesn't seem to work.
    I know that in java \ states that the char afterwards is special so
    realy means \ so I even tried to deploy this : PATH =
    myserver
    folder1
    folder2
    but got the same behaviour.
    Any idea why is this happening?

    Hi,
    Since you have already tried using four slashes and it didnt work.
    I thot putting space in between will give different result.
    For me, the four slash option shud have worked.
    Ashu

  • User Settings Attributes Search

    Hi,
    In SRM 7.0 User Settings I have 2 users and am trying to add a plant. User 1 has company code 0100 and when adding a plant, the drop down search list contains all plants associated with company code 0100. I can successfully add a plant for this user.
    User 2 has company codes 0100, 1000, and 1002. When trying to add a plant, the drop down search list only contains the plants associated with 1000 and 1002. I am unable to locate a plant associated with 0100.
    Their security access is identical. Any suggestion as to what is causing this is appreciated.
    Susan Bennett

    Hi Dhananjay and Bharath,
    You are correct that a plant can only be associated with 1 company code. But our users can create carts for multiple company codes and plants.
    These 2 users are set up identically except for the fact that one only has a single company code set up in User Settings and the other has 3 company codes. Only the plants related to two of the company codes are retrieved when doing a plant search. This prevents adding a plant for the 3rd company code in User Settings.
    I tried looking for an OSS note that might address this, but didn't find anything and thought that the experts out here may have heard of this before and be able to offer some assistance.
    Thank you...Susan

  • Properties file for a servlet at netbeans

    I want to make a servlet to use a properties file. The file name is passed as a initialization parameter. I�m developing with netbeans, where should I put this properties file?
    And if I want to deploy this to an independent tomcat server?
    Thanks in advance,

    It's an arbitrary decision by you where you want to put it. If it contains sensitive data, you should consider putting it outside the web root. (Note that if you do that, JAR/WAR/EAR/ZIP, etc. your application, the properties file won't be implicitly included.)
    This is where the suggestion for JNDI could be useful, because as far as the app is concerned, it doesn't matter where the properties file is physically located.

  • New to the Apple and I want to set up a user account that will not delete the guest users files and allow and preserve their personal settings after log out. Is this possible?

    New to the Apple and I want to set up a user account that will not delete the guest users files and allow and preserve their personal settings after log out. Is this possible?

    The built-in guest user account will not do this. Simply create a new standard account and call it "Guest" or "Guest Users" or whatever you like.
    Go to System Preferences > Users& Groups, click "+" to make a new account.

Maybe you are looking for

  • Firefox url goes grey, and back button no longer works.

    Ok so most annoying problem EVER!! Ok so I have this problem where I will be running firefox, browsing the net, and then all of the sudden the url bar will grey out and only the domain root will be solid. Once it does this, I cannot use the back butt

  • MRP issue for future delivery PO/STO date

    We have a sceanrio where the available material quantity in MRP list is considering future delivery date STO quantity.  The PO delivery date is 08.11.2008 and MRP run date is 07.11.2008. Step 1, material master details: Material = 16814, MRP Type = P

  • Problem with my iMac (lion os x)

    A good day I wonder what's wrong with my computer iMac OS X Lion? Everything is working normally, then suddenly occurs to me that the computer stops responding or freezes me in an instant and no key or anything does not work,unresponsive and appears

  • Recording on DVD - "Unable to recover TOC" error

    Hi all Whenever I try to record on a DVD a face "Unable to recover TOC" I've tried to change the recording speed but no use. When I go to DVD properties and click on enable recording it does not recognize the DVD or any other CD in the drive. Please

  • I am trying to set up rules in iCloud and gmail on my server, does anyone know how?

    I am trying to set up rules in iCloud and gmail on my server, does anyone know how?