private boolean extractGenerated() { final Map<String, Object> content = path.getAttrStorage().getContent(); final Object generatedFileAttribute = content.get(GENERATED_ATTRIBUTE_NAME); if (generatedFileAttribute instanceof Boolean) { return (Boolean) generatedFileAttribute; } return false; }
@Override public boolean endsWith(final String other) throws InvalidPathException { checkNotNull("other", other); return endsWith(getFileSystem().getPath(other)); }
public String getVersion(Path path) { if (path instanceof AbstractPath) { String host = ((AbstractPath) path).getHost(); return host.substring(0, host.indexOf("@")); } else { return "master"; } }
private boolean equalRoots(AbstractPath other) { String thisRootName = stripAllSeparators(getRoot().toString()); String otherRootName = stripAllSeparators(other.getRoot().toString()); if (!thisRootName.equals(otherRootName) || !host.equals(other.getHost())) { return false; } return true; }
@Override public Path toAbsolutePath() throws IOException, SecurityException { if (isAbsolute()) { return this; } if (host.isEmpty()) { return newPath(fs, FilenameUtils.normalize(defaultDirectory() + toString(), !usesWindowsFormat), host, isRealPath, true); } return newPath(fs, defaultDirectory() + toString(false), host, isRealPath, true); }
public OtherMetaView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent(); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path, BasicFileAttributeView.class).readAttributes();
if (isAbsolute() != other.isAbsolute()) { throw new IllegalArgumentException("Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal."); if (isAbsolute() && !equalRoots(other)) { throw new IllegalArgumentException("Could not relativize path 'otherx', 'getRoot()' for 'this' and 'otherx' should be equal."); if (getNamesIncludingRoot().equals(other.getNamesIncludingRoot())) { return emptyPath(); int n = (getNameCount() > other.getNameCount()) ? other.getNameCount() : getNameCount(); int i = 0; while (i < n) { if (!this.getName(i).equals(other.getName(i))) { break; int numberOfDots = getNameCount() - i; if (numberOfDots == 0 && i < other.getNameCount()) { return other.subpath(i, other.getNameCount()); sb.append(".."); if (numberOfDots > 1) { sb.append(getSeparator()); if (i < other.getNameCount()) { if (sb.length() > 0) { sb.append(getSeparator());
public ConfigView(final AbstractPath path) { super(path); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path, BasicFileAttributeView.class).readAttributes();
@Override public <T extends BasicFileAttributes> T readAttributes() throws org.uberfire.java.nio.IOException { if (attrs == null) { final BasicFileAttributes basicAtts = ((BasicFileAttributeView) path.getAttrView(BasicFileAttributeView.class)).readAttributes(); attrs = new DublinCoreAttributes(basicAtts, (String) path.getAttrStorage().getContent().get("dcore.author")); } return (T) attrs; }
@Override public boolean startsWith(final String other) throws InvalidPathException { checkNotNull("other", other); return startsWith(getFileSystem().getPath(other)); }
@Override public Path write(final Path path, final byte[] bytes, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException { SeekableByteChannel byteChannel; try { byteChannel = newByteChannel(path, buildOptions(options), attrs); } catch (final FileAlreadyExistsException ex) { ((AbstractPath) path).clearCache(); byteChannel = newByteChannel(path, buildOptions(options, TRUNCATE_EXISTING), attrs); } try { byteChannel.write(ByteBuffer.wrap(bytes)); byteChannel.close(); } catch (final java.io.IOException e) { throw new IOException(e); } return path; }
public OtherMetaView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent(); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path, BasicFileAttributeView.class).readAttributes();
if (isAbsolute() != other.isAbsolute()) { throw new IllegalArgumentException("Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal."); if (isAbsolute() && !equalRoots(other)) { throw new IllegalArgumentException("Could not relativize path 'otherx', 'getRoot()' for 'this' and 'otherx' should be equal."); if (getNamesIncludingRoot().equals(other.getNamesIncludingRoot())) { return emptyPath(); int n = (getNameCount() > other.getNameCount()) ? other.getNameCount() : getNameCount(); int i = 0; while (i < n) { if (!this.getName(i).equals(other.getName(i))) { break; int numberOfDots = getNameCount() - i; if (numberOfDots == 0 && i < other.getNameCount()) { return other.subpath(i, other.getNameCount()); sb.append(".."); if (numberOfDots > 1) { sb.append(getSeparator()); if (i < other.getNameCount()) { if (sb.length() > 0) { sb.append(getSeparator());
public ConfigView(final AbstractPath path) { super(path); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path, BasicFileAttributeView.class).readAttributes();
@Override public <T extends BasicFileAttributes> T readAttributes() throws org.uberfire.java.nio.IOException { if (attrs == null) { final BasicFileAttributes basicAtts = ((BasicFileAttributeView) path.getAttrView(BasicFileAttributeView.class)).readAttributes(); attrs = new DublinCoreAttributes(basicAtts, (String) path.getAttrStorage().getContent().get("dcore.author")); } return (T) attrs; }
@Override public boolean startsWith(final String other) throws InvalidPathException { checkNotNull("other", other); return startsWith(getFileSystem().getPath(other)); }
private boolean equalRoots(AbstractPath other) { String thisRootName = stripAllSeparators(getRoot().toString()); String otherRootName = stripAllSeparators(other.getRoot().toString()); if (!thisRootName.equals(otherRootName) || !host.equals(other.getHost())) { return false; } return true; }
@Override public Path toAbsolutePath() throws IOException, SecurityException { if (isAbsolute()) { return this; } if (host.isEmpty()) { return newPath(fs, FilenameUtils.normalize(defaultDirectory() + toString(), !usesWindowsFormat), host, isRealPath, true); } return newPath(fs, defaultDirectory() + toString(false), host, isRealPath, true); }
e); } finally { ((AbstractPath) path).clearCache();
public DiscussionView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent(); final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path, BasicFileAttributeView.class).readAttributes();