Example usage for org.apache.commons.vfs.provider LayeredFileName getOuterName

List of usage examples for org.apache.commons.vfs.provider LayeredFileName getOuterName

Introduction

In this page you can find the example usage for org.apache.commons.vfs.provider LayeredFileName getOuterName.

Prototype

public FileName getOuterName() 

Source Link

Document

Returns the URI of the outer file.

Usage

From source file:org.sonatype.gshell.vfs.provider.truezip.TruezipFileObject.java

/**
 * Attaches this file object to its file resource.
 *///from  w w w. ja  v a 2 s .c  o m
protected void doAttach() throws Exception {
    if (file == null) {
        LayeredFileName layeredFileName = (LayeredFileName) getName();
        String fileName = layeredFileName.getOuterName().getRootURI()
                + layeredFileName.getOuterName().getPathDecoded();

        FileObject outer = getFileSystem().resolveFile(fileName);
        if (outer instanceof TruezipFileObject) {
            fileName = layeredFileName.getOuterName().getPathDecoded() + getName().getPathDecoded();
            file = new File(fileName, ArchiveDetector.ALL);
        } else {
            fileObject = outer;
            DefaultFileSystemManager dfsMgr = (DefaultFileSystemManager) VFS.getManager();
            file = new File(dfsMgr.getTemporaryFileStore().allocateFile(getName().getBaseName()));
        }
    }
}