com.android.sdklib.internal.repository.archives
Class Archive

java.lang.Object
  extended by com.android.sdklib.internal.repository.archives.Archive
All Implemented Interfaces:
IDescription, java.lang.Comparable<Archive>

public class Archive
extends java.lang.Object
implements IDescription, java.lang.Comparable<Archive>

A Archive is the base class for "something" that can be downloaded from the SDK repository.

A package has some attributes (revision, description) and a list of archives which represent the downloadable bits.

Packages are offered by a SdkSource (a download site). The ArchiveInstaller takes care of downloading, unpacking and installing an archive.


Nested Class Summary
static class Archive.Arch
          The Architecture that this archive can be downloaded on.
static class Archive.ChecksumType
          The checksum type.
static class Archive.Os
          The OS that this archive can be downloaded on.
 
Constructor Summary
Archive(Package pkg, Archive.Os os, Archive.Arch arch, java.lang.String url, long size, java.lang.String checksum)
          Creates a new remote archive.
Archive(Package pkg, java.util.Properties props, Archive.Os os, Archive.Arch arch, java.lang.String localOsPath)
          Creates a new local archive.
 
Method Summary
 int compareTo(Archive rhs)
          Archives are compared using their Package ordering.
 void deleteLocal()
          Delete the archive folder if this is a local archive.
 boolean equals(java.lang.Object obj)
          Note: An Archive's equality does NOT depend on the parent Package equality.
 Archive.Arch getArch()
          Returns the archive Archive.Arch enum.
 java.lang.String getChecksum()
          Returns the SHA1 archive checksum, as a 40-char hex.
 Archive.ChecksumType getChecksumType()
          Returns the checksum type, always Archive.ChecksumType.SHA1 right now.
 java.lang.String getLocalOsPath()
          Returns the local OS folder where a local archive is installed.
 java.lang.String getLongDescription()
          Generates a longer description for this archive.
 Archive.Os getOs()
          Returns the archive Archive.Os enum.
 java.lang.String getOsDescription()
          Generates a description for this archive of the OS/Arch supported by this archive.
 Package getParentPackage()
          Returns the package that created and owns this archive.
 java.lang.String getSha1Description()
           
 java.lang.String getShortDescription()
          Generates a short description for this archive.
 long getSize()
          Returns the archive size, an int > 0.
 java.lang.String getSizeDescription()
           
 java.lang.String getUrl()
          Returns the download archive URL, either absolute or relative to the repository xml.
 int hashCode()
          Note: An Archive's hash code does NOT depend on the parent Package hash code.
 boolean isCompatible()
          Returns true if this archive can be installed on the current platform.
 boolean isLocal()
          Returns true if this is a locally installed archive.
 java.lang.String toString()
          Returns the short description of the source, if not null.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Archive

public Archive(Package pkg,
               Archive.Os os,
               Archive.Arch arch,
               java.lang.String url,
               long size,
               java.lang.String checksum)
Creates a new remote archive.


Archive

public Archive(Package pkg,
               java.util.Properties props,
               Archive.Os os,
               Archive.Arch arch,
               java.lang.String localOsPath)
Creates a new local archive. Uses the properties from props first, if possible. Props can be null.

Method Detail

isLocal

public boolean isLocal()
Returns true if this is a locally installed archive. Returns false if this is a remote archive that needs to be downloaded.


getParentPackage

public Package getParentPackage()
Returns the package that created and owns this archive. It should generally not be null.


getSize

public long getSize()
Returns the archive size, an int > 0. Size will be 0 if this a local installed folder of unknown size.


getChecksum

public java.lang.String getChecksum()
Returns the SHA1 archive checksum, as a 40-char hex. Can be empty but not null for local installed folders.


getChecksumType

public Archive.ChecksumType getChecksumType()
Returns the checksum type, always Archive.ChecksumType.SHA1 right now.


getUrl

public java.lang.String getUrl()
Returns the download archive URL, either absolute or relative to the repository xml. Always return null for a local installed folder.

See Also:
getLocalOsPath()

getLocalOsPath

public java.lang.String getLocalOsPath()
Returns the local OS folder where a local archive is installed. Always return null for remote archives.

See Also:
getUrl()

getOs

public Archive.Os getOs()
Returns the archive Archive.Os enum. Can be null for a local installed folder on an unknown OS.


getArch

public Archive.Arch getArch()
Returns the archive Archive.Arch enum. Can be null for a local installed folder on an unknown architecture.


getOsDescription

public java.lang.String getOsDescription()
Generates a description for this archive of the OS/Arch supported by this archive.


toString

public java.lang.String toString()
Returns the short description of the source, if not null. Otherwise returns the default Object toString result.

This is mostly helpful for debugging. For UI display, use the IDescription interface.

Overrides:
toString in class java.lang.Object

getShortDescription

public java.lang.String getShortDescription()
Generates a short description for this archive.

Specified by:
getShortDescription in interface IDescription

getLongDescription

public java.lang.String getLongDescription()
Generates a longer description for this archive.

Specified by:
getLongDescription in interface IDescription

getSizeDescription

public java.lang.String getSizeDescription()

getSha1Description

public java.lang.String getSha1Description()

isCompatible

public boolean isCompatible()
Returns true if this archive can be installed on the current platform.


deleteLocal

public void deleteLocal()
Delete the archive folder if this is a local archive.


compareTo

public int compareTo(Archive rhs)
Archives are compared using their Package ordering.

Specified by:
compareTo in interface java.lang.Comparable<Archive>
See Also:
Package.compareTo(Package)

hashCode

public int hashCode()
Note: An Archive's hash code does NOT depend on the parent Package hash code.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Note: An Archive's equality does NOT depend on the parent Package equality.

Overrides:
equals in class java.lang.Object