1 /* 2 * Copyright (C) 2005-2015 Schlichtherle IT Services. 3 * All rights reserved. Use is subject to license terms. 4 */ 5 package net.java.truevfs.kernel.spec; 6 7 import net.java.truecommons.shed.BitField; 8 import net.java.truecommons.shed.Filter; 9 import net.java.truecommons.shed.ImplementationsShouldExtend; 10 import net.java.truecommons.shed.Visitor; 11 12 /** 13 * A container which creates {@linkplain FsController} file system controllers 14 * and manages their life cycle. 15 * <p> 16 * Implementations should be thread-safe. 17 * 18 * @see FsController 19 * @see FsModel 20 * @author Christian Schlichtherle 21 */ 22 @ImplementationsShouldExtend(FsAbstractManager.class) 23 public interface FsManager 24 extends FsModel.Factory<FsDriver>, 25 FsController.Factory<FsArchiveDriver<? extends FsArchiveEntry>>{ 26 27 /** 28 * Returns the thread-safe file system controller for the given mount point. 29 * The life cycle of the returned file system controller gets managed by 30 * this manager, i.e. it gets remembered for future lookup and 31 * {@link FsController#sync synchronization}. 32 * 33 * @param driver the composite file system driver which shall get used to 34 * create a new file system controller if required. 35 * @param mountPoint the mount point of the file system. 36 * @return The thread-safe file system controller for the given mount point. 37 */ 38 FsController controller(FsCompositeDriver driver, FsMountPoint mountPoint); 39 40 /** 41 * Filters all managed file system controllers using the given 42 * {@code filter} and accepts the given {@code visitor} to them. 43 * 44 * @param filter the filter for the managed file system controllers. 45 * Calls to its {@link Filter#accept(Object)} method should terminate 46 * quickly without an exception and must not have any side effects on 47 * the given controllers! 48 * @param visitor the visitor of the filtered file system controllers. 49 * Calls to its {@link Visitor#visit(Object)} method may have side 50 * effects on the given controllers, e.g. by calling 51 * {@link FsController#sync(BitField)}. 52 * @return {@code visitor} 53 * @throws X at the discretion of the given visitor. 54 * Throwing this exception aborts the visiting. 55 */ 56 <X extends Exception, V extends Visitor<? super FsController, X>> 57 V accept(Filter<? super FsController> filter, V visitor) throws X; 58 }