Examples of Preferences


Examples of java.util.prefs.Preferences

   public static void main(String[] args) {
      try {
         System.setProperty("java.util.logging.config.file", "testlog.properties");
         LogManager.getLogManager().readConfiguration();

         Preferences prefs = loadArgs(args);
         if (prefs == null)
            return;
         Info info = new Info(prefs);
         DbWatcherTester example = new DbWatcherTester(info);
         example.run();
View Full Code Here

Examples of java.util.prefs.Preferences

    * @param args Command line
    * @return Configuration
    */
   public static Preferences loadArgs(String[] args) {
      try {
         Preferences prefs = Preferences.userRoot();
         prefs.clear();
         // String dbUrl = System.getProperty("db.url", "jdbc:oracle:thin:@localhost:1521:orcl");
         // String dbUser = System.getProperty("db.user", "system");

         String driverClass = System.getProperty("jdbc.drivers", "org.hsqldb.jdbcDriver:oracle.jdbc.driver.OracleDriver:com.microsoft.jdbc.sqlserver.SQLServerDriver:org.postgresql.Driver");
         String dbUrl = System.getProperty("db.url", "jdbc:postgresql:test//localhost/test");
         String dbUser = System.getProperty("db.user", "postgres");
         String dbPassword = System.getProperty("db.password", "");
     
         prefs.put("jdbc.drivers", driverClass);
         prefs.put("db.url", dbUrl);
         prefs.put("db.user", dbUser);
         prefs.put("db.password", dbPassword);

         prefs.put("stress.nmax", System.getProperty("stress.nmax", "1000"));
         prefs.put("stress.sleep", System.getProperty("stress.sleep", "0"));
         prefs.put("stress.compareNmax", System.getProperty("stress.compareNmax", "0"));
         prefs.put("stress.seed", System.getProperty("stress.seed", "0"));
         prefs.put("stress.commitCheck", System.getProperty("stress.commitCheck", "true"));
        
         for (int i=0; i<args.length; i++) {
            if (args[i].startsWith("-h")) {
               usage();
               return null;
            }
            if (i < (args.length-1)) {
               if (args[i].startsWith("-")) {
                  prefs.put(args[i].substring(1), args[++i]);
               }
            }
         }
         prefs.flush();
         return prefs;
      }
      catch (Throwable e) {
         e.printStackTrace();
         log.severe("Problems: " + e.toString());
View Full Code Here

Examples of java.util.prefs.Preferences

    /**
     * Default ctor.
     */
    public TestInfoObjects() {
       super();
       Preferences prefs = Preferences.userRoot();
       this.info = new Info(prefs);
       XMLUnit.setIgnoreWhitespace(true);
    }
View Full Code Here

Examples of java.util.prefs.Preferences

    /**
     * Default ctor.
     */
    public TestRecordParsing() {
       super();
       Preferences prefs = Preferences.userRoot();
       this.info = new Info(prefs);
       XMLUnit.setIgnoreWhitespace(true);
    }
View Full Code Here

Examples of java.util.prefs.Preferences

public class RandomHeadShot extends TagSupport
{
    public int doStartTag() throws JspException
    {
        String ctx = ((HttpServletRequest)(pageContext.getRequest())).getContextPath();
        Preferences prefs = Preferences.systemRoot().node("net/sourceforge/geekblog" + ctx);

        String headshots = prefs.get("weblog.headshotsdir", "images");
        Set headshotsDir = pageContext.getServletContext().getResourcePaths(headshots);
        JspWriter out = pageContext.getOut();

        System.err.println(headshotsDir);
        String[] fileList = (String[]) headshotsDir.toArray(new String[0]);
View Full Code Here

Examples of java.util.prefs.Preferences

      });
      if (pw != null) {
    userName = pw.getUserName();
    password = new String(pw.getPassword());
      } else {
    final Preferences prefs = Preferences.userRoot().node("/java/net/socks");
    try {
        userName =
      (String) AccessController.doPrivileged(
             new java.security.PrivilegedExceptionAction() {
               public Object run() throws IOException {
             return prefs.get("username", null);
               }
           });
    } catch (java.security.PrivilegedActionException pae) {
        throw (IOException) pae.getException();
    }

    if (userName != null) {
        try {
      password =
          (String) AccessController.doPrivileged(
           new java.security.PrivilegedExceptionAction() {
             public Object run() throws IOException {
                 return prefs.get("password", null);
             }
               });
        } catch (java.security.PrivilegedActionException pae) {
      throw (IOException) pae.getException();
        }
View Full Code Here

Examples of java.util.prefs.Preferences

   }


   private void initDlg()
   {
      Preferences userRoot = Preferences.userRoot();
    _dlg.txtFile.setText(userRoot.get(PREF_KEY_CSV_FILE, null));
      _dlg.charsets.setSelectedItem(userRoot.get(PREF_KEY_CSV_ENCODING, Charset.defaultCharset().name()));
      _dlg.chkWithHeaders.setSelected(userRoot.getBoolean(PREF_KEY_WITH_HEADERS, true));


      _dlg.chkSeparatorTab.setSelected(userRoot.getBoolean(PREF_KEY_SEPERATOR_TAB, false));

      if(false == _dlg.chkSeparatorTab.isSelected())
      {
         _dlg.txtSeparatorChar.setText(userRoot.get(PREF_KEY_SEPERATOR_CHAR, ","));
      }

      if(userRoot.getBoolean(PREF_KEY_FORMAT_CSV, true))
      {
         _dlg.radFormatCSV.setSelected(true);
      }
      else if(userRoot.getBoolean(PREF_KEY_FORMAT_XLS, false))
      {
         _dlg.radFormatXLS.setSelected(true);
      }
      else if(userRoot.getBoolean(PREF_KEY_FORMAT_XML, false))
      {
         _dlg.radFormatXML.setSelected(true);
      }
      else
      {
         _dlg.radFormatCSV.setSelected(true);
      }


      onFormat(false);



      if(userRoot.getBoolean(PREF_KEY_EXPORT_COMPLETE, true))
      {
         _dlg.radComplete.setSelected(true);
      }
      else
      {
         _dlg.radSelection.setSelected(true);
      }

      if(userRoot.getBoolean(PREF_KEY_USE_GLOBAL_PREFS_FORMATING, true))
      {
         _dlg.radUseGlobalPrefsFormating.setSelected(true);
      }
      else
      {
         _dlg.radUseDefaultFormating.setSelected(true);
      }


      _dlg.chkExecCommand.setSelected(userRoot.getBoolean(PREF_KEY_EXECUTE_COMMAND, false));
      onChkExecCommand();

      _dlg.txtCommand.setText(userRoot.get(PREF_KEY_COMMAND, "openoffice.org-2.0 -calc %file"));
     
      LineSeparator preferredLineSeparator =
        LineSeparator.valueOf(userRoot.get(PREF_KEY_LINE_SEPERATOR, LineSeparator.DEFAULT.name()));
     
      _dlg._lineSeparators.setSelectedItem(preferredLineSeparator);
   }
View Full Code Here

Examples of java.util.prefs.Preferences


        public LabelPattern getKeyPattern(){

            keyPattern = new LabelPattern(KEY_PATTERN);
            Preferences pre = Preferences.userNodeForPackage
                (net.sf.jabref.labelPattern.LabelPattern.class);
            try {
                String[] keys = pre.keys();
            if (keys.length > 0) for (int i=0; i<keys.length; i++)
                keyPattern.addLabelPattern(keys[i], pre.get(keys[i], null));
            } catch (BackingStoreException ex) {
                Globals.logger("BackingStoreException in JabRefPreferences.getKeyPattern");
            }

            ///
View Full Code Here

Examples of java.util.prefs.Preferences

            LabelPattern parent = pattern.getParent();
            if (parent == null)
                return;

            // Store overridden definitions to Preferences.
            Preferences pre = Preferences.userNodeForPackage
                (net.sf.jabref.labelPattern.LabelPattern.class);
            try {
                pre.clear(); // We remove all old entries.
            } catch (BackingStoreException ex) {
                Globals.logger("BackingStoreException in JabRefPreferences.putKeyPattern");
            }

            for (String s: pattern.keySet()){
                if (!(pattern.get(s)).equals(parent.get(s)))
                    pre.put(s, pattern.getValue(s).get(0).toString());
            }
        }
View Full Code Here

Examples of java.util.prefs.Preferences

         */
        File newPrefDir = new File(ContextHolder.getContext().getConfDirectory(), "prefs");
        PREF = PropertyPreferences.SYSTEM_ROOT;
        try {
            if (!newPrefDir.exists() && Preferences.systemRoot().node("/com").nodeExists("adito")) {
                Preferences from = Preferences.systemRoot().node("/com/adito");
                log.warn("Migrating preferences");
                try {
                    copyNode(from.node("core"), PREF.node("core"));
                    from.node("core").removeNode();
                    copyNode(from.node("plugin"), PREF.node("plugin"));
                    from.node("plugin").removeNode();
                    copyNode(from.node("extensions"), PREF.node("extensions"));
                    from.node("extensions").removeNode();
                    copyNode(from.node("dbupgrader"), PREF.node("dbupgrader"));
                    from.node("dbupgrader").removeNode();
                } catch (Exception e) {
                    log.error("Failed to migrate preferences.", e);
                }
                try {
                    from.flush();
                } catch (BackingStoreException bse) {
                    log.error("Failed to flush old preferences");
                }
                try {
                    PREF.flush();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.