Interface ISupportsCustomFileAttributes<F>

Type Parameters:
F - The type of the file used by the implementation. See also IBasicFileSystem.
All Known Implementing Classes:
AmazonS3FileSystem, LocalFileSystem

public interface ISupportsCustomFileAttributes<F>
An interface indicating that a filesystem supports adding custom (user-defined) file attributes. Attributes are always set as key-value pairs. The values are always strings.

A IBasicFileSystem that implements this interface should return any user-defined metadata attributes in the method IBasicFileSystem.getAdditionalFileProperties(Object).

  • Field Details

    • FILE_ATTRIBUTE_PARAM_PREFIX

      static final String FILE_ATTRIBUTE_PARAM_PREFIX
      Prefix for parameter-names, for parameters that should be set as custom metadata attributes. The prefix will not be part of the actual metadata attribute name set on the file, it is only used for filtering parameters to use for the custom metadata and stripped from the name when applying the attributes to the file.
      See Also:
  • Method Details

    • hasCustomFileAttributes

      default boolean hasCustomFileAttributes(@Nullable ParameterList pvl)
      Method to be used in configure.
      Parameters:
      pvl - the ParameterValueList, may be null.
      Returns:
      true when at least one Parameter name starts with "FileAttribute."<F>.
    • getCustomFileAttributes

      default Map<String,String> getCustomFileAttributes(@Nonnull ParameterValueList pvl)
      Gets the custom attributes from the ParameterValueList. The parameter value list is filtered on parameter names with the prefix FILE_ATTRIBUTE_PARAM_PREFIX ("FileAttribute."<F>).

      For each parameter-value, if the parameter-name starts with the prefix "FileAttribute."<F> the prefix is stripped from the name to get the attribute-name and the string-value of the parameter is used to get the attribute-value.

      This is an interface default method that most implementations should not need to override.

      Parameters:
      pvl - ParameterValueList containing inputs to apply as user-defined file metadata
      Returns:
      a Map with the custom file attributes
    • createFile

      void createFile(F file, InputStream contents, Map<String,String> customFileAttributes) throws FileSystemException, IOException
      Creates a file with the given custom file attributes.
      Parameters:
      file -
      contents -
      customFileAttributes -
      Throws:
      FileSystemException
      IOException