Package ome.services.blitz.repo.path
Class MakeNextDirectory
- java.lang.Object
-
- ome.services.blitz.repo.path.MakeNextDirectory
-
public abstract class MakeNextDirectory extends java.lang.Object
Abstracts a pattern for using repository template path directories inManagedRepositoryI.TemplateDirectoryCreator
: pinpoint the next directory to use, then try to use it while watching for conflicts from other similar threads.- Since:
- 5.0.3
-
-
Constructor Summary
Constructors Constructor Description MakeNextDirectory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.util.List<java.lang.String>
getPathFor(long index)
Get the subdirectories to create for the given index, the first directories to be created corresponding toindex == 0
.abstract boolean
isAcceptable(java.util.List<java.lang.String> path)
If the circumstances (filesystem, etc.) are such that it is okay to use the given subdirectories.java.util.List<java.lang.String>
useFirstAcceptable()
Use the first acceptable path (that with the lowestindex
forgetPathFor(long)
) and return the corresponding subdirectories.abstract void
usePath(java.util.List<java.lang.String> path)
Actually use the path.
-
-
-
Method Detail
-
getPathFor
public abstract java.util.List<java.lang.String> getPathFor(long index)
Get the subdirectories to create for the given index, the first directories to be created corresponding toindex == 0
.- Parameters:
index
- a non-negative index- Returns:
- the subdirectories for that index
-
isAcceptable
public abstract boolean isAcceptable(java.util.List<java.lang.String> path) throws ServerError
If the circumstances (filesystem, etc.) are such that it is okay to use the given subdirectories.- Parameters:
path
- the subdirectories to possibly use- Returns:
- if the path may be used
- Throws:
ServerError
- if the path could not be tested
-
usePath
public abstract void usePath(java.util.List<java.lang.String> path) throws ServerError
Actually use the path. For instance, may create the directory or ensure that it exists.- Parameters:
path
- the subdirectories to use- Throws:
ServerError
- if the path could not be used
-
useFirstAcceptable
public java.util.List<java.lang.String> useFirstAcceptable() throws ServerError
Use the first acceptable path (that with the lowestindex
forgetPathFor(long)
) and return the corresponding subdirectories.- Returns:
- the used subdirectories
- Throws:
ServerError
- if the first acceptable path could not be found or used
-
-