private boolean extractGenerated() { final Map<String, Object> content = path.getAttrStorage().getContent(); final Object generatedFileAttribute = content.get(GENERATED_ATTRIBUTE_NAME); if (generatedFileAttribute instanceof Boolean) { return (Boolean) generatedFileAttribute; } return false; }
public void clearCache() { file = null; attrsStorage.clear(); }
@Override public <V extends AttributeView> void addAttrView(final V view) { attrsStorage.addAttrView(view); }
@Override public Map<String, Object> readAttributes(final Path path, final String attributes) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException { checkNotNull("path", path); checkNotEmpty("attributes", attributes); final Properties original = new Properties(Files.readAttributes(path, attributes)); if (attributes.equals("*") && exists(dot(path))) { boolean isAttrHolder = path instanceof AttrHolder; if (isAttrHolder && ((AttrHolder) path).getAttrStorage().getContent().size() > 0) { return ((AttrHolder) path).getAttrStorage().getAllContent(); } final Properties content = new Properties(); content.load(newInputStream(dot(path))); content.putAll(original); if (isAttrHolder) { ((AttrHolder) path).getAttrStorage().loadContent(content); } return content; } return original; }
@Override public Object getAttribute(final Path path, final String attribute) throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException { checkNotNull("path", path); Object value; try { value = Files.getAttribute(path, attribute); } catch (UnsupportedOperationException ex) { value = null; } if (value == null && path instanceof AttrHolder) { final AttrHolder holder = ((AttrHolder) path); final String[] attr = split(attribute); if (holder.getAttrStorage().getContent().isEmpty()) { loadDotFile(path); } return holder.getAttrStorage().getAllContent().get(attr[1]); } return value; }
protected void loadDotFile(final Path path) { final Properties content = new Properties(); content.load(newInputStream(dot(path))); if (path instanceof AttrHolder) { ((AttrHolder) path).getAttrStorage().loadContent(content); } }
@Override public <V extends AttributeView> V getAttrView(final String name) { return (V) attrsStorage.getAttrView(name); }
((AttrHolder) path).getAttrStorage().loadContent(properties);
@Override public <V extends AttributeView> V getAttrView(final Class<V> type) { return attrsStorage.getAttrView(type); }
private boolean extractGenerated() { final Map<String, Object> content = path.getAttrStorage().getContent(); final Object generatedFileAttribute = content.get(GENERATED_ATTRIBUTE_NAME); if (generatedFileAttribute instanceof Boolean) { return (Boolean) generatedFileAttribute; } return false; }
public void clearCache() { file = null; attrsStorage.clear(); }
((AttrHolder) path).getAttrStorage().loadContent(properties);
@Override public <V extends AttributeView> V getAttrView(final Class<V> type) { return attrsStorage.getAttrView(type); }
@Override public <V extends AttributeView> void addAttrView(final V view) { attrsStorage.addAttrView(view); }
protected <V extends AbstractBasicFileAttributeView> V newView(final AttrHolder holder, final Class<V> type) { if (NeedsPreloadedAttrs.class.isAssignableFrom(type) && holder.getAttrStorage().getContent().size() == 0) { readAttributes((Path) holder); } try { final Constructor<V> constructor = (Constructor<V>) type.getConstructors()[0]; final V view = constructor.newInstance(holder); holder.addAttrView(view); return view; } catch (final Exception e) { } return null; }
@Override public boolean deleteIfExists(final Path path, final DeleteOption... options) throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException { final boolean result = Files.deleteIfExists(path, options); try { Files.deleteIfExists(dot(path), options); } catch (Exception ex) { } if (path instanceof AttrHolder) { ((AttrHolder) path).getAttrStorage().clear(); } return result; }
@Override public <V extends AttributeView> V getAttrView(final String name) { return (V) attrsStorage.getAttrView(name); }
public DiscussionView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent();
@Override public void delete(final Path path, final DeleteOption... options) throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException { Files.delete(path, options); try { Files.deleteIfExists(dot(path), options); } catch (Exception ex) { } if (path instanceof AttrHolder) { ((AttrHolder) path).getAttrStorage().clear(); } }
public DiscussionView(final AbstractPath path) { super(path); final Map<String, Object> content = path.getAttrStorage().getContent();