Class MakeNextDirectory


  • public abstract class MakeNextDirectory
    extends java.lang.Object
    Abstracts a pattern for using repository template path directories in ManagedRepositoryI.TemplateDirectoryCreator: pinpoint the next directory to use, then try to use it while watching for conflicts from other similar threads.
    Since:
    5.0.3
    • 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 to index == 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 lowest index for getPathFor(long)) and return the corresponding subdirectories.
      abstract void usePath​(java.util.List<java.lang.String> path)
      Actually use the path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MakeNextDirectory

        public MakeNextDirectory()
    • 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 to index == 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 lowest index for getPathFor(long)) and return the corresponding subdirectories.
        Returns:
        the used subdirectories
        Throws:
        ServerError - if the first acceptable path could not be found or used