com.android.repository.api
Class ConstantSourceProvider

java.lang.Object
  extended by com.android.repository.api.ConstantSourceProvider
All Implemented Interfaces:
RepositorySourceProvider

public class ConstantSourceProvider
extends java.lang.Object
implements RepositorySourceProvider

A RepositorySourceProvider that provides a single source allowing a single set of schema modules.


Constructor Summary
ConstantSourceProvider(java.lang.String url, java.lang.String uiName, java.util.Collection<SchemaModule> permittedSchemaModules)
           
 
Method Summary
 boolean addSource(RepositorySource source)
          Add a source to this provider, if this provider is editable.
 java.util.List<RepositorySource> getSources(Downloader downloader, SettingsController settings, ProgressIndicator indicator, boolean forceRefresh)
          Gets the RepositorySources from this provider.
 boolean isModifiable()
           
 boolean removeSource(RepositorySource source)
          Remove the given source from this provider, if this provider is editable.
 void save(ProgressIndicator progress)
          If any changes have been made, persist them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantSourceProvider

public ConstantSourceProvider(@NonNull
                              java.lang.String url,
                              @NonNull
                              java.lang.String uiName,
                              @NonNull
                              java.util.Collection<SchemaModule> permittedSchemaModules)
Method Detail

getSources

@NonNull
public java.util.List<RepositorySource> getSources(@Nullable
                                                           Downloader downloader,
                                                           @Nullable
                                                           SettingsController settings,
                                                           @Nullable
                                                           ProgressIndicator indicator,
                                                           boolean forceRefresh)
Description copied from interface: RepositorySourceProvider
Gets the RepositorySources from this provider.

Specified by:
getSources in interface RepositorySourceProvider
Parameters:
downloader - The Downloader, if required by this provider.
settings - The SettingsController, if required by this provider.
indicator - A ProgressIndicator to be used for showing progress and logging.
forceRefresh - If true, this provider should refresh its list of sources, rather than using a cached version.

addSource

public boolean addSource(@NonNull
                         RepositorySource source)
Description copied from interface: RepositorySourceProvider
Add a source to this provider, if this provider is editable. Changes will be reflected in RepositorySourceProvider.getSources(Downloader, SettingsController, ProgressIndicator, boolean), but not persisted until RepositorySourceProvider.save(ProgressIndicator) is called.

Specified by:
addSource in interface RepositorySourceProvider
Parameters:
source - The source to add.
Returns:
true if the source was successfully added, false otherwise.

isModifiable

public boolean isModifiable()
Specified by:
isModifiable in interface RepositorySourceProvider
Returns:
true if this provider can be edited (that is, it has a facility for saving and loading changes), false otherwise.

save

public void save(@NonNull
                 ProgressIndicator progress)
Description copied from interface: RepositorySourceProvider
If any changes have been made, persist them.

Specified by:
save in interface RepositorySourceProvider

removeSource

public boolean removeSource(@NonNull
                            RepositorySource source)
Description copied from interface: RepositorySourceProvider
Remove the given source from this provider, if this provider is editable.

Specified by:
removeSource in interface RepositorySourceProvider
Parameters:
source - The source to remove.
Returns:
true if the source was successfully removed, false otherwise.
See Also:
RepositorySourceProvider.addSource(RepositorySource)