/** * Called when a file is created. */ public void fileCreated(final FileChangeEvent event) throws Exception { if (!ignoreEvent) { handleCreate(file.getType()); } }
public boolean includeFile(final FileSelectInfo selection) throws Exception { assert selection != null; FileType ftype = selection.getFile().getType(); switch (type) { case D: return ftype == FileType.FOLDER; case F: return ftype == FileType.FILE; // TODO: Handle FileType.FILE_OR_FOLDER default: return false; } }
public boolean includeFile(final FileSelectInfo selection) throws Exception { assert selection != null; FileType ftype = selection.getFile().getType(); switch (type) { case D: return ftype == FileType.FOLDER; case F: return ftype == FileType.FILE; // TODO: Handle FileType.FILE_OR_FOLDER default: return false; } }
/** * Determines if a file or folder should be selected. */ public boolean includeFile(final FileSelectInfo fileInfo) throws FileSystemException { return (fileInfo.getFile().getType() == type); }
public static boolean hasChildren(final FileObject file) throws FileSystemException { assert file != null; if (file.getType().hasChildren()) { FileObject[] children = file.getChildren(); if (children != null && children.length != 0) { return true; } } return false; }
public static boolean hasChildren(final FileObject file) throws FileSystemException { assert file != null; if (file.getType().hasChildren()) { FileObject[] children = file.getChildren(); if (children != null && children.length != 0) { return true; } } return false; }
public static boolean hasChildren(final FileObject file) throws FileSystemException { assert file != null; if (file.getType().hasChildren()) { FileObject[] children = file.getChildren(); if (children != null && children.length != 0) { return true; } } return false; }
public static UnixFsObject.Directory dirFromFileObject( RelativePath toFile, FileObject fromFile, FileAttributes attributes ) throws FileSystemException { if ( !fromFile.getType().equals( FileType.FOLDER ) ) { throw new FileSystemException( "Not a directory: " + fromFile.getName().getPath() + ", was: " + fromFile.getType() ); } FileContent content = fromFile.getContent(); return UnixFsObject.directory( toFile, new LocalDateTime( content.getLastModifiedTime() ), attributes ); } }
protected void ensureFileIsReadable(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasChildren()) { FileObjects.close(file); throw new ResultNotification("File is not readable: " + file.getName(), Result.FAILURE); } }
protected void ensureFileHasContent(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasContent()) { FileObjects.close(file); throw new ResultNotification("File has no content: " + file.getName(), Result.FAILURE); } }
public boolean includeFile( FileSelectInfo fileSelectInfo ) throws Exception { FileObject fileObject = fileSelectInfo.getFile(); FileName name = fileObject.getName(); if ( fileType != null && fileObject.getType() != fileType ) { return false; } String relativePath = root.getRelativeName( name ); return matches( relativePath ); }
protected void ensureFileHasContent(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasContent()) { FileObjects.close(file); throw new ResultNotification("File has no content: " + file.getName(), Result.FAILURE); } }
protected void ensureFileIsWritable(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasChildren()) { FileObjects.close(file); throw new ResultNotification("File is not writable: " + file.getName(), Result.FAILURE); } } }
protected void ensureFileHasChildren(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasChildren()) { FileObjects.close(file); throw new ResultNotification("File has no children: " + file.getName(), Result.FAILURE); } }
protected void ensureFileHasContent(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasContent()) { FileObjects.close(file); throw new ResultNotification("File has no content: " + file.getName(), Result.FAILURE); } } }
protected void ensureFileHasChildren(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasChildren()) { FileObjects.close(file); throw new ResultNotification("File has no children: " + file.getName(), Result.FAILURE); } }
protected void ensureFileIsReadable(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasChildren()) { FileObjects.close(file); throw new ResultNotification("File is not readable: " + file.getName(), Result.FAILURE); } }
protected void ensureFileIsWritable(final FileObject file) throws FileSystemException { assert file != null; if (!file.getType().hasChildren()) { FileObjects.close(file); throw new ResultNotification("File is not writable: " + file.getName(), Result.FAILURE); } } }
public FileObjectAssert isFile(final boolean flag) throws FileSystemException { if (getFile().getType().hasChildren() == flag) { if (flag) { throw new AssertionException(Messages.NOT_FILE.format(getFile())); } else { throw new AssertionException(Messages.IS_FILE.format(getFile())); } } return this; }
public FileObjectAssert isDirectory(final boolean flag) throws FileSystemException { if (getFile().getType().hasChildren() != flag) { if (flag) { throw new AssertionException(Messages.NOT_DIRECTORY.format(getFile())); } else { throw new AssertionException(Messages.IS_DIRECTORY.format(getFile())); } } return this; }