com.android.sdklib.internal.repository.packages
Class FullRevisionPackage

java.lang.Object
  extended by com.android.sdklib.internal.repository.packages.Package
      extended by com.android.sdklib.internal.repository.packages.FullRevisionPackage
All Implemented Interfaces:
IDescription, IFullRevisionProvider, java.lang.Comparable<Package>
Direct Known Subclasses:
BuildToolPackage, PlatformToolPackage, ToolPackage

public abstract class FullRevisionPackage
extends Package
implements IFullRevisionProvider

Represents a package in an SDK repository that has a FullRevision, which is a multi-part revision number (major.minor.micro) and an optional preview revision.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.android.sdklib.internal.repository.packages.Package
Package.License, Package.UpdateInfo
 
Constructor Summary
FullRevisionPackage(SdkSource source, java.util.Properties props, int revision, java.lang.String license, java.lang.String description, java.lang.String descUrl, Archive.Os archiveOs, Archive.Arch archiveArch, java.lang.String archiveOsPath)
          Manually create a new package with one archive and the given attributes.
 
Method Summary
 Package.UpdateInfo canBeUpdatedBy(Package replacementPackage)
          Computes whether the given package is a suitable update for the current package.
 boolean equals(java.lang.Object obj)
           
 FullRevision getRevision()
          Returns the revision, an int > 0, for all packages (platform, add-on, tool, doc).
 int hashCode()
           
 void saveProperties(java.util.Properties props)
          Save the properties of the current packages in the given Properties object.
 
Methods inherited from class com.android.sdklib.internal.repository.packages.Package
compareTo, comparisonKey, getArchives, getDescription, getDescUrl, getInstallFolder, getLicense, getListDescription, getLongDescription, getParentSource, getReleaseNote, getReleaseNoteUrl, getShortDescription, hasArchive, hasCompatibleArchive, initializeArchives, installId, isLocal, isObsolete, postInstallHook, postUnzipFileHook, preInstallHook, sameItemAs, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.android.sdklib.internal.repository.packages.IFullRevisionProvider
sameItemAs
 

Constructor Detail

FullRevisionPackage

public FullRevisionPackage(SdkSource source,
                           java.util.Properties props,
                           int revision,
                           java.lang.String license,
                           java.lang.String description,
                           java.lang.String descUrl,
                           Archive.Os archiveOs,
                           Archive.Arch archiveArch,
                           java.lang.String archiveOsPath)
Manually create a new package with one archive and the given attributes. This is used to create packages from local directories in which case there must be one archive which URL is the actual target location.

Properties from props are used first when possible, e.g. if props is non null.

By design, this creates a package with one and only one archive.

Method Detail

getRevision

public FullRevision getRevision()
Description copied from class: Package
Returns the revision, an int > 0, for all packages (platform, add-on, tool, doc). Can be 0 if this is a local package of unknown revision.

Specified by:
getRevision in class Package

saveProperties

public void saveProperties(java.util.Properties props)
Description copied from class: Package
Save the properties of the current packages in the given Properties object. These properties will later be give the constructor that takes a Properties object.

Overrides:
saveProperties in class Package

hashCode

public int hashCode()
Overrides:
hashCode in class Package

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Package

canBeUpdatedBy

public Package.UpdateInfo canBeUpdatedBy(Package replacementPackage)
Computes whether the given package is a suitable update for the current package.

A specific case here is that a release package can update a preview, whereas a preview can only update another preview.

Computes whether the given package is a suitable update for the current package.

An update is just that: a new package that supersedes the current one. If the new package does not represent the same item or if it has the same or lower revision as the current one, it's not an update.

Specified by:
canBeUpdatedBy in class Package
Parameters:
replacementPackage - The potential replacement package.
Returns:
One of the Package.UpdateInfo values.
See Also:
Package.sameItemAs(Package)