Package com.db4o.ext

Examples of com.db4o.ext.ExtObjectContainer


   * session ref bound to it.
   * @param oc the session ref to the target db to clear
   */
  private static void clearDb4oDb(ObjectContainer oc) {
    if(oc == null) return;
    final ExtObjectContainer s = oc.ext();
    final ReflectClass[] rcs = s.knownClasses();
    if(rcs != null) {
      for(final ReflectClass rc : rcs) {
        if(rc.getDelegate() instanceof JdkClass) {
          final Class<?> objType = ((JdkClass) rc.getDelegate()).getJavaClass();
          final String cn = objType.getName();
          if(cn.indexOf("com.db4o") < 0 && objType != Object.class && cn.indexOf("java") < 0) {
            final Collection<?> clc = s.query(objType);
            if(clc != null) {
              for(final Object o : clc) {
                log.debug("Removing object: " + o);
                s.delete(o);
              }
            }
          }
        }
      }
      s.purge();
    }
  }
View Full Code Here


      String backupFileName = DB_FOLDER_NAME + File.separator +
        DATE_FORMATTER.format(System.currentTimeMillis()) + "_" + DB_FILE_NAME + ".bak";
     
      removeObsoleteBackupFiles(DB_FOLDER_NAME);
      try {
        ExtObjectContainer extDb = db.ext();
        if (!extDb.isClosed()) {
          extDb.backup(backupFileName);
          logger.debug("successfully created new DB4O backup '{}' in {}ms", backupFileName, System.currentTimeMillis() - startTime);
        } else {
          logger.debug("couldn't create DB4O backup '{}' because db is closed", backupFileName);
        }
      } catch(Db4oException e) {
View Full Code Here

TOP

Related Classes of com.db4o.ext.ExtObjectContainer

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.