Package io.ocfl.core.path.constraint
Class ContentPathConstraints
- java.lang.Object
-
- io.ocfl.core.path.constraint.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ContentPathConstraintProcessor
all()
Constructs a ContentPathConstraintProcessor that applies the minimum path constraints across Unix, Windows, and cloud filesystems.static ContentPathConstraintProcessor
cloud()
Constructs a ContentPathConstraintProcessor that applies the minimum path constraints across cloud providers (Amazon, Azure, Google).static ContentPathConstraintProcessor
minimal()
Constructs a ContentPathConstraintProcessor that does the minimal content path validations as required by the OCFL spec.static ContentPathConstraintProcessor
unix()
Constructs a ContentPathConstraintProcessor that applies the minimum path constraints on a unix based filesystem.static ContentPathConstraintProcessor
windows()
Constructs a ContentPathConstraintProcessor that applies the minimum path constraints on a Windows based filesystem.
-
-
-
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
-
cloud
public static ContentPathConstraintProcessor cloud()
Constructs a ContentPathConstraintProcessor that applies the minimum path constraints across cloud providers (Amazon, Azure, Google). This does not guarantee that every path that passes validation will work with all cloud providers, but the most problematic characters are prohibited.- Returns:
- ContentPathConstraintProcessor
-
all
public static ContentPathConstraintProcessor all()
Constructs a ContentPathConstraintProcessor that applies the minimum path constraints across Unix, Windows, and cloud filesystems. This does not guarantee that every path that passes validation will work on any filesystem, but the most problematic characters across systems 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
-
-