com.android.sdklib.repository.remote
Class RemoteSdk

java.lang.Object
  extended by com.android.sdklib.repository.remote.RemoteSdk

public class RemoteSdk
extends java.lang.Object

This class keeps information on the remote SDK repository.


Field Summary
static long DEFAULT_EXPIRATION_PERIOD_MS
          Default expiration delay is 24 hours.
 
Constructor Summary
RemoteSdk(com.android.sdklib.internal.repository.updater.SettingsController settingsController)
           
 
Method Summary
 com.google.common.collect.Multimap<PkgType,RemotePkgInfo> fetch(com.android.sdklib.internal.repository.sources.SdkSources sources, com.android.utils.ILogger logger)
          Fetches the remote list of packages.
 com.android.sdklib.internal.repository.sources.SdkSources fetchSources(long expirationDelayMs, com.android.utils.ILogger logger)
          Returns the SdkSources object listing all sources to load from.
protected  com.android.sdklib.internal.repository.DownloadCache getDownloadCache()
          Returns the DownloadCache Extracted so that we can override this in unit tests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_EXPIRATION_PERIOD_MS

public static final long DEFAULT_EXPIRATION_PERIOD_MS
Default expiration delay is 24 hours.

See Also:
Constant Field Values
Constructor Detail

RemoteSdk

public RemoteSdk(com.android.sdklib.internal.repository.updater.SettingsController settingsController)
Method Detail

fetch

@NonNull
public com.google.common.collect.Multimap<PkgType,RemotePkgInfo> fetch(@NonNull
                                                                               com.android.sdklib.internal.repository.sources.SdkSources sources,
                                                                               @NonNull
                                                                               com.android.utils.ILogger logger)
Fetches the remote list of packages.

This respects the settings from the SettingsController which dictates whether the DownloadCache is used and whether HTTP is enforced over HTTPS.

The call may block on network access. Callers will likely want to invoke this from a thread and make sure the logger is thread-safe with regard to UI updates.

Parameters:
sources - The sources to download from.
logger - A logger to report status & progress.
Returns:
A non-null map of PkgType to RemotePkgInfo describing the remote packages available for install/download.

fetchSources

@NonNull
public com.android.sdklib.internal.repository.sources.SdkSources fetchSources(long expirationDelayMs,
                                                                                      @NonNull
                                                                                      com.android.utils.ILogger logger)
Returns the SdkSources object listing all sources to load from. This includes the main repository.xml, the main addon.xml as well as all the add-ons or sys-img xmls listed in the addons-list.xml.

The method caches the last access and only refresh it if data is either not present or the expiration time has be passed.

Parameters:
expirationDelayMs - The expiration delay in milliseconds. Use DEFAULT_EXPIRATION_PERIOD_MS by default.
logger - A non-null object to log messages. TODO change to an ITaskMonitor to be able to update the caller's progress bar UI, if any.
Returns:
A non-null SdkSources

getDownloadCache

protected com.android.sdklib.internal.repository.DownloadCache getDownloadCache()
Returns the DownloadCache Extracted so that we can override this in unit tests.