All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.kie.commons.io.impl.cluster.FileSystemSyncLock Maven / Gradle / Ivy

There is a newer version: 6.0.0.CR5
Show newest version
package org.kie.commons.io.impl.cluster;

import java.util.HashMap;
import java.util.Map;

import org.kie.commons.cluster.LockExecuteNotifyAsyncReleaseTemplate;
import org.kie.commons.java.nio.base.FileSystemId;
import org.kie.commons.java.nio.file.FileSystem;
import org.kie.commons.message.MessageType;

import static org.kie.commons.io.impl.cluster.ClusterMessageType.*;

public class FileSystemSyncLock extends LockExecuteNotifyAsyncReleaseTemplate {

    private final FileSystem fileSystem;

    public FileSystemSyncLock( final FileSystem fileSystem ) {
        this.fileSystem = fileSystem;
    }

    @Override
    public MessageType getMessageType() {
        return SYNC_FS;
    }

    @Override
    public Map buildContent() {
        return new HashMap() {{
            put( "fs_scheme", fileSystem.getRootDirectories().iterator().next().toUri().getScheme() );
            put( "fs_id", ( (FileSystemId) fileSystem ).id() );
            put( "fs_uri", fileSystem.toString() );
        }};
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy