Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2002-2020 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package org.neo4j.commandline.dbms;
import picocli.CommandLine;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;
import org.neo4j.cli.AbstractCommand;
import org.neo4j.cli.CommandFailedException;
import org.neo4j.cli.Converters.DatabaseNameConverter;
import org.neo4j.cli.ExecutionContext;
import org.neo4j.commandline.dbms.storeutil.StoreCopy;
import org.neo4j.commandline.dbms.storeutil.StoreCopy.FormatEnum;
import org.neo4j.configuration.Config;
import org.neo4j.configuration.ConfigUtils;
import org.neo4j.configuration.GraphDatabaseSettings;
import org.neo4j.configuration.helpers.NormalizedDatabaseName;
import org.neo4j.io.layout.DatabaseLayout;
import org.neo4j.io.layout.Neo4jLayout;
import org.neo4j.kernel.impl.transaction.log.files.TransactionLogFilesHelper;
import org.neo4j.kernel.impl.util.Validators;
import org.neo4j.kernel.internal.locker.FileLockException;
import static java.lang.String.format;
import static org.neo4j.configuration.GraphDatabaseSettings.databases_root_path;
import static org.neo4j.configuration.GraphDatabaseSettings.default_database;
import static org.neo4j.configuration.GraphDatabaseSettings.neo4j_home;
import static org.neo4j.configuration.GraphDatabaseSettings.transaction_logs_root_path;
import static org.neo4j.internal.helpers.Strings.joinAsLines;
import static org.neo4j.internal.helpers.collection.Iterables.stream;
import static org.neo4j.kernel.impl.store.format.RecordFormatSelector.allFormats;
import static org.neo4j.kernel.recovery.Recovery.isRecoveryRequired;
import static picocli.CommandLine.ArgGroup;
import static picocli.CommandLine.Command;
import static picocli.CommandLine.Help.Visibility.NEVER;
import static picocli.CommandLine.Option;
@Command(
name = "copy",
header = "Copy a database and optionally apply filters.",
description = "This command will create a copy of a database."
)
public class StoreCopyCommand extends AbstractCommand
{
@ArgGroup( multiplicity = "1" )
private SourceOption source = new SourceOption();
private static class SourceOption
{
@Option( names = "--from-database", description = "Name of database to copy from.", required = true, converter = DatabaseNameConverter.class )
private NormalizedDatabaseName database;
@Option( names = "--from-path", description = "Path to the database to copy from.", required = true )
private Path path;
}
@Option(
names = "--from-path-tx",
description = "Path to the transaction files, if they are not in the same folder as '--from-path'.",
paramLabel = ""
)
private Path sourceTxLogs;
@Option( names = "--to-database", description = "Name of database to copy to.", required = true, converter = DatabaseNameConverter.class )
private NormalizedDatabaseName database;
// --force
@Option( names = "--force", description = "Force the command to run even if the integrity of the database can not be verified." )
private boolean force;
@Option(
completionCandidates = StoreFormatCandidates.class,
names = "--to-format",
defaultValue = "same",
converter = FormatNameConverter.class,
description = "Set the format for the new database. Must be one of ${COMPLETION-CANDIDATES}. 'same' will use the same format as the source. " +
"WARNING: 'high_limit' format is only available in enterprise edition. If you go from 'high_limit' to 'standard' there is " +
"no validation that the data will actually fit."
)
private FormatEnum format;
@Option(
names = "--delete-nodes-with-labels",
description = "A comma separated list of labels. All nodes that have ANY of the specified labels will be deleted.",
split = ",",
paramLabel = "