@Override public boolean accept(Local file) { if(file.isFile()) { return "fireFTPsites.dat".equals(file.getName()); } return false; } })) {
@Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(local.isFile()) { if(local.exists()) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s", file)); } return false; } } return super.accept(file, local, parent); } }
/** * Skip files that already exist on the server. */ @Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(parent.isExists()) { if(local.isFile()) { if(find.withCache(cache).find(file)) { if(log.isInfoEnabled()) { log.info(String.format("Skip file %s", file)); } return false; } } } return super.accept(file, local, parent); } }
@Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(super.accept(file, local, parent)) { if(local.isFile()) { if(parent.isExists()) { final Write.Append append = upload.append(file, local.attributes().getSize(), cache);
@Override public boolean accept(final Path file, final Local local, final TransferStatus parent) throws BackgroundException { if(local.isFile()) { if(local.exists()) {
/** * @param file A valid bookmark dictionary * @return Null if the file cannot be deserialized * @throws AccessDeniedException If the file is not readable */ @Override public S read(final Local file) throws AccessDeniedException { if(!file.exists()) { throw new LocalAccessDeniedException(file.getAbsolute()); } if(!file.isFile()) { throw new LocalAccessDeniedException(file.getAbsolute()); } final S deserialized = this.read(file.getInputStream()); if(null == deserialized) { throw new AccessDeniedException(String.format("Failure parsing file %s", file.getName())); } return deserialized; }
/** * @param file A valid bookmark dictionary * @return Null if the file cannot be deserialized * @throws AccessDeniedException If the file is not readable */ @Override public S read(final Local file) throws AccessDeniedException { if(!file.exists()) { throw new LocalAccessDeniedException(file.getAbsolute()); } if(!file.isFile()) { throw new LocalAccessDeniedException(file.getAbsolute()); } NSDictionary dict = NSDictionary.dictionaryWithContentsOfFile(file.getAbsolute()); if(null == dict) { throw new AccessDeniedException(String.format("Failure parsing file %s", file.getName())); } return this.deserialize(dict); }
@Override public void run() { final NSOpenPanel panel = NSOpenPanel.openPanel(); panel.setCanChooseDirectories(file.isDirectory()); panel.setCanChooseFiles(file.isFile()); panel.setAllowsMultipleSelection(false); panel.setMessage(MessageFormat.format(LocaleFactory.localizedString("Select {0}", "Credentials"), file.getAbbreviatedPath())); panel.setPrompt(LocaleFactory.localizedString("Choose")); final NSInteger modal = panel.runModal(file.getParent().getAbsolute(), file.getName()); if(modal.intValue() == SheetCallback.DEFAULT_OPTION) { final NSArray filenames = panel.filenames(); final NSEnumerator enumerator = filenames.objectEnumerator(); NSObject next; while((next = enumerator.nextObject()) != null) { selected.set(new FinderLocal(next.toString())); } } panel.orderOut(null); } };
if(local.isFile()) { if(local.attributes().getSize() == 0) {
if(local.isFile()) { throw new LocalAccessDeniedException(String.format("Cannot replace file %s with folder %s", local.getAbbreviatedPath(), file.getName()));
if(local.isFile()) { if(local.exists()) { if(local.attributes().getSize() > 0) {
@Override public Acl getDefault(final Local file) { final Permission permission; if(PreferencesFactory.get().getBoolean("queue.upload.permissions.default")) { if(file.isFile()) { permission = new Permission( PreferencesFactory.get().getInteger("queue.upload.permissions.file.default")); } else { permission = new Permission( PreferencesFactory.get().getInteger("queue.upload.permissions.folder.default")); } } else { // Read permissions from local file permission = file.attributes().getPermission(); } final Acl acl = new Acl(); if(permission.getOther().implies(Permission.Action.read)) { acl.addAll(new Acl.GroupUser(Acl.GroupUser.EVERYONE), new Acl.Role(Acl.Role.READ)); } if(permission.getGroup().implies(Permission.Action.read)) { acl.addAll(new Acl.GroupUser(Acl.GroupUser.AUTHENTICATED), new Acl.Role(Acl.Role.READ)); } if(permission.getGroup().implies(Permission.Action.write)) { acl.addAll(new Acl.GroupUser(Acl.GroupUser.AUTHENTICATED), new Acl.Role(Acl.Role.WRITE)); } return acl; } }