protected String getUriTrailer() { return getType().hasChildren() ? "/" : ""; }
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 void setCurrentDirectory(final Variables vars, final FileObject dir) throws FileSystemException { assert vars != null; assert dir != null; log.trace("Setting CWD: {}", dir); // Make sure that the given file object exists and is really a directory if (!dir.exists()) { throw new RuntimeException("Directory not found: " + dir.getName()); } else if (!dir.getType().hasChildren()) { throw new RuntimeException("File can not contain children: " + dir.getName()); } vars.parent().set(CWD, dir); }
public void setCurrentDirectory(final Variables vars, final FileObject dir) throws FileSystemException { assert vars != null; assert dir != null; log.trace("Setting CWD: {}", dir); // Make sure that the given file object exists and is really a directory if (!dir.exists()) { throw new RuntimeException("Directory not found: " + dir.getName()); } else if (!dir.getType().hasChildren()) { throw new RuntimeException("File can not contain children: " + dir.getName()); } vars.parent().set(CWD, dir); }
public void setCurrentDirectory(final Variables vars, final FileObject dir) throws FileSystemException { assert vars != null; assert dir != null; log.trace("Setting CWD: {}", dir); // Make sure that the given file object exists and is really a directory if (!dir.exists()) { throw new RuntimeException("Directory not found: " + dir.getName()); } else if (!dir.getType().hasChildren()) { throw new RuntimeException("File can not contain children: " + dir.getName()); } vars.parent().set(CWD, dir); }
public void removeChild(final MetaData data) { assert data != null; if (!getType().hasChildren()) { throw new MetaDataException("A child can only be removed from a folder"); } if (!hasChild(data)) { throw new MetaDataException("Child not found: " + data); } log.trace("Removing child: {}", data); getChildren().remove(data); updateLastModified(); }
public void addChild(final MetaData data) { assert data != null; if (!getType().hasChildren()) { throw new MetaDataException("A child can only be added in a folder"); } if (hasChild(data)) { throw new MetaDataException("Child already exists: " + data); } log.trace("Adding child: {}", data); getChildren().add(data); updateLastModified(); }
public void removeChild(final MetaData data) { assert data != null; if (!getType().hasChildren()) { throw new MetaDataException("A child can only be removed from a folder"); } if (!hasChild(data)) { throw new MetaDataException("Child not found: " + data); } log.trace("Removing child: {}", data); getChildren().remove(data); updateLastModified(); }
public void addChild(final MetaData data) { assert data != null; if (!getType().hasChildren()) { throw new MetaDataException("A child can only be added in a folder"); } if (hasChild(data)) { throw new MetaDataException("Child already exists: " + data); } log.trace("Adding child: {}", data); getChildren().add(data); updateLastModified(); }
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); } } }
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 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); } } }
private void find(final CommandContext context, final FileObject file, final FileSelector selector) throws FileSystemException { assert context != null; assert file != null; assert selector != null; FileObject[] files = file.findFiles(selector); if (files != null && files.length != 0) { for (FileObject child : files) { display(context, child); if (child.getType().hasChildren()) { find(context, child, selector); } } } }
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; }