private boolean invariants() { assert null != getUri(); assert null == getUri().getRawFragment(); assert (null != getMountPoint()) == getUri().isAbsolute(); assert null != getNodeName(); if (getUri().isOpaque()) { assert getUri().getRawSchemeSpecificPart().contains(FsMountPoint.SEPARATOR); /*try { assert getUri().equals(new URI(getMountPoint().getUri().getScheme(), getMountPoint().getUri().getSchemeSpecificPart() + toDecodedUri(getNodeName()), null)); } catch (URISyntaxException ex) { throw new AssertionError(ex); }*/ } else if (getUri().isAbsolute()) { assert getUri().normalize() == getUri(); assert getUri().equals(getMountPoint().getUri().resolve(getNodeName().getUri())); } else { assert getUri().normalize() == getUri(); assert getNodeName().getUri() == getUri(); } return true; }
HttpNode( final HttpController controller, final FsNodeName name) { assert null != controller; this.controller = controller; this.name = name.toString(); this.uri = controller.resolve(name).getUri(); }
final FsNodeName nn; if (null == mpp) { assert !path.getUri().isOpaque(); this.enclArchive = null; this.nodeName = null; this.innerArchive = null; } else if ((nn = path.getNodeName()).isRoot()) { assert path.getUri().isOpaque(); if (mpp.getUri().isOpaque()) { this.enclArchive = new TFile(mpp.getMountPoint(), detector); this.nodeName = mpp.getNodeName(); assert path.getUri().isOpaque(); this.enclArchive = new TFile(mp, detector); this.nodeName = nn;
private boolean invariants() { assert null != getUri(); assert getUri().isAbsolute(); assert null == getUri().getRawQuery(); assert null == getUri().getRawFragment(); if (getUri().isOpaque()) { assert getUri().getRawSchemeSpecificPart().endsWith(SEPARATOR); final FsNodePath path = getPath(); assert null != path; assert path.getUri().isAbsolute(); assert null == path.getUri().getRawFragment(); assert 0 != path.getNodeName().getUri().getRawPath().length(); } else { assert getUri().normalize() == getUri(); assert getUri().getRawPath().endsWith(FsNodeName.SEPARATOR); assert null == getPath(); } return true; }
"Doesn't end with mount point separator \"" + SEPARATOR + '"'); path = new FsNodePath(new URI(ssp.substring(0, i)), modifier); final URI pu = path.getUri(); if (!pu.isAbsolute()) throw new QuotedUriSyntaxException(uri, "Path not absolute");
@SuppressWarnings("LeakingThisInConstructor") private TFile( final FsMountPoint mountPoint, final TArchiveDetector detector) { super(mountPoint.toHierarchicalUri()); this.file = new File(super.getPath()); this.detector = detector; final FsNodePath mpp = mountPoint.getPath(); if (null == mpp) { assert !mountPoint.getUri().isOpaque(); this.enclArchive = null; this.nodeName = null; this.innerArchive = null; } else { assert mountPoint.getUri().isOpaque(); if (mpp.getUri().isOpaque()) { this.enclArchive = new TFile(mpp.getMountPoint(), detector); this.nodeName = mpp.getNodeName(); } else { this.enclArchive = null; this.nodeName = null; } this.innerArchive = this; this.controller = getController(mountPoint); } assert invariants(); }
/** * Constructs a new opaque mount point by composing its URI from the given * scheme and path. * * @param scheme the non-{@code null} {@link #getScheme() scheme}. * @param path the non-{@code null} {@link #getPath() path}. * @throws URISyntaxException if the composed mount point URI would not * conform to the syntax constraints for mount points. */ public FsMountPoint(final FsScheme scheme, final FsNodePath path) throws URISyntaxException { final URI pu = path.getUri(); if (!pu.isAbsolute()) throw new QuotedUriSyntaxException(pu, "Path not absolute"); final String penup = path.getNodeName().getUri().getPath(); if (0 == penup.length()) throw new QuotedUriSyntaxException(pu, "Empty node name"); this.uri = new UriBuilder(true) .scheme(scheme.toString()) .path(pu.getScheme() + ':' + pu.getRawSchemeSpecificPart() + SEPARATOR) .toUri(); this.scheme = scheme; this.path = path; assert invariants(); }
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; }
return new FsNodePath( new FsMountPoint(enclArchive.toURI(), CANONICALIZE), nodeName).getUri(); } else { return file.toURI();