Class DefaultContentPathConstraintProcessor
- java.lang.Object
-
- edu.wisc.library.ocfl.core.path.constraint.DefaultContentPathConstraintProcessor
-
- All Implemented Interfaces:
ContentPathConstraintProcessor
public class DefaultContentPathConstraintProcessor extends Object implements ContentPathConstraintProcessor
This class enforces constraints on content paths. At the minimum, content paths must adhere to the following constraints:- Cannot have a leading OR trailing /
- Cannot contain the following filenames: '.', '..'
- Cannot contain an empty filename
- Windows only: Cannot contain a \
Additional custom constraints may be applied as needed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultContentPathConstraintProcessor.BuilderUse this to construct a ContentPathConstraintProcessor
-
Constructor Summary
Constructors Constructor Description DefaultContentPathConstraintProcessor(PathConstraintProcessor storagePathConstraintProcessor, PathConstraintProcessor contentPathConstraintProcessor)Constructs a new ContentPathConstraintProcessor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(String contentPath, String storagePath)Applies the configured path constrains to the content path and storage path.static DefaultContentPathConstraintProcessor.Builderbuilder()Use this to construct a ContentPathConstraintProcessor
-
-
-
Constructor Detail
-
DefaultContentPathConstraintProcessor
public DefaultContentPathConstraintProcessor(PathConstraintProcessor storagePathConstraintProcessor, PathConstraintProcessor contentPathConstraintProcessor)
Constructs a new ContentPathConstraintProcessor. Alternatively, useDefaultContentPathConstraintProcessor.Builder.- Parameters:
storagePathConstraintProcessor- the constraints to apply to storage pathscontentPathConstraintProcessor- the constraints to apply to content paths
-
-
Method Detail
-
builder
public static DefaultContentPathConstraintProcessor.Builder builder()
Use this to construct a ContentPathConstraintProcessor- Returns:
- builder
-
apply
public void apply(String contentPath, String storagePath)
Applies the configured path constrains to the content path and storage path. If any constraints fail, aPathConstraintExceptionis thrown.- Specified by:
applyin interfaceContentPathConstraintProcessor- Parameters:
contentPath- the content path relative a version's content directorystoragePath- the content path relative the OCFL repository root
-
-