public ImporterBackgroundAction(final AbstractHostCollection bookmarks, final CountDownLatch lock) { this(bookmarks, lock, Arrays.asList( new Transmit4BookmarkCollection(), new FilezillaBookmarkCollection(), new FetchBookmarkCollection(), new FlowBookmarkCollection(), new InterarchyBookmarkCollection(), new CrossFtpBookmarkCollection(), new FireFtpBookmarkCollection(), new Expandrive3BookmarkCollection(), new Expandrive4BookmarkCollection(), new Expandrive5BookmarkCollection(), new Expandrive6BookmarkCollection())); }
@Override protected AbstractHandler getHandler(final ProtocolFactory protocols) { return new ServerHandler(protocols); }
@Override public void endElement(String name, String elementText) { switch(name) { case "site": add(current); break; } } }
public boolean isInstalled() { return StringUtils.isNotBlank(this.getName()); }
public String getConfiguration() { return String.format("bookmark.import.%s", this.getBundleIdentifier()); }
private void parse(final ProtocolFactory protocols, NSDictionary serialized) { List<NSDictionary> items = new PlistDeserializer(serialized).listForKey("BookmarkItems"); for(NSDictionary item : items) { final PlistDeserializer bookmark = new PlistDeserializer(item); String classname = bookmark.stringForKey("ClassName"); if(null == classname) { continue; } if("Bookmark".equals(classname)) { this.read(protocols, bookmark); } if("BookmarkFolder".equals(classname)) { this.parse(protocols, item); } } }
@Override protected void parse(final ProtocolFactory protocols, final Local folder) throws AccessDeniedException { for(Local child : folder.list().filter(new NullFilter<Local>() { @Override public boolean accept(Local file) { if(file.isDirectory()) { return false; } return "ini".equals(file.getExtension()); } })) { if(child.isDirectory()) { this.parse(protocols, child); } else { this.read(protocols, child); } } }
@Override protected void parse(final ProtocolFactory protocols, final Local folder) throws AccessDeniedException { for(Local child : folder.list().filter(new Filter<Local>() { @Override public boolean accept(Local file) { if(file.isDirectory()) { return true; } return "xml".equals(file.getExtension()); } @Override public Pattern toPattern() { return Pattern.compile(".*\\.xml"); } })) { if(child.isDirectory()) { this.parse(protocols, child); } else { this.read(protocols, child); } } }
@Override public boolean add(final Host bookmark) { if(!StringUtils.equals(bookmark.getHostname(), PreferencesFactory.get().getProperty("connection.hostname.default"))) { return super.add(bookmark); } return false; } }
@Override protected AbstractHandler getHandler(final ProtocolFactory protocols) { return new FavoriteHandler(protocols); }
@Override protected void parse(final ProtocolFactory protocols, Local file) throws AccessDeniedException { this.read(protocols, file); }
@Override protected AbstractHandler getHandler(final ProtocolFactory protocols) { return new ServerHandler(protocols); }
@Override protected AbstractHandler getHandler(final ProtocolFactory protocols) { return new ServerHandler(protocols); }
@Override protected AbstractHandler getHandler(final ProtocolFactory protocols) { return new ServerHandler(protocols); }
public abstract void startElement(String name, Attributes attrs);
public abstract void endElement(String name, String content);
@Override public String toString() { final StringBuilder sb = new StringBuilder("ThirdpartyBookmarkCollection{"); sb.append("file=").append(this.getFile()); sb.append('}'); return sb.toString(); } }
protected abstract void parse(final ProtocolFactory protocols, Local file) throws AccessDeniedException;
@Override protected void parse(final ProtocolFactory protocols, final Local file) throws AccessDeniedException { NSDictionary serialized = NSDictionary.dictionaryWithContentsOfFile(file.getAbsolute()); if(null == serialized) { throw new LocalAccessDeniedException(String.format("Invalid bookmark file %s", file)); } this.parse(protocols, serialized); }
@Override public boolean add(Host bookmark) { if(bookmark == null) { return false; } if(bookmark.getHostname().equals( PreferencesFactory.get().getProperty("connection.hostname.default"))) { return false; } return super.add(bookmark); } }