Package org.nuxeo.ecm.core.blob
Class PathStrategyShortened
- java.lang.Object
-
- org.nuxeo.ecm.core.blob.PathStrategy
-
- org.nuxeo.ecm.core.blob.PathStrategyShortened
-
public class PathStrategyShortened extends PathStrategy
Extends the defaultPathStrategy.safePath(String)
method to ensure resulting path and file name is not too long.- Since:
- 2021.14
-
-
Field Summary
-
Fields inherited from class org.nuxeo.ecm.core.blob.PathStrategy
dir, HEX, SAFE
-
-
Constructor Summary
Constructors Constructor Description PathStrategyShortened(Path dir)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Path
getPathForKey(String key)
Gets the storage path for a given key.protected String
safePath(String key)
Converts a key to a safe path.protected String
safePathInverse(String path)
Inverse ofPathStrategy.safePath(java.lang.String)
.-
Methods inherited from class org.nuxeo.ecm.core.blob.PathStrategy
atomicCopy, atomicMove, createTempFile, getKeyForPath, isTempFile
-
-
-
-
Constructor Detail
-
PathStrategyShortened
public PathStrategyShortened(Path dir)
-
-
Method Detail
-
safePath
protected String safePath(String key)
Description copied from class:PathStrategy
Converts a key to a safe path.Different keys always map to different safe paths (no collision).
- Overrides:
safePath
in classPathStrategy
- Parameters:
key
- the key- Returns:
- the safe path
-
safePathInverse
protected String safePathInverse(String path)
Description copied from class:PathStrategy
Inverse ofPathStrategy.safePath(java.lang.String)
.- Overrides:
safePathInverse
in classPathStrategy
- Parameters:
path
- the safe path- Returns:
- the key, or
null
if the safe path is invalid
-
getPathForKey
public Path getPathForKey(String key)
Description copied from class:PathStrategy
Gets the storage path for a given key.- Specified by:
getPathForKey
in classPathStrategy
- Parameters:
key
- the key- Returns:
- the file for this key
-
-