Updated the contract of the MountPointChooser-interface

This commit is contained in:
JaniruTEC
2021-06-11 18:30:01 +02:00
parent 364d59fdf7
commit 6cd0fc6807
@@ -34,11 +34,13 @@ import java.util.SortedSet;
* this volume, even if {@code #prepare(Volume, Path)} fails.</i> * this volume, even if {@code #prepare(Volume, Path)} fails.</i>
* *
* <p>If {@code #chooseMountPoint(Volume)} yields no result, the next MPC is executed * <p>If {@code #chooseMountPoint(Volume)} yields no result, the next MPC is executed
* <i>without</i> first calling the {@code #prepare(Volume, Path)} method of the current MPC. * <i>without</i> calling the {@code #prepare(Volume, Path)} method of the current MPC first.
* This is repeated until<br> * This is repeated until<br>
* <ul> * <ul>
* <li><b>either</b> a mountpoint is returned by {@code #chooseMountPoint(Volume)} * <li><b>either</b> a mountpoint is returned by {@code #chooseMountPoint(Volume)}
* and {@code #prepare(Volume, Path)} succeeds or fails, ending the entire operation</li> * and {@code #prepare(Volume, Path)} succeeds or fails, ending the entire operation</li>
* <li><b>or</b> {@code #chooseMountPoint(Volume)} throws an exception,
* ending the entire operation</li>
* <li><b>or</b> no MPC remains and an {@link InvalidMountPointException} is thrown.</li> * <li><b>or</b> no MPC remains and an {@link InvalidMountPointException} is thrown.</li>
* </ul> * </ul>
* If the {@code #prepare(Volume, Path)} method of a MPC fails, the entire * If the {@code #prepare(Volume, Path)} method of a MPC fails, the entire
@@ -72,12 +74,13 @@ public interface MountPointChooser {
* Developers should override this method to find or extract a mountpoint for * Developers should override this method to find or extract a mountpoint for
* the volume <b>without</b> preparing it. Preparation should be done by * the volume <b>without</b> preparing it. Preparation should be done by
* {@link #prepare(Volume, Path)} instead. * {@link #prepare(Volume, Path)} instead.
* Exceptions in this method should be handled gracefully and result in returning * The Mountpoint-Choosing-Operation will fail if an exception occurs.
* {@link Optional#empty()} instead of throwing an exception. * Consequently developers should try to restrict throwing exceptions to those cases where
* aborting the entire operation is sensible. Failure to choose a suitable path should
* be indicated by returning {@link Optional#empty()} instead.
* *
* @param caller The Volume that is calling the method to choose a mountpoint * @param caller The Volume that is calling the method to choose a mountpoint
* @return the chosen path or {@link Optional#empty()} if an exception occurred * @return the chosen path or {@link Optional#empty()} if no mountpoint could be found.
* or no mountpoint could be found.
* @see #isApplicable(Volume) * @see #isApplicable(Volume)
* @see #prepare(Volume, Path) * @see #prepare(Volume, Path)
*/ */