public static boolean isFileUri(String value) { String scheme = null; try { scheme = createURI(value).getScheme(); } catch (URISyntaxException ex) { throw new RuntimeException(ex); } return (scheme == null) || scheme.equalsIgnoreCase("file"); }
public static boolean isIvyUri(String value) throws URISyntaxException { return "ivy".equalsIgnoreCase(createURI(value).getScheme()); }
public static boolean isFileUri(String value) { try { return UriType.FILE == getURLType(createURI(value)); } catch (URISyntaxException ex) { throw new RuntimeException(ex); } }
public List<URI> resolveAndDownload(String source, boolean convertToUnix) throws URISyntaxException, IOException { return resolveAndDownloadInternal(createURI(source), null, convertToUnix, true); }
public static boolean isHdfsUri(String value) throws URISyntaxException { return UriType.HDFS == getURLType(createURI(value)); }
public static boolean isIvyUri(String value) throws URISyntaxException { return UriType.IVY == getURLType(createURI(value)); }
public List<URI> resolveAndDownload(String source, boolean convertToUnix) throws URISyntaxException, IOException { return resolveAndDownloadInternal(createURI(source), null, convertToUnix, true); }
private List<URI> resolveAndDownloadInternal(URI source, String subDir, boolean convertToUnix, boolean isLocalAllowed) throws URISyntaxException, IOException { switch (getURLType(source)) { case FILE: return isLocalAllowed ? Collections.singletonList(source) : null; case IVY: return dependencyResolver.downloadDependencies(source); case HDFS: case OTHER: return Collections.singletonList(createURI(downloadResource(source, subDir, convertToUnix))); default: throw new AssertionError(getURLType(source)); } }
private void localizeFunctionResources(String fqfn, List<ResourceUri> resources, String className, FnResources result, boolean doRefreshClassloader) throws URISyntaxException, IOException { // We will download into fn-scoped subdirectories to avoid name collisions (we assume there // are no collisions within the same fn). That doesn't mean we download for every fn. if (LOG.isInfoEnabled()) { LOG.info("Localizing " + resources.size() + " resources for " + fqfn); } for (ResourceUri resource : resources) { URI srcUri = ResourceDownloader.createURI(resource.getUri()); ResourceType rt = FunctionTask.getResourceType(resource.getResourceType()); localizeOneResource(fqfn, srcUri, rt, result); } recentlyLocalizedClasses.add(className); if (doRefreshClassloader) { refreshClassloader(); } }
try { if (ResourceDownloader.isIvyUri(value)) { key = ResourceDownloader.createURI(value).getAuthority();
try { if (ResourceDownloader.isIvyUri(value)) { key = ResourceDownloader.createURI(value).getAuthority();
key = ResourceDownloader.createURI(value).getAuthority(); } else {
key = ResourceDownloader.createURI(value).getAuthority(); } else {
srcUris.add(ResourceDownloader.createURI(resource.getUri()));
private List<URI> resolveAndDownloadInternal(URI source, String subDir, boolean convertToUnix, boolean isLocalAllowed) throws URISyntaxException, IOException { switch (getURLType(source)) { case FILE: return isLocalAllowed ? Lists.newArrayList(source) : null; case IVY: return dependencyResolver.downloadDependencies(source); case OTHER: return Lists.newArrayList( createURI(downloadResource(source, subDir, convertToUnix))); default: throw new AssertionError(getURLType(source)); } }
private void localizeFunctionResources(String fqfn, List<ResourceUri> resources, String className, FnResources result, boolean doRefreshClassloader) throws URISyntaxException, IOException { // We will download into fn-scoped subdirectories to avoid name collisions (we assume there // are no collisions within the same fn). That doesn't mean we download for every fn. if (LOG.isInfoEnabled()) { LOG.info("Localizing " + resources.size() + " resources for " + fqfn); } for (ResourceUri resource : resources) { URI srcUri = ResourceDownloader.createURI(resource.getUri()); ResourceType rt = FunctionTask.getResourceType(resource.getResourceType()); localizeOneResource(fqfn, srcUri, rt, result); } recentlyLocalizedClasses.add(className); if (doRefreshClassloader) { refreshClassloader(); } }
srcUris.add(ResourceDownloader.createURI(resource.getUri()));