Search in sources :

Example 1 with FileBase

use of org.structr.web.entity.FileBase in project structr by structr.

the class CloudConnection method finishFile.

public void finishFile(final FileNodeEndChunk endChunk) throws FrameworkException {
    final FileNodeDataContainer container = fileMap.get(endChunk.getContainerId());
    if (container == null) {
        logger.warn("Received file end chunk for ID {} without file, this should not happen!", endChunk.getContainerId());
    } else {
        container.flushAndCloseTemporaryFile();
        final NodeInterface newNode = storeNode(container);
        if (newNode instanceof FileBase) {
            try {
                container.persistTemporaryFile(((FileBase) newNode).getFileOnDisk().getAbsolutePath());
            } catch (Throwable t) {
                // do not catch specific exception only, we need to be able to shut
                // down the connection gracefully, so we must make sure not to be
                // interrupted here
                logger.warn("Unable to persist file {}: {}", newNode, t.getMessage());
            }
        }
        count++;
        total++;
    }
}
Also used : FileBase(org.structr.web.entity.FileBase) FileNodeDataContainer(org.structr.cloud.message.FileNodeDataContainer) NodeInterface(org.structr.core.graph.NodeInterface)

Aggregations

FileNodeDataContainer (org.structr.cloud.message.FileNodeDataContainer)1 NodeInterface (org.structr.core.graph.NodeInterface)1 FileBase (org.structr.web.entity.FileBase)1