/** * Checks if an attribute exists. * * @param attrName The name of the attribute to check. * @return true if the attribute is associated with the file. * @throws FileSystemException if an error occurs. * @since 2.0 */ @Override public boolean hasAttribute(final String attrName) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/exists-attributes-no-exist.error", fileObject); } getAttributes(); return attrs.containsKey(attrName); }
/** * Checks if an attribute exists. * * @param attrName The name of the attribute to check. * @return true if the attribute is associated with the file. * @throws FileSystemException if an error occurs. * @since 2.0 */ @Override public boolean hasAttribute(final String attrName) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/exists-attributes-no-exist.error", fileObject); } getAttributes(); return attrs.containsKey(attrName); }
/** * Checks if an attribute exists. * * @param attrName The name of the attribute to check. * @return true if the attribute is associated with the file. * @throws FileSystemException if an error occurs. * @since 2.0 */ @Override public boolean hasAttribute(final String attrName) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/exists-attributes-no-exist.error", fileObject); } getAttributes(); return attrs.containsKey(attrName); }
/** * Sets the value of an attribute. * * @param attrName The name of the attribute to add. * @param value The value of the attribute. * @throws FileSystemException if an error occurs. */ @Override public void setAttribute(final String attrName, final Object value) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/set-attribute-no-exist.error", attrName, fileObject); } try { fileObject.doSetAttribute(attrName, value); } catch (final Exception e) { throw new FileSystemException("vfs.provider/set-attribute.error", e, attrName, fileObject); } if (attrs != null) { attrs.put(attrName, value); } }
/** * Sets the value of an attribute. * * @param attrName The name of the attribute to add. * @param value The value of the attribute. * @throws FileSystemException if an error occurs. */ @Override public void setAttribute(final String attrName, final Object value) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/set-attribute-no-exist.error", attrName, fileObject); } try { fileObject.doSetAttribute(attrName, value); } catch (final Exception e) { throw new FileSystemException("vfs.provider/set-attribute.error", e, attrName, fileObject); } if (attrs != null) { attrs.put(attrName, value); } }
/** * Removes an attribute. * * @param attrName The name of the attribute to remove. * @throws FileSystemException if an error occurs. * @since 2.0 */ @Override public void removeAttribute(final String attrName) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/remove-attribute-no-exist.error", fileObject); } try { fileObject.doRemoveAttribute(attrName); } catch (final Exception e) { throw new FileSystemException("vfs.provider/remove-attribute.error", e, attrName, fileObject); } if (attrs != null) { attrs.remove(attrName); } }
/** * Removes an attribute. * * @param attrName The name of the attribute to remove. * @throws FileSystemException if an error occurs. * @since 2.0 */ @Override public void removeAttribute(final String attrName) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/remove-attribute-no-exist.error", fileObject); } try { fileObject.doRemoveAttribute(attrName); } catch (final Exception e) { throw new FileSystemException("vfs.provider/remove-attribute.error", e, attrName, fileObject); } if (attrs != null) { attrs.remove(attrName); } }
/** * Removes an attribute. * * @param attrName The name of the attribute to remove. * @throws FileSystemException if an error occurs. * @since 2.0 */ @Override public void removeAttribute(final String attrName) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/remove-attribute-no-exist.error", fileObject); } try { fileObject.doRemoveAttribute(attrName); } catch (final Exception e) { throw new FileSystemException("vfs.provider/remove-attribute.error", e, attrName, fileObject); } if (attrs != null) { attrs.remove(attrName); } }
/** * Sets the value of an attribute. * * @param attrName The name of the attribute to add. * @param value The value of the attribute. * @throws FileSystemException if an error occurs. */ @Override public void setAttribute(final String attrName, final Object value) throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/set-attribute-no-exist.error", attrName, fileObject); } try { fileObject.doSetAttribute(attrName, value); } catch (final Exception e) { throw new FileSystemException("vfs.provider/set-attribute.error", e, attrName, fileObject); } if (attrs != null) { attrs.put(attrName, value); } }
/** * Returns a read-only map of this file's attributes. * * @return a Map of the file's attributes. * @throws FileSystemException if an error occurs. */ @Override public Map<String, Object> getAttributes() throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/get-attributes-no-exist.error", fileObject); } if (resetAttributes || roAttrs == null) { try { synchronized (this) { attrs = fileObject.doGetAttributes(); roAttrs = Collections.unmodifiableMap(attrs); resetAttributes = false; } } catch (final Exception e) { throw new FileSystemException("vfs.provider/get-attributes.error", fileObject, e); } } return roAttrs; }
/** * Returns a read-only map of this file's attributes. * * @return a Map of the file's attributes. * @throws FileSystemException if an error occurs. */ @Override public Map<String, Object> getAttributes() throws FileSystemException { if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/get-attributes-no-exist.error", fileObject); } if (resetAttributes || roAttrs == null) { try { synchronized (this) { attrs = fileObject.doGetAttributes(); roAttrs = Collections.unmodifiableMap(attrs); resetAttributes = false; } } catch (final Exception e) { throw new FileSystemException("vfs.provider/get-attributes.error", fileObject, e); } } return roAttrs; }
/** * Returns the last-modified timestamp. * * @return The last modified timestamp. * @throws FileSystemException if an error occurs. */ @Override public long getLastModifiedTime() throws FileSystemException { /* * if (getThreadData().getState() == STATE_WRITING || getThreadData().getState() == STATE_RANDOM_ACCESS) { throw * new FileSystemException("vfs.provider/get-last-modified-writing.error", file); } */ if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/get-last-modified-no-exist.error", fileObject); } try { return fileObject.doGetLastModifiedTime(); } catch (final Exception e) { throw new FileSystemException("vfs.provider/get-last-modified.error", fileObject, e); } }
/** * Returns the last-modified timestamp. * * @return The last modified timestamp. * @throws FileSystemException if an error occurs. */ @Override public long getLastModifiedTime() throws FileSystemException { /* * if (getThreadData().getState() == STATE_WRITING || getThreadData().getState() == STATE_RANDOM_ACCESS) { throw * new FileSystemException("vfs.provider/get-last-modified-writing.error", file); } */ if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/get-last-modified-no-exist.error", fileObject); } try { return fileObject.doGetLastModifiedTime(); } catch (final Exception e) { throw new FileSystemException("vfs.provider/get-last-modified.error", fileObject, e); } }
/** * Returns the last-modified timestamp. * * @return The last modified timestamp. * @throws FileSystemException if an error occurs. */ @Override public long getLastModifiedTime() throws FileSystemException { /* * if (getThreadData().getState() == STATE_WRITING || getThreadData().getState() == STATE_RANDOM_ACCESS) { throw * new FileSystemException("vfs.provider/get-last-modified-writing.error", file); } */ if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/get-last-modified-no-exist.error", fileObject); } try { return fileObject.doGetLastModifiedTime(); } catch (final Exception e) { throw new FileSystemException("vfs.provider/get-last-modified.error", fileObject, e); } }
/** * Sets the last-modified timestamp. * * @param modTime The last modified timestamp. * @throws FileSystemException if an error occurs. */ @Override public void setLastModifiedTime(final long modTime) throws FileSystemException { /* * if (getThreadData().getState() == STATE_WRITING || getThreadData().getState() == STATE_RANDOM_ACCESS) { throw * new FileSystemException("vfs.provider/set-last-modified-writing.error", file); } */ if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/set-last-modified-no-exist.error", fileObject); } try { if (!fileObject.doSetLastModifiedTime(modTime)) { throw new FileSystemException("vfs.provider/set-last-modified.error", fileObject); } } catch (final Exception e) { throw new FileSystemException("vfs.provider/set-last-modified.error", fileObject, e); } }
/** * Sets the last-modified timestamp. * * @param modTime The last modified timestamp. * @throws FileSystemException if an error occurs. */ @Override public void setLastModifiedTime(final long modTime) throws FileSystemException { /* * if (getThreadData().getState() == STATE_WRITING || getThreadData().getState() == STATE_RANDOM_ACCESS) { throw * new FileSystemException("vfs.provider/set-last-modified-writing.error", file); } */ if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/set-last-modified-no-exist.error", fileObject); } try { if (!fileObject.doSetLastModifiedTime(modTime)) { throw new FileSystemException("vfs.provider/set-last-modified.error", fileObject); } } catch (final Exception e) { throw new FileSystemException("vfs.provider/set-last-modified.error", fileObject, e); } }
/** * Sets the last-modified timestamp. * * @param modTime The last modified timestamp. * @throws FileSystemException if an error occurs. */ @Override public void setLastModifiedTime(final long modTime) throws FileSystemException { /* * if (getThreadData().getState() == STATE_WRITING || getThreadData().getState() == STATE_RANDOM_ACCESS) { throw * new FileSystemException("vfs.provider/set-last-modified-writing.error", file); } */ if (!fileObject.getType().hasAttributes()) { throw new FileSystemException("vfs.provider/set-last-modified-no-exist.error", fileObject); } try { if (!fileObject.doSetLastModifiedTime(modTime)) { throw new FileSystemException("vfs.provider/set-last-modified.error", fileObject); } } catch (final Exception e) { throw new FileSystemException("vfs.provider/set-last-modified.error", fileObject, e); } }
private void assertEquals(final FileType expected, final FileType actualFileType) { Assert.assertEquals(expected.getName(), actualFileType.getName()); Assert.assertEquals(expected.hasAttributes(), actualFileType.hasAttributes()); Assert.assertEquals(expected.hasChildren(), actualFileType.hasChildren()); Assert.assertEquals(expected.hasContent(), actualFileType.hasContent()); } }
private void assertEquals(final FileType expected, final FileType actualFileType) { Assert.assertEquals(expected.getName(), actualFileType.getName()); Assert.assertEquals(expected.hasAttributes(), actualFileType.hasAttributes()); Assert.assertEquals(expected.hasChildren(), actualFileType.hasChildren()); Assert.assertEquals(expected.hasContent(), actualFileType.hasContent()); } }
private void assertEquals(final FileType expected, final FileType actualFileType) { Assert.assertEquals(expected.getName(), actualFileType.getName()); Assert.assertEquals(expected.hasAttributes(), actualFileType.hasAttributes()); Assert.assertEquals(expected.hasChildren(), actualFileType.hasChildren()); Assert.assertEquals(expected.hasContent(), actualFileType.hasContent()); } }