Example usage for io.vertx.core.file FileSystem mkdirsBlocking

List of usage examples for io.vertx.core.file FileSystem mkdirsBlocking

Introduction

In this page you can find the example usage for io.vertx.core.file FileSystem mkdirsBlocking.

Prototype

@Fluent
FileSystem mkdirsBlocking(String path);

Source Link

Document

Blocking version of #mkdirs(String,Handler)

Usage

From source file:de.braintags.netrelay.controller.persistence.InsertAction.java

License:Open Source License

private String[] examineNewDestination(FileSystem fs, FileUpload upload) {
    if (upload.fileName() == null || upload.fileName().hashCode() == 0) {
        throw new FileNameException("The upload contains no filename");
    }//from   w  w  w. j  ava  2s  .  c  o  m
    String[] destinations = new String[2];
    String upDir = getPersistenceController().readProperty(PersistenceController.UPLOAD_DIRECTORY_PROP, null,
            true);
    if (!fs.existsBlocking(upDir)) {
        fs.mkdirsBlocking(upDir);
    }
    String relDir = getPersistenceController().readProperty(PersistenceController.UPLOAD_RELATIVE_PATH_PROP,
            null, true);
    String fileName = createUniqueName(fs, upDir, upload.fileName());
    destinations[0] = upDir + (upDir.endsWith("/") ? "" : "/") + fileName;
    destinations[1] = relDir + (relDir.endsWith("/") ? "" : "/") + fileName;
    return destinations;
}

From source file:de.braintags.netrelay.controller.persistence.PersistenceController.java

License:Open Source License

@Override
protected void internalInitProperties(Properties properties) {
    displayAction = new DisplayAction(this);
    insertAction = new InsertAction(this);
    updateAction = new UpdateAction(this);
    deleteAction = new DeleteAction(this);
    noneAction = new NoneAction(this);
    mapperFactory = getNetRelay().getNetRelayMapperFactory();
    String upDir = readProperty(PersistenceController.UPLOAD_DIRECTORY_PROP, null, true);
    FileSystem fs = getVertx().fileSystem();
    if (!fs.existsBlocking(upDir)) {
        fs.mkdirsBlocking(upDir);
        if (!fs.existsBlocking(upDir)) {
            throw new InitException("could not create directory " + upDir);
        } else {//from  ww  w .  j av  a 2  s .  co m
            LOGGER.info("Upload directory created: " + upDir);
        }
    }
}