public void upgrade() throws Exception {
  if (!checkUpgradePreconditions()) {
    return;
  }
  backupManager.createOpenDJBackup();
  try (BufferedWriter out=new BufferedWriter(new FileWriter(upgradeMarker))){
    out.write(currentVersion.toString());
    out.write('\n');
  }
   if (currentVersion.isOlderThan(DJ_245_VERSION)) {
    backupFile("config/config.ldif");
    backupFile("config/admin-backend.ldif");
    backupFile("config/java.properties");
    unpackZipFile(true);
    callOldDJUpgrade();
  }
 else {
    unpackZipFile(false);
    if (currentVersion.equals(DJ_246_VERSION)) {
      try {
        File badSchema=new File(installRoot + File.separator + "config"+ File.separator+ "schema"+ File.separator+ "cts-add-schema.ldif");
        delete(badSchema);
      }
 catch (      RuntimeException e) {
      }
      File goodSchema=new File(servletCtx.getRealPath(File.separator + "WEB-INF" + File.separator+ "template"+ File.separator+ "ldif"+ File.separator+ "sfha"+ File.separator+ "99-cts-add-schema-backport.ldif"));
      File moveTo=new File(installRoot + File.separator + "config"+ File.separator+ "schema"+ File.separator+ "99-cts-add-schema-backport.ldif");
      copy(goodSchema.toPath(),moveTo.toPath());
    }
    int ret=callDJUpgradeMechanism();
    if (ret == 0) {
      message("Upgrade completed successfully");
      delete(upgradeMarker);
      final String lockFile=LockFileManager.getServerLockFileName();
      LockFileManager.releaseLock(lockFile,new StringBuilder());
    }
 else {
      throw new UpgradeException("OpenDJ upgrade failed with code:  " + ret);
    }
  }
}

public void upgrade ( ) throws Exception { if ( ! checkUpgradePreconditions ( ) ) { return ; } backupManager . createOpenDJBackup ( ) ; try ( BufferedWriter out = new BufferedWriter ( new FileWriter ( upgradeMarker ) ) ) { out . write ( currentVersion . toString ( ) ) ; out . write ( '\n' ) ; } if ( currentVersion . isOlderThan ( DJ_245_VERSION ) ) { backupFile ( "config/config.ldif" ) ; backupFile ( "config/admin-backend.ldif" ) ; backupFile ( "config/java.properties" ) ; unpackZipFile ( true ) ; callOldDJUpgrade ( ) ; } else { unpackZipFile ( false ) ; if ( currentVersion . equals ( DJ_246_VERSION ) ) { try { File badSchema = new File ( installRoot + File . separator + "config" + File . separator + "schema" + File . separator + "cts-add-schema.ldif" ) ; delete ( badSchema ) ; } catch ( RuntimeException e ) { } File goodSchema = new File ( servletCtx . getRealPath ( File . separator + "WEB-INF" + File . separator + "template" + File . separator + "ldif" + File . separator + "sfha" + File . separator + "99-cts-add-schema-backport.ldif" ) ) ; File moveTo = new File ( installRoot + File . separator + "config" + File . separator + "schema" + File . separator + "99-cts-add-schema-backport.ldif" ) ; copy ( goodSchema . toPath ( ) , moveTo . toPath ( ) ) ; } int ret = callDJUpgradeMechanism ( ) ; if ( ret == 0 ) { message ( "Upgrade completed successfully" ) ; delete ( upgradeMarker ) ; final String lockFile = LockFileManager . getServerLockFileName ( ) ; LockFileManager . releaseLock ( lockFile , new StringBuilder ( ) ) ; } else { throw new UpgradeException ( "OpenDJ upgrade failed with code:  " + ret ) ; } } }
upgrades the embedded ds instance to opendj 2 . 6 see the class description for more detailed information .
