Example usage for org.apache.commons.vfs NameScope DESCENDENT_OR_SELF

List of usage examples for org.apache.commons.vfs NameScope DESCENDENT_OR_SELF

Introduction

In this page you can find the example usage for org.apache.commons.vfs NameScope DESCENDENT_OR_SELF.

Prototype

NameScope DESCENDENT_OR_SELF

To view the source code for org.apache.commons.vfs NameScope DESCENDENT_OR_SELF.

Click Source Link

Document

Resolve against the descendents of the base file.

Usage

From source file:org.objectweb.proactive.extensions.dataspaces.vfs.AbstractLimitingFileObject.java

private boolean isDisallowedAncestor(final T decoratedFile) {
    if (decoratedFile == null)
        return false;
    if (getName().isDescendent(decoratedFile.getName(), NameScope.DESCENDENT_OR_SELF)) {
        return false;
    }/*from   ww w . j  av a2  s  .  c  om*/
    return !canReturnAncestor(decoratedFile);
}

From source file:org.objectweb.proactive.extensions.dataspaces.vfs.adapter.VFSFileObjectAdapter.java

private void checkFileNamesConsistencyOrWound() throws FileSystemException {
    final FileName adapteeName = currentFileObject.getName();

    if (!dataSpaceVFSFileName.isDescendent(adapteeName, NameScope.DESCENDENT_OR_SELF))
        throw new FileSystemException("Specified data space file name does not match adaptee's name");
}

From source file:org.objectweb.proactive.extensions.dataspaces.vfs.DataSpacesLimitingFileObject.java

/**
 * @return URI of a file, always suitable for user path.
 * @throws MalformedURIException//from www.j  a  va 2  s.  co m
 *             when this file is not representing any URI
 * @see DataSpacesURI#isSuitableForUserPath()
 * @see #getURI()
 */
public DataSpacesURI getDataSpacesURI() throws MalformedURIException {
    final FileName name = getName();
    if (!spaceRootFileName.isDescendent(name, NameScope.DESCENDENT_OR_SELF)) {
        throw new MalformedURIException(
                "VFS path of this DataSpacesFileObject does not start with its space VFS path");
    }

    String relativePath;
    try {
        relativePath = spaceRootFileName.getRelativeName(name);
    } catch (org.apache.commons.vfs.FileSystemException e) {
        ProActiveLogger.logImpossibleException(logger, e);
        throw new ProActiveRuntimeException(e);
    }
    if (".".equals(relativePath))
        relativePath = null;

    return spaceRootUri.withRelativeToSpace(relativePath);
}