class DumpCommand implements AdminCommand {

    @Override
    public void execute( String[] args ) throws IncorrectUsage, CommandFailed
    {
        String database = arguments.parse( args ).get( ARG_DATABASE );
        Path archive = calculateArchive( database, arguments.getMandatoryPath( "to" ) );

        Config config = buildConfig( database );
        Path databaseDirectory = canonicalPath( getDatabaseDirectory( config ) );
        DatabaseLayout databaseLayout = DatabaseLayout.of( databaseDirectory.toFile() );
        Path transactionLogsDirectory = canonicalPath( getTransactionalLogsDirectory( config ) );

        try
        {
            Validators.CONTAINS_EXISTING_DATABASE.validate( databaseLayout.databaseDirectory() );
        }
        catch ( IllegalArgumentException e )
        {
            throw new CommandFailed( "database does not exist: " + database, e );
        }

        try ( Closeable ignored = StoreLockChecker.check( databaseLayout.getStoreLayout() ) )
        {
            checkDbState( databaseLayout, config );
            dump( database, databaseLayout, transactionLogsDirectory, archive );
        }
        catch ( StoreLockException e )
        {
            throw new CommandFailed( "the database is in use -- stop Neo4j and try again", e );
        }
        catch ( IOException e )
        {
            wrapIOException( e );
        }
        catch ( CannotWriteException e )
        {
            throw new CommandFailed( "you do not have permission to dump the database -- is Neo4j running as a different user?", e );
        }
    }

    public  DumpCommand( Path homeDir, Path configDir, Dumper dumper, PrintStream output );

}