com.android.sdklib.internal.repository
Class SdkStats

java.lang.Object
  extended by com.android.sdklib.internal.repository.SdkStats

public class SdkStats
extends java.lang.Object

Retrieves stats on platforms.

This returns information stored on the repository in a different XML file and isn't directly tied to the existence of the listed platforms.


Nested Class Summary
static class SdkStats.PlatformStat
           
static class SdkStats.PlatformStatBase
           
 
Constructor Summary
SdkStats()
           
 
Method Summary
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.
 SparseArray<SdkStats.PlatformStat> getStats()
           
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/addons-list/$N" declaration.
 void load(DownloadCache cache, boolean forceHttp, ITaskMonitor monitor)
           
protected  SparseArray<SdkStats.PlatformStat> parseStatsDocument(org.w3c.dom.Document doc, java.lang.String nsUri, ITaskMonitor monitor)
          Parses all valid platforms found in the XML.
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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SdkStats

public SdkStats()
Method Detail

getStats

public SparseArray<SdkStats.PlatformStat> getStats()

load

public void load(DownloadCache cache,
                 boolean forceHttp,
                 ITaskMonitor monitor)

getXmlSchemaVersion

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/addons-list/$N" declaration.

Returns:
1..SdkStatsConstants.NS_LATEST_VERSION for a valid schema version or 0 if no schema could be found.

validateXml

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. If the XML was correctly validated, returns the schema that worked. If it doesn't validate, returns null and stores the error in outError[0]. If we can't find a validator, returns null and set validatorFound[0] to false.


getDocument

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. On error, returns null and prints a (hopefully) useful message on the monitor.


parseStatsDocument

protected SparseArray<SdkStats.PlatformStat> parseStatsDocument(org.w3c.dom.Document doc,
                                                                java.lang.String nsUri,
                                                                ITaskMonitor monitor)
Parses all valid platforms found in the XML. Changes the stats array returned by getStats() (also returns the value directly, useful for unit tests.)