|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.android.sdklib.internal.repository.sources.SdkSource
public abstract class SdkSource
An sdk-addon or sdk-repository source, i.e. a download site.
It may be a full repository or an add-on only repository.
A repository describes one or Packages available for download.
| Constructor Summary | |
|---|---|
SdkSource(java.lang.String url,
java.lang.String uiName)
Constructs a new source for the given repository URL. |
|
| Method Summary | |
|---|---|
void |
clearPackages()
Clear the internal packages list. |
int |
compareTo(SdkSource rhs)
Implementation of the Comparable interface. |
boolean |
equals(java.lang.Object obj)
Two repo source are equal if they have the same URL. |
protected abstract org.w3c.dom.Document |
findAlternateToolsXml(java.io.InputStream xml)
In case we fail to load an XML, examine the XML to see if it matches a future schema that as at least a tools node that we could load to update the
SDK Manager. |
protected abstract java.lang.String[] |
getDefaultXmlFileUrls()
Returns the basename of the default URLs to try to download the XML manifest. |
protected org.w3c.dom.Document |
getDocument(java.io.InputStream xml,
ITaskMonitor monitor)
Takes an XML document as a string as parameter and returns a DOM for it. |
java.lang.String |
getFetchError()
Returns the last fetch error description. |
java.lang.String |
getLongDescription()
Returns a description of the given element. |
protected abstract int |
getNsLatestVersion()
Returns SdkRepoConstants.NS_LATEST_VERSION or SdkAddonConstants.NS_LATEST_VERSION. |
protected abstract java.lang.String |
getNsPattern()
Returns SdkRepoConstants.NS_PATTERN or SdkAddonConstants.NS_PATTERN. |
protected abstract java.lang.String |
getNsUri()
Returns SdkRepoConstants.NS_URI or SdkAddonConstants.NS_URI. |
Package[] |
getPackages()
Returns the list of known packages found by the last call to load(). |
protected abstract java.lang.String |
getRootElementName()
|
protected abstract java.lang.String |
getSchemaUri(int version)
Returns SdkRepoConstants.getSchemaUri() or SdkAddonConstants.getSchemaUri(). |
java.lang.String |
getShortDescription()
Returns a description of the given element. |
java.lang.String |
getUiName()
Returns the UI-visible name of the source. |
java.lang.String |
getUrl()
Returns the URL of the XML file for this source. |
protected int |
getXmlSchemaVersion(java.io.InputStream xml)
Manually parses the root element of the XML to extract the schema version at the end of the xmlns:sdk="http://schemas.android.com/sdk/android/repository/$N" declaration. |
protected abstract java.io.InputStream |
getXsdStream(int version)
Returns SdkRepoConstants.getXsdStream() or SdkAddonConstants.getXsdStream(). |
int |
hashCode()
|
abstract boolean |
isAddonSource()
Returns true if this is an addon source. |
boolean |
isEnabled()
Indicates if the source is enabled. |
abstract boolean |
isSysImgSource()
Returns true if this is a system-image source. |
void |
load(DownloadCache cache,
ITaskMonitor monitor,
boolean forceHttp)
Tries to fetch the repository index for the given URL and updates the package list. |
protected boolean |
parsePackages(org.w3c.dom.Document doc,
java.lang.String nsUri,
ITaskMonitor monitor)
Parse all packages defined in the SDK Repository XML and creates a new mPackages array with them. |
void |
setEnabled(boolean enabled)
Changes whether the source is marked as enabled. |
protected void |
setPackages(Package[] packages)
|
java.lang.String |
toString()
Returns the short description of the source, if not null. |
protected java.lang.String |
validateXml(java.io.InputStream xml,
java.lang.String url,
int version,
java.lang.String[] outError,
java.lang.Boolean[] validatorFound)
Validates this XML against one of the requested SDK Repository schemas. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SdkSource(java.lang.String url,
java.lang.String uiName)
url - The source URL. Cannot be null. If the URL ends with a /, the default
repository.xml filename will be appended automatically.uiName - The UI-visible name of the source. Can be null.| Method Detail |
|---|
public abstract boolean isAddonSource()
public abstract boolean isSysImgSource()
protected abstract java.lang.String[] getDefaultXmlFileUrls()
protected abstract int getNsLatestVersion()
protected abstract java.lang.String getNsUri()
protected abstract java.lang.String getNsPattern()
protected abstract java.lang.String getSchemaUri(int version)
protected abstract java.lang.String getRootElementName()
protected abstract java.io.InputStream getXsdStream(int version)
protected abstract org.w3c.dom.Document findAlternateToolsXml(@Nullable
java.io.InputStream xml)
throws java.io.IOException
tools node that we could load to update the
SDK Manager.
xml - The input XML stream. Can be null.
java.io.IOExceptionpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic int compareTo(SdkSource rhs)
Comparable interface.
Simply compares the URL using the string's default ordering.
compareTo in interface java.lang.Comparable<SdkSource>public java.lang.String getUiName()
public java.lang.String getUrl()
public Package[] getPackages()
load(com.android.sdklib.internal.repository.DownloadCache, com.android.sdklib.internal.repository.ITaskMonitor, boolean) to load the packages.
protected void setPackages(Package[] packages)
public void clearPackages()
getPackages() will return
null till load() is called.
public boolean isEnabled()
public void setEnabled(boolean enabled)
load will either return an empty list (if disabled) or
the actual package list (if enabled.)
enabled - True for the source to be enabled (can be loaded), false otherwise.public java.lang.String toString()
IDescription interface.
toString in class java.lang.Objectpublic java.lang.String getShortDescription()
IDescriptionObject.toString() would provide.
getShortDescription in interface IDescriptionpublic java.lang.String getLongDescription()
IDescriptionObject.toString() would provide.
getLongDescription in interface IDescriptionpublic java.lang.String getFetchError()
public void load(DownloadCache cache,
ITaskMonitor monitor,
boolean forceHttp)
getPackages() after this. It will be
null in case of error, in which case getFetchError() can be used to an
error message.
protected java.lang.String validateXml(java.io.InputStream xml,
java.lang.String url,
int version,
java.lang.String[] outError,
java.lang.Boolean[] validatorFound)
protected int getXmlSchemaVersion(java.io.InputStream xml)
SdkRepoConstants.NS_LATEST_VERSION for a valid schema version
or 0 if no schema could be found.
protected boolean parsePackages(org.w3c.dom.Document doc,
java.lang.String nsUri,
ITaskMonitor monitor)
protected org.w3c.dom.Document getDocument(java.io.InputStream xml,
ITaskMonitor monitor)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||