Examples of Preferences


Examples of java.util.prefs.Preferences

    // Set the starting report directory (null is default home directory)
    // Store the report directory in the preferences for this package
    if (jfc != null) {
        if (key == null || key.trim().equals(""))
            key="reportDir";
        Preferences prefs = Preferences.userRoot().node("/jimm/datavision");
        String dir = prefs.get(key,null);
        if (dir != null)
            jfc.setCurrentDirectory(new File(dir));
    }
}
View Full Code Here

Examples of java.util.prefs.Preferences

    if (jfc != null) {
        if (key == null || key.trim().equals(""))
            key="reportDir";
        String selectedFile = jfc.getSelectedFile().getPath();
        if (selectedFile != null) {
            Preferences prefs = Preferences.userRoot().node("/jimm/datavision");
            String dir = prefs.get(key,null);
            // If the file path has changed then store it in the
            // preferences
            String jfcap=jfc.getSelectedFile().getAbsolutePath();
            if (jfcap != null) {
                File f=new File(jfcap);
                String newdir=f.getParent();
                if (newdir == null)
                    newdir=dir;
                if (newdir != null) {
                    boolean changed=true;
                    if (dir != null && newdir.compareTo(dir) == 0)
                        changed=false;
                    if (changed)
                        prefs.put(key,newdir);
                }
            }
        }
    }
}
View Full Code Here

Examples of java.util.prefs.Preferences

    }

    try
    {
      final Enumeration keys = config.getConfigProperties();
      final Preferences pref = base.node(configPath);
      pref.clear();
      while (keys.hasMoreElements())
      {
        final String key = (String) keys.nextElement();
        final String value = config.getConfigProperty(key);
        if (value != null)
        {
          pref.put(key, value);
        }
      }
      pref.sync();
    }
    catch (BackingStoreException be)
    {
      throw new ConfigStoreException("Failed to store config" + configPath, be);
    }
View Full Code Here

Examples of java.util.prefs.Preferences

    }

    try
    {
      final Properties props = new Properties();
      final Preferences pref = base.node(configPath);
      final String[] keysArray = pref.keys();
      for (int i = 0; i < keysArray.length; i++)
      {
        final String key = keysArray[i];
        final String value = pref.get(key, null);
        if (value != null)
        {
          props.setProperty(key, value);
        }
      }
View Full Code Here

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);
        
         DbWriterExample example = new DbWriterExample();
         example.pollingExample(prefs);
      }
      catch (Throwable e) {
View Full Code Here

Examples of java.util.prefs.Preferences

    */
   public static Preferences loadArgs(String[] args) {
      try {
         // user: See $HOME/.java/.userPrefs
         // root: See /opt/j2sdk1.4.2_06/jre/.systemPrefs/prefs.xml
         Preferences prefs = Preferences.userRoot();
         prefs.clear();

         // ---- Database settings -----
         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:oracle:thin:@localhost:1521:orcl");
         String dbUrl = System.getProperty("db.url", "jdbc:postgresql:test//localhost/test");
         // String dbUser = System.getProperty("db.user", "system");
         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);

         // ---- Mom settings -----
         /*
         prefs.put("mom.connectQos",
                     "<qos>" +
                     " <securityService type='htpasswd' version='1.0'>" +
                     "   <![CDATA[" +
                     "   <user>michele</user>" +
                     "   <passwd>secret</passwd>" +
                     "   ]]>" +
                     " </securityService>" +
                     " <session name='joe/3'/>'" +
                     " <address type='SOCKET'>" +
                     "   socket://192.168.110.10:7607" +
                     " </address>" +
                     " </qos>");
         System.setProperty("protocol", "SOCKET");
         System.setProperty("protocol/socket/hostname", "192.168.110.10");
        
         */

         // ----- Other DbWriter settings -----
         // prefs.put("mom.subscribeKey", "<key oid='' queryType='XPATH'>//key</key>");
         String subscribeKey = System.getProperty("mom.subscribeKey", "<key oid='transaction'/>");
         prefs.put("mom.subscribeKey", subscribeKey);
        
         prefs.put("mom.subscribeQos", "<qos><initialUpdate>false</initialUpdate><multiSubscribe>false</multiSubscribe><persistent>true</persistent></qos>");
         prefs.put("dbWriter.writer.class", "org.xmlBlaster.contrib.replication.ReplicationWriter");
        
         setPref("example.sleep", "0L", prefs);
         // setPref("pingInterval", "10000L", prefs);
         // setPref("retries", ".-1", prefs);
         // setPref("delay", ".4000", prefs);
         setPref("dispatch/callback/retries", ".-1", prefs);
         setPref("dispatch/callback/delay", ".10000", prefs);
         setPref("queue/callback/maxEntries", "10000", prefs);
        
         for (int i=0; i<args.length-1; i++) {
            if (args[i].startsWith("-")) {
               prefs.put(args[i].substring(1), args[++i]);
            }
         }
         prefs.flush();

         // Log output:
         //prefs.exportSubtree(System.out);
         return prefs;
      }
View Full Code Here

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);
         StressGenerator example = new StressGenerator(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

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

         Preferences prefs = loadArgs(args);
        
         Example example = new Example();
         example.pollingExample(prefs);
      }
      catch (Throwable e) {
View Full Code Here

Examples of java.util.prefs.Preferences

    */
   public static Preferences loadArgs(String[] args) {
      try {
         // user: See $HOME/.java/.userPrefs
         // root: See /opt/j2sdk1.4.2_06/jre/.systemPrefs/prefs.xml
         Preferences prefs = Preferences.userRoot();
         prefs.clear();

         // ---- Database settings -----
         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:oracle:thin:@localhost:1521:orcl");
         String dbUser = System.getProperty("db.user", "system");
         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);

         // ---- Mom settings -----
         /*
         prefs.put("mom.connectQos",
                     "<qos>" +
                     " <securityService type='htpasswd' version='1.0'>" +
                     "   <![CDATA[" +
                     "   <user>michele</user>" +
                     "   <passwd>secret</passwd>" +
                     "   ]]>" +
                     " </securityService>" +
                     " <session name='joe/3'/>'" +
                     " <address type='SOCKET'>" +
                     "   socket://192.168.110.10:7607" +
                     " </address>" +
                     " </qos>");
         System.setProperty("protocol", "SOCKET");
         System.setProperty("protocol/socket/hostname", "192.168.110.10");
         */

         // ----- Other DbWatcher settings -----
         prefs.put("alertScheduler.pollInterval", "0"); // 0: No polling, is triggered for example by MoM
         prefs.put("changeDetector.groupColName", "CAR");
         prefs.put("changeDetector.detectStatement", "SELECT MAX(TO_CHAR(TS, 'YYYY-MM-DD HH24:MI:SSXFF')) from TEST_POLL");
         prefs.put("db.queryMeatStatement", "SELECT * FROM TEST_POLL WHERE TO_CHAR(TS, 'YYYY-MM-DD HH24:MI:SSXFF') > '${oldTimestamp}' ORDER BY CAR");
         prefs.put("mom.topicName", "db.change.${colGroupValue}");
         prefs.put("mom.alertSubscribeKey", "<key oid='db.notification'/>");
         prefs.put("changeDetector.class", "org.xmlBlaster.contrib.dbwatcher.detector.TimestampChangeDetector");

         for (int i=0; i<args.length-1; i++) {
            if (args[i].startsWith("-")) {
               prefs.put(args[i].substring(1), args[++i]);
            }
         }
         prefs.flush();

         // Log output:
         //prefs.exportSubtree(System.out);
         return prefs;
      }
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.