示例#1
0
 public void run() {
   // Do a flush at the beginning, just in case stuff has been
   // building up.
   try {
     doFlush();
   } catch (Exception e1) {
     // Don't care, all these can fail, we'll just keep trying.
   }
   for (; ; ) {
     try {
       PhotoConfig p = new PhotoConfig();
       int m = Integer.valueOf(p.get("storer_sleep")).intValue();
       // Check every x minutes
       sleep(m * 60 * 1000);
     } catch (Exception e) {
     } finally {
       doFlush();
     }
   }
 }
示例#2
0
  public static void main(String args[]) {
    try {
      BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
      PhotoConfig config = new PhotoConfig();
      PhotoSecurity security = new PhotoSecurity();

      String user = null;
      if (args.length < 1) {
        System.out.print("Enter username:  "******"Enter password:  "******"New password is " + newpw);

      Class.forName(config.get("dbDriverName"));
      Connection db =
          DriverManager.getConnection(
              config.get("dbSource"), config.get("dbUser"), config.get("dbPass"));
      String query =
          "update wwwusers set password='******'\n" + "\twhere username='******'";
      Statement st = db.createStatement();
      st.executeUpdate(query);
    } catch (Exception e) {
      System.out.println(e);
      e.printStackTrace();
    }
  }
示例#3
0
 // Get a DB connection from the storer pool.
 // We need a different log file to get the thing to work at all.
 protected SpyDB getDB() {
   PhotoConfig conf = new PhotoConfig();
   conf.put("dbcbLogFilePath", "/tmp/storer_db.log");
   SpyDB pdb = new SpyDB(conf);
   return (pdb);
 }