/** * Returns the mount point of this (virtual) file system as * defined by the {@linkplain #getModel() model}. * * @return The mount point of this (virtual) file system as * defined by the {@linkplain #getModel() model}. */ public final FsMountPoint getMountPoint() { return model.getMountPoint(); }
@Override public boolean accept(FsModel model) { return filter.accept(model.getMountPoint()); } }
protected FsAbstractModel( final FsMountPoint mountPoint, final @CheckForNull FsModel parent) { if (!Objects.equals(mountPoint.getParent(), (null == parent ? null : parent.getMountPoint()))) throw new IllegalArgumentException("Parent/Member mismatch!"); this.mountPoint = mountPoint; this.parent = parent; }
protected FsDecoratingModel(final FsModel model) { super(model.getMountPoint(), model.getParent()); this.model = model; }
@Override public String getMountPoint() { return model.getMountPoint().toString(); }
/** * A template method for resolving the resource URI which is required to * look up the {@link KeyProvider} for the mount point of the file system * with the given model. * <p> * The implementation in the class {@link ZipDriver} returns the * expression {@code model.getMountPoint().toHierarchicalUri()} * in order to improve the readability of the URI in comparison to the * expression {@code model.getMountPoint().getUri()}. * * @param model the file system model. * @return The URI which represents the file system model's mount point. * @see <a href="http://java.net/jira/browse/TRUEZIP-72">#TRUEZIP-72</a> */ public URI mountPointUri(FsModel model) { return model.getMountPoint().toHierarchicalUri(); }
@Override public final OutputService<ZipDriverEntry> newOutput( FsModel model, BitField<FsAccessOption> options, FsController controller, FsNodeName name, @CheckForNull @WillNotClose InputService<ZipDriverEntry> input) throws IOException { throw new FsReadOnlyFileSystemException(model.getMountPoint()); } }
@Override public String getMountPointOfParent() { final FsModel parent = model.getParent(); return null != parent ? parent.getMountPoint().toString() : null; }
FsMountPoint getMountPoint() { return getController().getModel().getMountPoint(); }
FileController(final FsModel model) { super(model); if (null != model.getParent()) throw new IllegalArgumentException(); URI uri = model.getMountPoint().getUri(); if ('\\' == separatorChar && null != uri.getRawAuthority()) { try { // Postfix: Move Windows UNC host from authority to path // component because the File class can't deal with this. // Note that the authority parameter must not be null and that // you cannot use the UriBuilder class - using either of these // would result in the authority property of the new URI object // being equal to the original value again. // Note that the use of the buggy URI constructor is authorized // for this case! // See http://java.net/jira/browse/TRUEZIP-288 . uri = new URI( uri.getScheme(), "", TWO_SEPARATORS + uri.getAuthority() + uri.getPath(), uri.getQuery(), uri.getFragment()); } catch (URISyntaxException ex) { throw new AssertionError(ex); } } this.target = Paths.get(uri); }
private @Nullable FsScheme getScheme() { if (this != innerArchive) return null; final FsController controller = this.controller; if (null != controller) return controller.getModel().getMountPoint().getScheme(); return getArchiveDetector().scheme(file.getPath()); }
@Override public int compare(FsController o1, FsController o2) { return o2.getModel().getMountPoint().toHierarchicalUri().compareTo( o1.getModel().getMountPoint().toHierarchicalUri()); } }
@Override public final FsController newController( final FsManager context, final FsModel model, final @CheckForNull FsController parent) throws ServiceConfigurationError { assert null == parent ? null == model.getParent() : parent.getModel().equals(model.getParent()); return driver(model.getMountPoint()).newController(context, model, parent); }
/** * Returns a mount point for the given (virtual) directory {@code tree}. * If {@code tree} refers to a (prospective) archive file, then its mount * point gets returned. * Otherwise, the path of the file object is used to create a new mount * point. * Note that making up an artificial mount point like this will only work * for use with {@link FsManager#accept(Filter, Visitor)}. * * @param tree a file or directory in the (virtual) file system space. * @return A mount point for the given (virtual) directory tree. */ @SuppressWarnings("deprecation") static FsMountPoint mountPoint(final TFile tree) { if (tree.isArchive()) { return tree.getController().getModel().getMountPoint(); // fast path //return tree.getNodePath().getMountPoint(); // slow path } try { return new FsMountPoint(new URI(tree.getFile().toURI() + "/"), CANONICALIZE); } catch (final URISyntaxException ex) { throw new AssertionError(ex); } }
private ObjectName objectName() { return mediator.nameBuilder(FsModel.class) .put("mountPoint", ObjectName.quote( model.getMountPoint().toHierarchicalUri().toString())) .get(); }
@Override public FsModel newModel( FsDriver context, FsMountPoint mountPoint, FsModel parent) { assert null == parent ? null == mountPoint.getParent() : parent.getMountPoint().equals(mountPoint.getParent()); return manager.newModel(context, mountPoint, parent); }
@Override public void sync() throws FsSyncWarningException, FsSyncException { new FsSync() .filter(FsControllerFilter.forPrefix(model.getMountPoint())) .run(); } }
/** * {@inheritDoc} * <p> * The implementation in the class {@link FsDriver} forwards the call to * the given file system manager. */ @Override public final FsModel newModel( FsManager context, FsMountPoint mountPoint, FsModel parent) { assert null == parent ? null == mountPoint.getParent() : parent.getMountPoint().equals(mountPoint.getParent()); return context.newModel(this, mountPoint, parent); }
@Override public final FsModel newModel( final FsManager context, final FsMountPoint mountPoint, final FsModel parent) { assert null == parent ? null == mountPoint.getParent() : parent.getMountPoint().equals(mountPoint.getParent()); return driver(mountPoint).newModel(context, mountPoint, parent); }
@Override public void checkAccess( final BitField<FsAccessOption> options, final FsNodeName name, final BitField<Access> types) throws IOException { try { controller.checkAccess(options, name, types); } catch (final ControlFlowException ex) { if (!name.isRoot() || null == findKeyException(ex)) throw ex; getParent().checkAccess( options, getModel() .getMountPoint() .getPath() .resolve(name) .getNodeName(), types); } }