Creates a backup of this index for optimized re-indexing of the whole content.<p>

@return the path to the backup folder, or <code>null</code> in case no backup was created
10408
protected String createIndexBackup() {

        if (!isBackupReindexing()) {
            // if no backup is generated we don't need to do anything
            return null;
        }

        // check if the target directory already exists
        File file = new File(getPath());
        if (!file.exists()) {
            // index does not exist yet, so we can't backup it
            return null;
        }
        String backupPath = getPath() + "_backup";
        FSDirectory oldDir = null;
        FSDirectory newDir = null;
        try {
            // open file directory for Lucene
            oldDir = FSDirectory.open(file.toPath());
            newDir = FSDirectory.open(Paths.get(backupPath));
            for (String fileName : oldDir.listAll()) {
                newDir.copyFrom(oldDir, fileName, fileName, IOContext.DEFAULT);
            }
        } catch (Exception e) {
            LOG.error(
                Messages.get().getBundle().key(Messages.LOG_IO_INDEX_BACKUP_CREATE_3, getName(), getPath(), backupPath),
                e);
            backupPath = null;
        } finally {
            if (oldDir != null) {
                try {
                    oldDir.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            if (newDir != null) {
                try {
                    newDir.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return backupPath;
    }
862285
public String getPath() {

        // ensure the export file name ends with ".zip" in case of ZIP file export
        if ((m_path != null) && !isExportAsFiles() && !m_path.toLowerCase().endsWith(".zip")) {
            m_path += ".zip";
        }
        return m_path;
    }
829093
public SimpleDependencyPath copy() {
        SimpleDependencyPath copy = new SimpleDependencyPath();
        copy.path.addAll(path);
        copy.nodes.addAll(nodes);
        return copy;
    }
564310
public com.google.protobuf.ByteString
      getBackupUriBytes() {
    java.lang.Object ref = backupUri_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      backupUri_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
97794
public File getBackTop() {
        if (getArguments().containsKey(KEY_START_PATH)) {
            String keyStartPath = getArguments().getString(KEY_START_PATH);

            if (keyStartPath == null)
                return new File("/");

            return getPath(keyStartPath);
        } else {
            return new File("/");
        }
    }
839002
@Nullable
    public final File getCanonicalDir() {
        final String dir = getDirectory();
        if (dir == null) {
            return null;
        }
        try {
            return new File(dir).getCanonicalFile();
        } catch (final IOException ex) {
            throw new RuntimeException("Couldn't determine canonical file: " + dir, ex);
        }
    }
367432
@Override
  public String getHomeDirectory() {
    try {
      FileSystem fs = FileSystem.get(CONF);
      return fs.getHomeDirectory().toString();
    }
    catch (Exception e) {
      return null;
    }
  }
374024
public static File checkFolderPath(final String path, final boolean create) {
		final File file = new File(path);
		if (!file.exists()) {
			if (create) {
				file.mkdir();
			}
			return null;
		}
		return file;
	}
765943
@Override
    public Path getFileName() {
        // Root and empty String has no file name
        if (path.length() == 0 || path.equals(ArchivePaths.root().get())) {
            return null;
        } else {
            final List<String> tokens = tokenize(this);
            // Furthest out
            final Path fileName = new ShrinkWrapPath(tokens.get(tokens.size() - 1), this.fileSystem);
            return fileName;
        }
    }
785278
public static sdx_backup_restore backup(nitro_service client) throws Exception
	{
		sdx_backup_restore resource = new sdx_backup_restore();
		return ((sdx_backup_restore[]) resource.perform_operation(client, "backup"))[0];
	}
1252996
@SuppressWarnings("deprecation")
    public CmsResource createFolder(String targetFolder, String folderName) throws Exception {

        if (m_cms.existsResource(targetFolder + folderName)) {
            m_shell.getOut().println(
                getMessages().key(Messages.GUI_SHELL_FOLDER_ALREADY_EXISTS_1, targetFolder + folderName));
            return null;
        }
        return m_cms.createResource(targetFolder + folderName, CmsResourceTypeFolder.getStaticTypeId());
    }
152611
public File getBackupFile(String path) {

		String rootDir = tempDir + JawrConstant.SPRITE_BACKUP_GENERATED_CSS_DIR;
		String fPath = null;
		if (jawrConfig.isWorkingDirectoryInWebApp()) {
			fPath = jawrConfig.getContext().getRealPath(rootDir + getCssPath(path));
		} else {
			fPath = rootDir + getCssPath(path);
		}

		return new File(fPath);
	}
117961
public static FileSystemLayout create() {

        String userDir = System.getProperty(USER_DIR);
        if (null == userDir) {
            throw SwarmMessages.MESSAGES.systemPropertyNotFound(USER_DIR);
        }

        return create(userDir);
    }
342581
@Override
    public boolean isDirectory() {
        final ArchivePath archivePath = ArchivePaths.create(path.toString());
        Node node = archive.get(archivePath);
        return node.getAsset() == null;
    }
121323
public Path getFileOutputPath() {

		// TODO: This is a quick workaround, problem can be solved in a more generic way
		final Configuration conf = getEnvironment().getTaskConfiguration();

		final String outputPath = conf.getString("outputPath", null);

		if (outputPath != null) {
			return new Path(outputPath);
		}

		return null;
	}
223784
private File getIndexDirectory()
    {
        File file = new File(luceneDirPath);

        if (!file.isDirectory())
        {
            file.mkdir();
        }
        return file;
    }
745896
public static JarPath create(PathImpl backing)
  {
    backing = backing.unwrap();
    
    if (backing instanceof JarPath) {
      return (JarPath) backing;
    }
    
    JarPath path = _jarCache.get(backing);

    if (path == null) {
      path = new JarPath(null, "/", "/", backing);
      _jarCache.put(backing, path);
    }

    return path;
  }