コード例 #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void execute(String[] incomingArguments) throws org.neo4j.commandline.admin.IncorrectUsage, org.neo4j.commandline.admin.CommandFailed
        public override void Execute(string[] incomingArguments)
        {
            string databaseName;
            string fromPath;
            bool   forceOverwrite;

            try
            {
                databaseName   = _arguments.parse(incomingArguments).get(ARG_DATABASE);
                fromPath       = _arguments.get("from");
                forceOverwrite = _arguments.getBoolean("force");
            }
            catch (System.ArgumentException e)
            {
                throw new IncorrectUsage(e.Message);
            }

            Config config = LoadNeo4jConfig(_homeDir, _configDir, databaseName);

            try
            {
                using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction())
                {
                    RestoreDatabaseCommand restoreDatabaseCommand = new RestoreDatabaseCommand(fileSystem, new File(fromPath), config, databaseName, forceOverwrite);
                    restoreDatabaseCommand.Execute();
                }
            }
            catch (IOException e)
            {
                throw new CommandFailed("Failed to restore database", e);
            }
        }
コード例 #2
0
ファイル: LoadCommand.cs プロジェクト: Neo4Net/Neo4Net
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void execute(String[] args) throws org.neo4j.commandline.admin.IncorrectUsage, org.neo4j.commandline.admin.CommandFailed
        public override void Execute(string[] args)
        {
            _arguments.parse(args);
            Path   archive  = _arguments.getMandatoryPath("from");
            string database = _arguments.get(ARG_DATABASE);
            bool   force    = _arguments.getBoolean("force");

            Config config = BuildConfig(database);

            Path databaseDirectory        = canonicalPath(GetDatabaseDirectory(config));
            Path transactionLogsDirectory = canonicalPath(GetTransactionalLogsDirectory(config));

            DeleteIfNecessary(databaseDirectory, transactionLogsDirectory, force);
            Load(archive, database, databaseDirectory, transactionLogsDirectory);
        }