public final class LocalRepoLoaderImpl extends java.lang.Object implements LocalRepoLoader
LocalPackages under a given path based on package.xml
files.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PACKAGE_XML_FN
The name of the package metadata file we can read.
|
| Constructor and Description |
|---|
LocalRepoLoaderImpl(java.io.File root,
RepoManager manager,
FallbackLocalRepoLoader fallback,
FileOp fop)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
LocalPackage |
getPackage(java.lang.String pathId,
ProgressIndicator progress)
Gets a single package, specified by
String pathId, loading them if necessary. |
java.util.Map<java.lang.String,LocalPackage> |
getPackages(ProgressIndicator progress)
Gets our packages, loading them if necessary.
|
boolean |
needsUpdate(long lastLocalRefreshMs,
boolean deepCheck)
Checks whether it looks like we need to be reloaded.
|
public static final java.lang.String PACKAGE_XML_FN
public LocalRepoLoaderImpl(@NonNull
java.io.File root,
@NonNull
RepoManager manager,
@Nullable
FallbackLocalRepoLoader fallback,
@NonNull
FileOp fop)
root - The root directory under which we'll look for packages.manager - A RepoManager, notably containing the SchemaModules we'll use for
reading and writing LocalPackagesfallback - The FallbackLocalRepoLoader we'll use if we can't find a package in a
directory.fop - The FileOp to use for file operations. Should be
FileOpUtils.create() for normal operation.@NonNull public java.util.Map<java.lang.String,LocalPackage> getPackages(@NonNull ProgressIndicator progress)
LocalRepoLoadergetPackages in interface LocalRepoLoaderprogress - A ProgressIndicator used to show progress (unimplemented) and
logging.LocalPackage, containing all the packages found in
the given root.@Nullable public LocalPackage getPackage(@NonNull java.lang.String pathId, @NonNull ProgressIndicator progress)
LocalRepoLoaderString pathId, loading them if necessary.
This doesn't affect the overall caching mechanism of this instance.
getPackage in interface LocalRepoLoaderpathId - The path id that specifies this package. See DetailsTypes.progress - A ProgressIndicator used to show progress (unimplemented) and
logging.LocalPackage for pathId or null if the package was not found.public boolean needsUpdate(long lastLocalRefreshMs,
boolean deepCheck)
deepCheck is false, we just check whether .knownPackages has
been updated more recently than lastLocalRefreshMs.
If deepCheck is true, we check whether the hash in .knownPackages
accurately reflects the currently-installed packages (traversing the SDK directory tree to do
so).needsUpdate in interface LocalRepoLoaderlastLocalRefreshMs - The last time a load was donedeepCheck - How vigorously to check. If false, the check should be quite fast.
If true it should still be reasonably fast, but less so.true if a reload is needed, false otherwise.