/** * Creates a symbolic link from {@code link} to the {@code target}, or * copies {@code target} to {@code link} if running on Windows. * <p> * Creating symbolic links on Windows requires administrator permissions, so * copying is a safer fallback. Copy only happens if timestamp and and file * length are different than target * * @param link the location of the symbolic link, or destination of the * copy. * @param target the source of the symbolic link, or source of the copy. * @return {@code true} if the operation succeeds, {@code false} otherwise. */ public static boolean createSymbolicLinkOrCopy(File link, File target) { return createSymbolicLinkOrCopy(link.toPath(), target.toPath()); }
/** * Creates a symbolic link from {@code link} to the {@code target}, or * copies {@code target} to {@code link} if running on Windows. * <p> * Creating symbolic links on Windows requires administrator permissions, so * copying is a safer fallback. Copy only happens if timestamp and and file * length are different than target * * @param link the location of the symbolic link, or destination of the * copy. * @param target the source of the symbolic link, or source of the copy. * @return {@code true} if the operation succeeds, {@code false} otherwise. */ public static boolean createSymbolicLinkOrCopy(File link, File target) { return createSymbolicLinkOrCopy(link.toPath(), target.toPath()); }
/** * Creates a symbolic link from {@code link} to the {@code target}, or * copies {@code target} to {@code link} if running on Windows. * <p> * Creating symbolic links on Windows requires administrator permissions, so * copying is a safer fallback. Copy only happens if timestamp and and file * length are different than target * * @param link the location of the symbolic link, or destination of the * copy. * @param target the source of the symbolic link, or source of the copy. * @return {@code true} if the operation succeeds, {@code false} otherwise. */ public static boolean createSymbolicLinkOrCopy(File link, File target) { return createSymbolicLinkOrCopy(link.toPath(), target.toPath()); }
/** * Creates a symbolic link from {@code link} to the {@code target}, or * copies {@code target} to {@code link} if running on Windows. * <p> * Creating symbolic links on Windows requires administrator permissions, so * copying is a safer fallback. Copy only happens if timestamp and and file * length are different than target * * @param link the location of the symbolic link, or destination of the * copy. * @param target the source of the symbolic link, or source of the copy. * @return {@code true} if the operation succeeds, {@code false} otherwise. */ public static boolean createSymbolicLinkOrCopy(File link, File target) { return createSymbolicLinkOrCopy(link.toPath(), target.toPath()); }
/** * Creates a symbolic link from {@code link} to the {@code target}, or * copies {@code target} to {@code link} if running on Windows. * <p> * Creating symbolic links on Windows requires administrator permissions, so * copying is a safer fallback. Copy only happens if timestamp and and file * length are different than target * * @param link the location of the symbolic link, or destination of the * copy. * @param target the source of the symbolic link, or source of the copy. * @return {@code true} if the operation succeeds, {@code false} otherwise. */ public static boolean createSymbolicLinkOrCopy(File link, File target) { return createSymbolicLinkOrCopy(link.toPath(), target.toPath()); }
/** * Creates a symbolic link from {@code link} to the {@code target}, or * copies {@code target} to {@code link} if running on Windows. * <p> * Creating symbolic links on Windows requires administrator permissions, so * copying is a safer fallback. Copy only happens if timestamp and and file * length are different than target * * @param link the location of the symbolic link, or destination of the * copy. * @param target the source of the symbolic link, or source of the copy. * @return {@code true} if the operation succeeds, {@code false} otherwise. */ public static boolean createSymbolicLinkOrCopy(File link, File target) { return createSymbolicLinkOrCopy(link.toPath(), target.toPath()); }
/** * Creates a symbolic link from {@code link} to the {@code target}, or * copies {@code target} to {@code link} if running on Windows. * <p> * Creating symbolic links on Windows requires administrator permissions, so * copying is a safer fallback. Copy only happens if timestamp and and file * length are different than target * * @param link the location of the symbolic link, or destination of the * copy. * @param target the source of the symbolic link, or source of the copy. * @return {@code true} if the operation succeeds, {@code false} otherwise. */ public static boolean createSymbolicLinkOrCopy(File link, File target) { return createSymbolicLinkOrCopy(link.toPath(), target.toPath()); }
IO.createSymbolicLinkOrCopy(linked, file);
IO.createSymbolicLinkOrCopy(linked, file);
File get(String bsn, Version version, Map<String, String> properties, DownloadListener... listeners) throws Exception { Resource resource = getBridge().get(bsn, version); if (resource == null) return null; ContentCapability contentCapability = ResourceUtils.getContentCapability(resource); if (contentCapability == null) return null; URI url = contentCapability.url(); final File source = client.getCacheFileFor(url); final File link = new File(location, bsn + "-" + version + ".jar"); IO.createSymbolicLinkOrCopy(link, source); Promise<File> go = client.build() .useCache(MAX_STALE) .async(url.toURL()) .map(file -> link); if (listeners.length == 0) return go.getValue(); new DownloadListenerPromise(reporter, name + ": get " + bsn + ";" + version + " " + url, go, listeners); return link; }
File get(String bsn, Version version, Map<String, String> properties, DownloadListener... listeners) throws Exception { Resource resource = getBridge().get(bsn, version); if (resource == null) return null; ContentCapability contentCapability = ResourceUtils.getContentCapability(resource); if (contentCapability == null) return null; URI url = contentCapability.url(); final File source = client.getCacheFileFor(url); final File link = new File(location, bsn + "-" + version + ".jar"); IO.createSymbolicLinkOrCopy(link, source); Promise<File> go = client.build() .useCache(MAX_STALE) .async(url.toURL()) .map(file -> link); if (listeners.length == 0) return go.getValue(); new DownloadListenerPromise(reporter, name + ": get " + bsn + ";" + version + " " + url, go, listeners); return link; }
File get(String bsn, Version version, Map<String, String> properties, DownloadListener... listeners) throws Exception { Resource resource = getBridge().get(bsn, version); if (resource == null) return null; ContentCapability contentCapability = ResourceUtils.getContentCapability(resource); if (contentCapability == null) return null; URI url = contentCapability.url(); final File source = client.getCacheFileFor(url); final File link = new File(location, bsn + "-" + version + ".jar"); IO.createSymbolicLinkOrCopy(link, source); Promise<File> go = client.build() .useCache(MAX_STALE) .async(url.toURL()) .map(file -> link); if (listeners.length == 0) return go.getValue(); new DownloadListenerPromise(reporter, name + ": get " + bsn + ";" + version + " " + url, go, listeners); return link; }
File get(String bsn, Version version, Map<String, String> properties, DownloadListener... listeners) throws Exception { Resource resource = getBridge().get(bsn, version); if (resource == null) return null; ContentCapability contentCapability = ResourceUtils.getContentCapability(resource); if (contentCapability == null) return null; URI url = contentCapability.url(); final File source = client.getCacheFileFor(url); final File link = new File(location, bsn + "-" + version + ".jar"); IO.createSymbolicLinkOrCopy(link, source); Promise<File> go = client.build() .useCache(MAX_STALE) .async(url.toURL()) .map(file -> link); if (listeners.length == 0) return go.getValue(); new DownloadListenerPromise(reporter, name + ": get " + bsn + ";" + version + " " + url, go, listeners); return link; }