SftpFileObjectWithWindowsSupport( AbstractFileName name, SftpFileSystemWindows fileSystem ) throws FileSystemException { super( name, fileSystem ); this.path = name.getPath(); }
/** * Determines if another file name is an ancestor of this file name. * * @param ancestor The FileName to check. * @return true if the FileName is an ancestor, false otherwise. */ @Override public boolean isAncestor(final FileName ancestor) { if (!ancestor.getRootURI().equals(getRootURI())) { return false; } return checkName(ancestor.getPath(), getPath(), NameScope.DESCENDENT); }
/** * Notify the parent of a change to its children, when a child is created or deleted. * * @param childName The name of the child. * @param newType The type of the child. * @throws Exception if an error occurs. */ private void notifyParent(final FileName childName, final FileType newType) throws Exception { if (parent == null) { final FileName parentName = fileName.getParent(); if (parentName != null) { // Locate the parent, if it is cached parent = fs.getFileFromCache(parentName); } } if (parent != null) { FileObjectUtils.getAbstractFileObject(parent).childrenChanged(childName, newType); } }
/** * Returns the name of the parent of the file. * * @return the FileName of the parent. */ @Override public FileName getParent() { final String parentPath; final int idx = getPath().lastIndexOf(SEPARATOR_CHAR); if (idx == -1 || idx == getPath().length() - 1) { // No parent return null; } else if (idx == 0) { // Root is the parent parentPath = SEPARATOR; } else { parentPath = getPath().substring(0, idx); } return createName(parentPath, FileType.FOLDER); }
private String createURI(final boolean useAbsolutePath, final boolean usePassword) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, usePassword); buffer.append(useAbsolutePath ? absPath : getPath()); return buffer.toString(); }
if (!AbstractFileName.checkName(realBase.getPath(), resolvedPath, scope)) { throw new FileSystemException("vfs.provider/invalid-descendent-name.error", name); return ((AbstractFileName) realBase).createName(resolvedPath, fileType);
/** * Implement Comparable. * * @param obj another abstract filename * @return negative number if less than, 0 if equal, positive if greater than. */ @Override public int compareTo(final FileName obj) { final AbstractFileName name = (AbstractFileName) obj; return getKey().compareTo(name.getKey()); }
/** * Returns the absolute URI of the file. * * @return The absolute URI of the file. */ @Override public String getURI() { if (uri == null) { uri = createURI(); } return uri; }
/** * Returns the receiver as a URI String for public display, like, without a * password. * * @return A URI String without a password, never {@code null}. */ @Override public String getPublicURIString() { return fileName.getFriendlyURI(); }
/** * Returns the root URI of the file system this file belongs to. * * @return The URI of the root. */ @Override public String getRootURI() { if (rootUri == null) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, true); buffer.append(SEPARATOR_CHAR); rootUri = buffer.toString().intern(); } return rootUri; }
/** * Returns the extension of this file name. * * @return The file extension. */ @Override public String getExtension() { if (extension == null) { getBaseName(); final int pos = baseName.lastIndexOf('.'); // if ((pos == -1) || (pos == baseName.length() - 1)) // imario@ops.co.at: Review of patch from adagoubard@chello.nl // do not treat filenames like // .bashrc c:\windows\.java c:\windows\.javaws c:\windows\.jedit c:\windows\.appletviewer // as extension if (pos < 1 || pos == baseName.length() - 1) { // No extension extension = ""; } else { extension = baseName.substring(pos + 1).intern(); } } return extension; }
@Override public FileName createName(String absPath, FileType type) { return ((AbstractFileName) fileName).createName(absPath, type); }
/** * Determines if another file name is an ancestor of this file name. * * @param ancestor The FileName to check. * @return true if the FileName is an ancestor, false otherwise. */ @Override public boolean isAncestor(final FileName ancestor) { if (!ancestor.getRootURI().equals(getRootURI())) { return false; } return checkName(ancestor.getPath(), getPath(), NameScope.DESCENDENT); }
/** * Notify the parent of a change to its children, when a child is created or deleted. * * @param childName The name of the child. * @param newType The type of the child. * @throws Exception if an error occurs. */ private void notifyParent(final FileName childName, final FileType newType) throws Exception { if (parent == null) { final FileName parentName = fileName.getParent(); if (parentName != null) { // Locate the parent, if it is cached parent = fs.getFileFromCache(parentName); } } if (parent != null) { FileObjectUtils.getAbstractFileObject(parent).childrenChanged(childName, newType); } }
/** * Returns the name of the parent of the file. * * @return the FileName of the parent. */ @Override public FileName getParent() { final String parentPath; final int idx = getPath().lastIndexOf(SEPARATOR_CHAR); if (idx == -1 || idx == getPath().length() - 1) { // No parent return null; } else if (idx == 0) { // Root is the parent parentPath = SEPARATOR; } else { parentPath = getPath().substring(0, idx); } return createName(parentPath, FileType.FOLDER); }
private String createURI(final boolean useAbsolutePath, final boolean usePassword) { final StringBuilder buffer = new StringBuilder(); appendRootUri(buffer, usePassword); buffer.append(useAbsolutePath ? absPath : getPath()); return buffer.toString(); }
if (!AbstractFileName.checkName(realBase.getPath(), resolvedPath, scope)) { throw new FileSystemException("vfs.provider/invalid-descendent-name.error", name); return ((AbstractFileName) realBase).createName(resolvedPath, fileType);
/** * Implement Comparable. * * @param obj another abstract filename * @return negative number if less than, 0 if equal, positive if greater than. */ @Override public int compareTo(final FileName obj) { final AbstractFileName name = (AbstractFileName) obj; return getKey().compareTo(name.getKey()); }
/** * Returns the absolute URI of the file. * * @return The absolute URI of the file. */ @Override public String getURI() { if (uri == null) { uri = createURI(); } return uri; }
/** * Returns the receiver as a URI String for public display, like, without a password. * * @return A URI String without a password, never {@code null}. */ @Override public String getPublicURIString() { return fileName.getFriendlyURI(); }