Class LocalSourceProvider
- java.lang.Object
-
- com.android.repository.impl.sources.LocalSourceProvider
-
- All Implemented Interfaces:
RepositorySourceProvider
public class LocalSourceProvider extends java.lang.Object implements RepositorySourceProvider
ReadsRepositorySources saved locally. Allows sources to be saved, modified, and deleted.
-
-
Constructor Summary
Constructors Constructor Description LocalSourceProvider(java.nio.file.Path location, java.util.Collection<SchemaModule<?>> allowedModules)Create a newLocalSourceProvider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddSource(RepositorySource source)Add a source to this provider.java.util.List<RepositorySource>getSources(Downloader downloader, ProgressIndicator logger, boolean forceRefresh)Gets theRepositorySources from this provider.booleanisModifiable()Whether this source is modifiable.booleanremoveSource(RepositorySource source)Remove the specified source from this provider.voidsave(ProgressIndicator progress)Saves any changes in the sources to the specified file.voidsetRepoManager(RepoManager manager)Sets theRepoManagerthat will use this provider.
-
-
-
Constructor Detail
-
LocalSourceProvider
public LocalSourceProvider(@NonNull java.nio.file.Path location, @NonNull java.util.Collection<SchemaModule<?>> allowedModules)Create a newLocalSourceProvider.- Parameters:
location- The file to load from and save to.allowedModules- TheSchemaModules that are allowed to be used by sources provided by this provider.
-
-
Method Detail
-
setRepoManager
public void setRepoManager(@NonNull RepoManager manager)Sets theRepoManagerthat will use this provider.
-
getSources
@NonNull public java.util.List<RepositorySource> getSources(@Nullable Downloader downloader, @NonNull ProgressIndicator logger, boolean forceRefresh)
Gets theRepositorySources from this provider.- Specified by:
getSourcesin interfaceRepositorySourceProvider- Parameters:
downloader- Unused by this provider.logger- AProgressIndicatorto be used for showing progress and logging.forceRefresh- If true, this provider should refresh its list of sources, rather than return any cached sources.
-
addSource
public boolean addSource(@NonNull RepositorySource source)Add a source to this provider. Note that it won't be persisted untilsave(ProgressIndicator)is called.- Specified by:
addSourcein interfaceRepositorySourceProvider- Parameters:
source- The source to add.- Returns:
trueif the source was successfully added,falseotherwise.
-
isModifiable
public boolean isModifiable()
Whether this source is modifiable.- Specified by:
isModifiablein interfaceRepositorySourceProvider- Returns:
truefor this class.
-
save
public void save(@NonNull ProgressIndicator progress)Saves any changes in the sources to the specified file.- Specified by:
savein interfaceRepositorySourceProvider- Parameters:
progress-ProgressIndicatorfor logging.
-
removeSource
public boolean removeSource(@NonNull RepositorySource source)Remove the specified source from this provider. Note that the remove won't be persisted untilsave(ProgressIndicator)is called.- Specified by:
removeSourcein interfaceRepositorySourceProvider- Parameters:
source- The source to remove.- Returns:
trueif a matching source was found and actually removed.- See Also:
RepositorySourceProvider.addSource(RepositorySource)
-
-