private FsPrefixMountPointFilter(final FsMountPoint prefix) { final URI prefixUri = prefix.toHierarchicalUri(); this.prefixScheme = prefixUri.getScheme(); this.prefixPath = prefixUri.getPath(); this.prefixPathLength = prefixPath.length(); this.prefixPathEndsWithSeparator = prefixPath.charAt(prefixPathLength - 1) == SEPARATOR_CHAR; }
@Override public boolean accept(final FsMountPoint mountPoint) { final URI uri = mountPoint.toHierarchicalUri(); final String uriPath; return uri.getScheme().equals(prefixScheme) && (uriPath = uri.getPath()).startsWith(prefixPath) && (prefixPathEndsWithSeparator || uriPath.length() == prefixPathLength || uriPath.charAt(prefixPathLength) == SEPARATOR_CHAR); } }
/** * 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 Iterable<Path> getRootDirectories() { return Collections.singleton((Path) new TPath(getMountPoint().toHierarchicalUri().resolve(SEPARATOR))); }
@Override public int compare(FsController o1, FsController o2) { return o2.getModel().getMountPoint().toHierarchicalUri().compareTo( o1.getModel().getMountPoint().toHierarchicalUri()); } }
if (null != hierarchical) return hierarchical; if (uri.isOpaque()) { final URI mpu = mountPoint.toHierarchicalUri(); final URI enu = nodeName.getUri(); try {
private ObjectName objectName() { return mediator.nameBuilder(FsModel.class) .put("mountPoint", ObjectName.quote( model.getMountPoint().toHierarchicalUri().toString())) .get(); }
@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(); }