// Path: src/main/java/pl/sdadas/fsbrowser/fs/common/CloseSuppressingFileSystem.java
// public class CloseSuppressingFileSystem extends DelegatingFileSystem {
// 
//     public CloseSuppressingFileSystem(FileSystem fs) {
//         super(fs);
//     }
// 
//     @Override
//     public void close() throws IOException {
//         /* DO NOTHING */
//     }
// }


import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.HarFileSystem;
import org.apache.hadoop.fs.Path;
import pl.sdadas.fsbrowser.fs.common.CloseSuppressingFileSystem;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
package pl.sdadas.fsbrowser.fs.connection;



/**
 * @author Sławomir Dadas
 */
public class HarFsConnection extends FsConnection {

    private final FileSystem parentFileSystem;

    public HarFsConnection(FsConnection other, Path harFile) {
        super(other.getConnectionConfig());
        this.setReadOnly(true);
        this.setRoot(getHarPath(harFile));
        this.parentFileSystem = new CloseSuppressingFileSystem(other.getFileSystem());
    }

    @Override
    protected FileSystem createNewFileSystem(Configuration configuration) throws IOException {
        HarFileSystem fs = new HarFileSystem(this.parentFileSystem);
        fs.initialize(this.getRoot().toUri(), configuration);
        return fs;
    }

    @Override
    protected FileSystem createSharedFileSystem(Configuration configuration) throws IOException {
        return this.getFileSystem() != null ? this.getFileSystem() : createNewFileSystem(configuration);
    }

    private URI getHarUri(Path file) {
// Path: src/main/java/pl/sdadas/fsbrowser/fs/common/CloseSuppressingFileSystem.java
// public class CloseSuppressingFileSystem extends DelegatingFileSystem {
// 
//     public CloseSuppressingFileSystem(FileSystem fs) {
//         super(fs);
//     }
// 
//     @Override
//     public void close() throws IOException {
//         /* DO NOTHING */
//     }
// }


// Path: src/main/java/pl/sdadas/fsbrowser/fs/connection/HarFsConnection.java
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.HarFileSystem;
import org.apache.hadoop.fs.Path;
import pl.sdadas.fsbrowser.fs.common.CloseSuppressingFileSystem;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;

package pl.sdadas.fsbrowser.fs.connection;



/**
 * @author Sławomir Dadas
 */
public class HarFsConnection extends FsConnection {

    private final FileSystem parentFileSystem;

    public HarFsConnection(FsConnection other, Path harFile) {
        super(other.getConnectionConfig());
        this.setReadOnly(true);
        this.setRoot(getHarPath(harFile));
        this.parentFileSystem = new CloseSuppressingFileSystem(other.getFileSystem());
    }

    @Override
    protected FileSystem createNewFileSystem(Configuration configuration) throws IOException {
        HarFileSystem fs = new HarFileSystem(this.parentFileSystem);
        fs.initialize(this.getRoot().toUri(), configuration);
        return fs;
    }

    @Override
    protected FileSystem createSharedFileSystem(Configuration configuration) throws IOException {
        return this.getFileSystem() != null ? this.getFileSystem() : createNewFileSystem(configuration);
    }

    private URI getHarUri(Path file) {
        URI uri = file.toUri();