NodePath path = NodePath.of(provider.getPath()); if (LOG.isDebugEnabled()) { LOG.debug(MessageFormat.format(
/** * Returns an ID which related to the specified path. * @param path target path * @return the related ID * @throws IOException if failed to prepare the data source * @throws IllegalArgumentException if some parameters were {@code null} */ public String getRelatedId(String path) throws IOException { if (path == null) { throw new IllegalArgumentException("path must not be null"); //$NON-NLS-1$ } NodePath nodePath = NodePath.of(path); Node node = findNode(nodePath); assert node != null; assert node.hasContent(); return node.getId(); }
/** * Returns a data source which related to the specified path. * @param path target path * @return the related data source * @throws IOException if failed to prepare the data source * @throws InterruptedException if interrupted * @throws IllegalArgumentException if some parameters were {@code null} */ public DirectDataSource getRelatedDataSource(String path) throws IOException, InterruptedException { if (path == null) { throw new IllegalArgumentException("path must not be null"); //$NON-NLS-1$ } NodePath nodePath = NodePath.of(path); Node node = findNode(nodePath); assert node != null; assert node.hasContent(); return node.getInstance(); }
/** * Returns the container path of the target path. * @param path target path * @return corresponded container's path * @throws IOException if failed to detect the path * @throws IllegalArgumentException if some parameters were {@code null} */ public String getContainerPath(String path) throws IOException { if (path == null) { throw new IllegalArgumentException("path must not be null"); //$NON-NLS-1$ } NodePath nodePath = NodePath.of(path); Node node = findNode(nodePath); assert node != null; int depth = node.getDepth(); return nodePath.subPath(0, depth).getPathString(); }
/** * Returns the component path of the target path. * The component path is a relative path from the {@link #getContainerPath(String) container path}. * @param path target path * @return corresponded component path * @throws IOException if failed to detect the path * @throws IllegalArgumentException if some parameters were {@code null} */ public String getComponentPath(String path) throws IOException { if (path == null) { throw new IllegalArgumentException("path must not be null"); //$NON-NLS-1$ } NodePath nodePath = NodePath.of(path); Node node = findNode(nodePath); assert node != null; int depth = node.getDepth(); return nodePath.subPath(depth, nodePath.size()).getPathString(); }