/** * Constructs a new mount point by composing its URI from the given scheme * and path. * This static factory method calls * {@link #FsMountPoint(FsScheme, FsNodePath) new FsMountPoint(scheme, path)} * and wraps any thrown {@link URISyntaxException} in an * {@link IllegalArgumentException}. * * @param scheme the {@link #getScheme() scheme}. * @param path the {@link #getPath() path}. * @throws IllegalArgumentException if the composed mount point URI would * not conform to the syntax constraints for mount points. * @return A new mount point. */ public static FsMountPoint create(FsScheme scheme, FsNodePath path) { try { return new FsMountPoint(scheme, path); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
/** * Constructs a new mount point by parsing the given URI. * This static factory method calls * {@link #FsMountPoint(URI, FsUriModifier) new FsMountPoint(uri, modifier)} * and wraps any thrown {@link URISyntaxException} in an * {@link IllegalArgumentException}. * * @param uri the {@link #getUri() URI}. * @param modifier the URI modifier. * @throws IllegalArgumentException if {@code uri} does not conform to the * syntax constraints for mount points. * @return A new mount point. */ public static FsMountPoint create(URI uri, FsUriModifier modifier) { try { return new FsMountPoint(uri, modifier); } catch (URISyntaxException ex) { throw new IllegalArgumentException(ex); } }
assert null != nodeName; return new FsNodePath( new FsMountPoint( scheme, new FsNodePath( new FsMountPoint(enclArchive.toURI(), CANONICALIZE), nodeName)), ROOT); } else { return new FsNodePath( new FsMountPoint(scheme, new FsNodePath(file)), ROOT); assert null != nodeName; return new FsNodePath( new FsMountPoint(enclArchive.toURI(), CANONICALIZE), nodeName); } else {
/** * 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); } }
if (null != enclArchive) { assert null != nodeName; return new FsMountPoint( scheme, new FsNodePath( new FsMountPoint(enclArchive.toURI(), CANONICALIZE), nodeName)).getUri(); } else { return new FsMountPoint(scheme, new FsNodePath(file)).getUri(); new FsMountPoint(enclArchive.toURI(), CANONICALIZE), nodeName).getUri(); } else {
"Missing mount point separator \"" + FsMountPoint.SEPARATOR + '"'); final UriBuilder b = new UriBuilder(true); mountPoint = new FsMountPoint( b.scheme(uri.getScheme()) .path(ssp.substring(0, i + 2)) mountPoint = new FsMountPoint(uri.resolve(DOT), modifier); nodeName = new FsNodeName(mountPoint.getUri().relativize(uri), modifier); } else {
private FsNodePath resolve(final String path) throws URISyntaxException { splitter.split(path); final String pp = splitter.getParentPath(); final FsNodeName nn; final FsNodePath np; if (null != pp) { nn = new FsNodeName( builder.path(splitter.getMemberName()).getUri(), NULL); np = resolve(pp); } else { nn = new FsNodeName( builder.path(path).query(memberQuery).getUri(), CANONICALIZE); np = root; } URI npu; FsNodePath rnp; if (nn.isRoot() || (npu = np.getUri()).isOpaque() || !npu.isAbsolute()) { rnp = np.resolve(nn); } else { final String npup = npu.getPath(); if (!npup.endsWith(SEPARATOR)) npu = new UriBuilder(npu).path(npup + SEPARATOR_CHAR).getUri(); rnp = new FsNodePath(new FsMountPoint(npu), nn); } final FsScheme s = detector.scheme(nn.toString()); if (null != s) rnp = new FsNodePath(new FsMountPoint(s, rnp), ROOT); return rnp; }
final FsNodeName nodeName = this.nodeName; assert (null != enclArchive) == (null != nodeName); mountPoint = new FsMountPoint(scheme, null == enclArchive ? new FsNodePath( file) : new FsNodePath( enclArchive .getController()