Example usage for org.apache.commons.vfs FileType IMAGINARY

List of usage examples for org.apache.commons.vfs FileType IMAGINARY

Introduction

In this page you can find the example usage for org.apache.commons.vfs FileType IMAGINARY.

Prototype

FileType IMAGINARY

To view the source code for org.apache.commons.vfs FileType IMAGINARY.

Click Source Link

Document

A file that does not exist.

Usage

From source file:com.github.stephenc.javaisotools.vfs.provider.iso.IsoFileObject.java

/**
 * Creates an IsoFileObject without a Iso9660FileEntry. The entry must be set before calling getContent(). The
 * FileType is set to IMAGINARY until the underlying entry is set.
 */// w  ww.  ja va 2  s.co m
IsoFileObject(final FileName name, final IsoFileSystem fs) {
    super(name, fs);
    this.type = FileType.IMAGINARY;
    this.children = new HashSet();
}

From source file:com.jaspersoft.jasperserver.api.metadata.common.util.RepositoryFileObject.java

@Override
protected FileType doGetType() throws Exception {

    if (folder != null) {
        return FileType.FOLDER;
    } else if (fileResource != null) {
        return FileType.FILE;
    } else {/* w  w w  .  j a v a 2 s.  c  o  m*/
        return FileType.IMAGINARY;
    }
}

From source file:com.thinkberg.moxo.vfs.s3.jets3t.Jets3tFileObject.java

protected FileType doGetType() throws Exception {
    if (null == object.getContentType()) {
        return FileType.IMAGINARY;
    }/*w  ww.  j  ava2  s. co  m*/

    String contentType = object.getContentType();
    if ("".equals(object.getKey()) || Mimetypes.MIMETYPE_JETS3T_DIRECTORY.equals(contentType)) {
        return FileType.FOLDER;
    }

    return FileType.FILE;
}

From source file:com.newatlanta.appengine.vfs.provider.GaeFileObject.java

private FileType getEntityFileType() {
    String typeName = (String) metadata.getProperty(FILETYPE);
    if (typeName != null) {
        if (typeName.equals(FileType.FILE.getName())) {
            return FileType.FILE;
        }/*  ww w . jav a  2s  .  c om*/
        if (typeName.equals(FileType.FOLDER.getName())) {
            return FileType.FOLDER;
        }
    }
    return FileType.IMAGINARY;
}

From source file:com.panet.imeta.job.entries.sftp.SFTPClient.java

public FileType getFileType(String filename) throws KettleJobException {
    try {/*ww w .j a v a2  s.  co m*/
        SftpATTRS attrs = c.stat(filename);
        if (attrs == null)
            return FileType.IMAGINARY;

        if ((attrs.getFlags() & SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS) == 0)
            throw new KettleJobException("Unknown permissions error");

        if (attrs.isDir())
            return FileType.FOLDER;
        else
            return FileType.FILE;
    } catch (Exception e) {
        throw new KettleJobException(e);
    }
}

From source file:com.newatlanta.appengine.vfs.provider.GaeFileObject.java

/**
 * Returns the file type. The main use of this method is to determine if the
 * file exists. As long as we always set the superclass type via injectType(),
 * this method never gets invoked (which is a good thing, because it's expensive).
 *//* ww  w  . j av a2 s  .com*/
@Override
protected FileType doGetType() {
    try {
        // the only way to check if the metadata exists is to try to read it
        if ((metadata != null) && (datastore.get(metadata.getKey()) != null)) {
            return getName().getType();
        }
    } catch (EntityNotFoundException e) {
    }
    return FileType.IMAGINARY; // file doesn't exist
}

From source file:com.newatlanta.appengine.vfs.provider.GaeFileObject.java

/**
 * Called when the children of this file change.
 *///www .j  a  v a2  s  .  c om
protected void onChildrenChanged(FileName child, FileType newType) throws FileSystemException {
    Key childKey = createKey(child);
    List<Key> childKeys = getChildKeys();
    if (newType == FileType.IMAGINARY) { // child being deleted
        if (childKeys != null) {
            childKeys.remove(childKey);
            if (childKeys.size() == 0) {
                metadata.removeProperty(CHILD_KEYS);
            }
        }
    } else { // child being added
        if (childKeys == null) {
            childKeys = new ArrayList<Key>();
            childKeys.add(childKey);
            metadata.setUnindexedProperty(CHILD_KEYS, childKeys);
        } else if (!childKeys.contains(childKey)) {
            childKeys.add(childKey);
        }
    }
    putMetaData();
}

From source file:com.newatlanta.appengine.vfs.provider.GaeFileObject.java

/**
 * Called when the type or content of this file changes, or when it is created
 * or deleted./*ww w .  j av  a  2 s . c om*/
 */
@Override
protected void onChange() throws FileSystemException {
    if (getType() == FileType.IMAGINARY) { // file/folder is being deleted
        if (getName().getType().hasContent()) {
            deleteBlocks(0);
        }
        deleteMetaData();
    } else { // file/folder is being created or modified
        putMetaData();
    }
}

From source file:org.efaps.webdav4vfs.test.ramvfs.RamFileData.java

/**
 *
 *///from w  ww  .  j  a v a  2s . c  o  m
void clear() {
    this.buffer = new byte[0];
    updateLastModified();
    this.type = FileType.IMAGINARY;
    this.children = Collections.synchronizedCollection(new ArrayList<RamFileData>());
    this.name = null;
}

From source file:org.jclouds.vfs.provider.blobstore.BlobStoreFileObject.java

@Override
protected FileType doGetType() throws Exception {
    if (metadata == null)
        return FileType.IMAGINARY;
    if (getNameTrimLeadingSlashes().equals("") || getName().getParent() == null)
        return FileType.FOLDER;
    return (metadata.getType() == StorageType.BLOB) ? FileType.FILE : FileType.FOLDER;
}