/** * Determines if any {@code RepositoryResolver}s are able to handle a given URI Scheme. * <p> * The lookup method uses the standard JAVA SPI (Service Provider Interface) mechanism, by which * all the {@code META-INF/services/org.locationtech.geogig.repository.RepositoryResolver} files * in the classpath will be scanned for fully qualified names of implementing classes. * * @param scheme the URI scheme * @return {@code true} if any resolver could handle the scheme, {@code false} otherwise */ public static boolean resolverAvailableForURIScheme(String scheme) { Preconditions.checkNotNull(scheme, "URI scheme is null"); Iterator<RepositoryResolver> initializers = ServiceLoader.load(RepositoryResolver.class) .iterator(); while (initializers.hasNext()) { RepositoryResolver initializer = initializers.next(); final String resolverClassName = initializer.getClass().getName(); if (!DISABLED_RESOLVERS.contains(resolverClassName) && initializer.canHandleURIScheme(scheme)) { return true; } } return false; }
/** * Determines if any {@code RepositoryResolver}s are able to handle a given URI Scheme. * <p> * The lookup method uses the standard JAVA SPI (Service Provider Interface) mechanism, by which * all the {@code META-INF/services/org.locationtech.geogig.repository.RepositoryResolver} files * in the classpath will be scanned for fully qualified names of implementing classes. * * @param scheme the URI scheme * @return {@code true} if any resolver could handle the scheme, {@code false} otherwise */ public static boolean resolverAvailableForURIScheme(String scheme) { Preconditions.checkNotNull(scheme, "URI scheme is null"); List<RepositoryResolver> resolvers = lookupResolvers(); for (RepositoryResolver resolverImpl : resolvers) { final String resolverClassName = resolverImpl.getClass().getName(); if (!DISABLED_RESOLVERS.contains(resolverClassName) && resolverImpl.canHandleURIScheme(scheme)) { return true; } } return false; }