Example usage for org.apache.cassandra.io.util FileUtils deleteRecursive

List of usage examples for org.apache.cassandra.io.util FileUtils deleteRecursive

Introduction

In this page you can find the example usage for org.apache.cassandra.io.util FileUtils deleteRecursive.

Prototype

public static void deleteRecursive(File dir) 

Source Link

Document

Deletes all files and subdirectories under "dir".

Usage

From source file:com.btoddb.flume.sinks.cassandra.EmbeddedServerHelper.java

License:Apache License

private static void rmdir(String dir) throws IOException {
    File dirFile = new File(dir);
    if (dirFile.exists()) {
        FileUtils.deleteRecursive(new File(dir));
    }/*w w  w  .  j  a va  2s  .  c  om*/
}

From source file:com.btoddb.flume.sinks.cassandra.EmbeddedServerHelper.java

License:Apache License

public static void cleanup() throws IOException {
    // clean up commitlog
    String[] directoryNames = { DatabaseDescriptor.getCommitLogLocation(), };
    for (String dirName : directoryNames) {
        File dir = new File(dirName);
        if (!dir.exists())
            throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
        FileUtils.deleteRecursive(dir);
    }//from w  w  w. j av a 2  s  .co m

    // clean up data directory which are stored as data directory/table/data files
    for (String dirName : DatabaseDescriptor.getAllDataFileLocations()) {
        File dir = new File(dirName);
        if (!dir.exists())
            throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
        FileUtils.deleteRecursive(dir);
    }
}

From source file:com.dell.doradus.olap.io.FileIO.java

License:Apache License

@Override
public void deleteCF(String name) {
    File dir = new File(main.getAbsoluteFile() + "/" + name);
    if (dir.exists())
        FileUtils.deleteRecursive(dir);
}

From source file:com.dell.doradus.olap.io.FileIO.java

License:Apache License

@Override
public void delete(String columnFamily, String sKey, String columnName) {
    if (columnName == null) {
        File dir = new File(main.getAbsoluteFile() + "/" + columnFamily + "/" + sKey);
        if (dir.exists())
            FileUtils.deleteRecursive(dir);
    } else {//from   ww  w.j a v a  2 s.  co  m
        File file = new File(
                main.getAbsoluteFile() + "/" + columnFamily + "/" + sKey + "/" + columnName.replace('/', '@'));
        if (file.exists())
            file.delete();
    }
}

From source file:com.isthari.spring.cloud.config.cassandra.CassandraServiceDataCleaner.java

License:Apache License

/**
 * Removes all directory content from the file system
 *
 * @param dir//from   w w  w  .  j  ava 2 s.co  m
 * @throws IOException
 */
private void cleanDir(String dir) throws IOException {
    File dirFile = new File(dir);
    if (dirFile.exists() && dirFile.isDirectory()) {
        for (File f : dirFile.listFiles()) {
            FileUtils.deleteRecursive(f);
        }
    }
}

From source file:com.springsource.insight.plugin.cassandra.embeded.EmbeddedCassandraService.java

License:Open Source License

/**
 * Removes all directory content from file the system
 *
 * @param dir//w w w  .  j  a  v a2  s.c o  m
 * @throws IOException
 */
private void cleanDir(String dir) throws IOException {
    File dirFile = new File(dir);
    if (dirFile.exists() && dirFile.isDirectory()) {
        FileUtils.deleteRecursive(dirFile);
    }
}

From source file:com.stratio.cassandra.index.LuceneIndex.java

License:Apache License

/**
 * Closes the index and removes all its files.
 */
public void drop() {
    Log.info("Removing");
    close();
    FileUtils.deleteRecursive(file);
}

From source file:com.stratio.cassandra.lucene.index.FSIndex.java

License:Apache License

/**
 * Closes the index and removes all its files.
 *///from  w  w  w  .  ja  va 2 s. c  o m
public void delete() {
    try {
        close();
    } catch (Exception e) {
        throw new IndexException(logger, e, "Error deleting %s", name);
    } finally {
        FileUtils.deleteRecursive(path.toFile());
    }
    logger.info("Deleted {}", name);
}

From source file:com.stratio.cassandra.lucene.service.LuceneIndex.java

License:Apache License

/**
 * Closes the index and removes all its files.
 *
 * @throws IOException If Lucene throws IO errors.
 *///www  .  j  a va  2s .  com
public void delete() throws IOException {
    close();
    FileUtils.deleteRecursive(path.toFile());
    Log.info("%s removed", logName);
}

From source file:com.stratio.decision.unit.engine.action.CassandraServer.java

License:Apache License

private static void cleanup() throws IOException {

    // clean up commitlog
    String[] directoryNames = { DatabaseDescriptor.getCommitLogLocation(), };
    for (String dirName : directoryNames) {
        File dir = new File(dirName);
        if (!dir.exists()) {
            log.error("No such directory: " + dir.getAbsolutePath());
            throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
        }/*  w  w  w .  j  ava2s . c o m*/
        FileUtils.deleteRecursive(dir);
    }

    // clean up data directory which are stored as data directory/table/data
    // files
    for (String dirName : DatabaseDescriptor.getAllDataFileLocations()) {
        File dir = new File(dirName);
        if (!dir.exists()) {
            log.error("No such directory: " + dir.getAbsolutePath());
            throw new RuntimeException("No such directory: " + dir.getAbsolutePath());
        }
        FileUtils.deleteRecursive(dir);
    }
}