Class ContentPathConstraints


  • public final class ContentPathConstraints
    extends Object
    This class provides default path constraints that can be applied to OCFL content paths to attempt to ensure portability across various filesystems. It is useful to apply constraints for filesystems other than the local filesystem, as the local filesystem will readily enforce its own constraints.

    The constraints defined here are generalizations and do not exhaustively target specific filesystems. If you have specific needs that are not addressed here, create a custom ContentPathConstraintProcessor.

    The following constraints are ALWAYS applied:

    • Cannot have a leading OR trailing /
    • Cannot contain the following filenames: '.', '..'
    • Cannot contain an empty filename
    • Windows only: Cannot contain a \
    • Method Detail

      • unix

        public static ContentPathConstraintProcessor unix()
        Constructs a ContentPathConstraintProcessor that applies the minimum path constraints on a unix based filesystem. This does not guarantee that every path that passes validation will work on any unix based filesystem, but the most problematic characters are prohibited.
        Returns:
        ContentPathConstraintProcessor
      • windows

        public static ContentPathConstraintProcessor windows()
        Constructs a ContentPathConstraintProcessor that applies the minimum path constraints on a Windows based filesystem. This does not guarantee that every path that passes validation will work on any Windows based filesystem, but the most problematic characters are prohibited.
        Returns:
        ContentPathConstraintProcessor
      • minimal

        public static ContentPathConstraintProcessor minimal()
        Constructs a ContentPathConstraintProcessor that does the minimal content path validations as required by the OCFL spec.
        • Cannot have a leading OR trailing /
        • Cannot contain the following filenames: '.', '..'
        • Cannot contain an empty filename
        • Windows only: Cannot contain a \
        Returns:
        ContentPathConstraintProcessor