Class AddFileProcessor
- java.lang.Object
-
- edu.wisc.library.ocfl.core.inventory.AddFileProcessor
-
public class AddFileProcessor extends Object
Encapsulates logic for adding files to an object, both adding them to the inventory and moving them into staging.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAddFileProcessor.Builder
-
Constructor Summary
Constructors Constructor Description AddFileProcessor(InventoryUpdater inventoryUpdater, Path stagingDir, DigestAlgorithm digestAlgorithm)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AddFileProcessor.Builderbuilder()Map<String,Path>processFileWithDigest(String digest, Path sourcePath, String destinationPath, OcflOption... options)Adds the file at sourcePath to the object at the specified destinationPath.Map<String,Path>processPath(Path sourcePath, OcflOption... ocflOptions)Adds all of the files at or under the sourcePath to the root of the object.Map<String,Path>processPath(Path sourcePath, String destinationPath, OcflOption... options)Adds all of the files at or under the sourcePath to the object at the specified destinationPath.
-
-
-
Constructor Detail
-
AddFileProcessor
public AddFileProcessor(InventoryUpdater inventoryUpdater, Path stagingDir, DigestAlgorithm digestAlgorithm)
- Parameters:
inventoryUpdater- the inventory updaterstagingDir- the staging directory to move files intodigestAlgorithm- the digest algorithm- See Also:
AddFileProcessor.Builder
-
-
Method Detail
-
builder
public static AddFileProcessor.Builder builder()
-
processPath
public Map<String,Path> processPath(Path sourcePath, OcflOption... ocflOptions)
Adds all of the files at or under the sourcePath to the root of the object.- Parameters:
sourcePath- the file or directory to addocflOptions- options for how to move the files- Returns:
- a map of logical paths to their corresponding file within the stagingDir for newly added files
-
processPath
public Map<String,Path> processPath(Path sourcePath, String destinationPath, OcflOption... options)
Adds all of the files at or under the sourcePath to the object at the specified destinationPath.- Parameters:
sourcePath- the file or directory to adddestinationPath- the location to insert the file or directory at within the objectoptions- options for how to move the files- Returns:
- a map of logical paths to their corresponding file within the stagingDir for newly added files
-
processFileWithDigest
public Map<String,Path> processFileWithDigest(String digest, Path sourcePath, String destinationPath, OcflOption... options)
Adds the file at sourcePath to the object at the specified destinationPath. The provided digest is trusted to be accurate. If it is not, or is the wrong algorithm, then the object will be corrupted.- Parameters:
digest- the digest of the file. MUST use the same algorithm as the object's content digest algorithmsourcePath- the file or directory to adddestinationPath- the location to insert the file or directory at within the objectoptions- options for how to move the files- Returns:
- a map of logical paths to their corresponding file within the stagingDir for newly added files
-
-