use of org.neo4j.causalclustering.core.state.ClusterStateDirectory in project neo4j by neo4j.
the class UnbindFromClusterCommandTest method createClusterStateDir.
private File createClusterStateDir(FileSystemAbstraction fs) throws ClusterStateException {
File dataDir = new File(homeDir.toFile(), "data");
ClusterStateDirectory clusterStateDirectory = new ClusterStateDirectory(dataDir, false);
clusterStateDirectory.initialize(fs);
return clusterStateDirectory.get();
}
use of org.neo4j.causalclustering.core.state.ClusterStateDirectory in project neo4j by neo4j.
the class UnbindFromClusterCommand method execute.
@Override
public void execute(String[] args) throws IncorrectUsage, CommandFailed {
try {
Config config = loadNeo4jConfig(homeDir, configDir, arguments.parse("database", args));
File dataDirectory = config.get(DatabaseManagementSystemSettings.data_directory);
Path pathToSpecificDatabase = config.get(DatabaseManagementSystemSettings.database_path).toPath();
Validators.CONTAINS_EXISTING_DATABASE.validate(pathToSpecificDatabase.toFile());
confirmTargetDirectoryIsWritable(pathToSpecificDatabase);
ClusterStateDirectory clusterStateDirectory = new ClusterStateDirectory(dataDirectory);
clusterStateDirectory.initialize(outsideWorld.fileSystem());
deleteClusterStateIn(clusterStateDirectory.get().toPath());
} catch (StoreLockException e) {
throw new CommandFailed("Database is currently locked. Please shutdown Neo4j.", e);
} catch (IllegalArgumentException e) {
throw new IncorrectUsage(e.getMessage());
} catch (UnbindFailureException | CannotWriteException | IOException | ClusterStateException e) {
throw new CommandFailed(e.getMessage(), e);
}
}
Aggregations