Class LocalRepoLoaderImpl
- java.lang.Object
-
- com.android.repository.impl.manager.LocalRepoLoaderImpl
-
- All Implemented Interfaces:
LocalRepoLoader
public final class LocalRepoLoaderImpl extends java.lang.Object implements LocalRepoLoader
A utility class that findsLocalPackages under a given path based onpackage.xmlfiles.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPACKAGE_XML_FNThe name of the package metadata file we can read.
-
Constructor Summary
Constructors Constructor Description LocalRepoLoaderImpl(java.nio.file.Path root, RepoManager manager, FallbackLocalRepoLoader fallback)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,LocalPackage>getPackages(ProgressIndicator progress)Gets our packages, loading them if necessary.booleanneedsUpdate(long lastLocalRefreshMs, boolean deepCheck)Checks whether it looks like we need to be reloaded.
-
-
-
Field Detail
-
PACKAGE_XML_FN
public static final java.lang.String PACKAGE_XML_FN
The name of the package metadata file we can read.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LocalRepoLoaderImpl
public LocalRepoLoaderImpl(@NonNull java.nio.file.Path root, @NonNull RepoManager manager, @Nullable FallbackLocalRepoLoader fallback)Constructor. Probably should only be used within repository framework.- Parameters:
root- The root directory under which we'll look for packages.manager- A RepoManager, notably containing theSchemaModules we'll use for reading and writingLocalPackagesfallback- TheFallbackLocalRepoLoaderwe'll use if we can't find a package in a directory.
-
-
Method Detail
-
getPackages
@NonNull public java.util.Map<java.lang.String,LocalPackage> getPackages(@NonNull ProgressIndicator progress)
Description copied from interface:LocalRepoLoaderGets our packages, loading them if necessary.- Specified by:
getPackagesin interfaceLocalRepoLoader- Parameters:
progress- AProgressIndicatorused to show progress (unimplemented) and logging.- Returns:
- A map of install path to
LocalPackage, containing all the packages found in the given root.
-
needsUpdate
public boolean needsUpdate(long lastLocalRefreshMs, boolean deepCheck)Checks whether it looks like we need to be reloaded. IfdeepCheckisfalse, we just check whether.knownPackageshas been updated more recently thanlastLocalRefreshMs. IfdeepCheckistrue, we check whether the hash in.knownPackagesaccurately reflects the currently-installed packages (traversing the SDK directory tree to do so).- Specified by:
needsUpdatein interfaceLocalRepoLoader- Parameters:
lastLocalRefreshMs- The last time a load was donedeepCheck- How vigorously to check. Iffalse, the check should be quite fast. Iftrueit should still be reasonably fast, but less so.- Returns:
trueif a reload is needed,falseotherwise.
-
-