Package java.util.prefs

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


   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

    * @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

   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

    */
   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

   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

    * @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

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

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

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

TOP

Related Classes of java.util.prefs.Preferences

Copyright © 2018 www.massapicom. 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.