|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.android.sdklib.internal.repository.packages.Package
public abstract class Package
A Package is the base class for "something" that can be downloaded from
the SDK repository.
SdkSource (a download site).
Derived classes must implement the IDescription methods.
| Nested Class Summary | |
|---|---|
static class |
Package.License
License text, with an optional license XML reference. |
static class |
Package.UpdateInfo
Enum for the result of canBeUpdatedBy(Package). |
| Constructor Summary | |
|---|---|
Package(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 | |
|---|---|
abstract Package.UpdateInfo |
canBeUpdatedBy(Package replacementPackage)
Computes whether the given package is a suitable update for the current package. |
int |
compareTo(Package other)
Returns an ordering suitable for display like this: - Tools - Platform-Tools - Built-Tools - Docs. |
protected java.lang.String |
comparisonKey()
Computes a comparison key for each package used by compareTo(Package). |
boolean |
equals(java.lang.Object obj)
|
Archive[] |
getArchives()
Returns the archives defined in this package. |
java.lang.String |
getDescription()
Returns the optional description for all packages (platform, add-on, tool, doc) or for a lib. |
java.lang.String |
getDescUrl()
Returns the optional description URL for all packages (platform, add-on, tool, doc). |
abstract java.io.File |
getInstallFolder(java.lang.String osSdkRoot,
SdkManager sdkManager)
Computes a potential installation folder if an archive of this package were to be installed right away in the given SDK root. |
Package.License |
getLicense()
Returns the optional description for all packages (platform, add-on, tool, doc) or for a lib. |
abstract java.lang.String |
getListDescription()
Returns a description of this package that is suitable for a list display. |
java.lang.String |
getLongDescription()
Returns a long description for an IDescription. |
SdkSource |
getParentSource()
Returns the source that created (and owns) this package. |
java.lang.String |
getReleaseNote()
Returns the optional release note for all packages (platform, add-on, tool, doc) or for a lib. |
java.lang.String |
getReleaseNoteUrl()
Returns the optional release note URL for all packages (platform, add-on, tool, doc). |
abstract FullRevision |
getRevision()
Returns the revision, an int > 0, for all packages (platform, add-on, tool, doc). |
abstract java.lang.String |
getShortDescription()
Returns a short description for an IDescription. |
boolean |
hasArchive(Archive archive)
Returns true if this package contains the exact given archive. |
boolean |
hasCompatibleArchive()
Returns whether the Package has at least one Archive compatible with
the host platform. |
int |
hashCode()
|
protected Archive[] |
initializeArchives(java.util.Properties props,
Archive.Os archiveOs,
Archive.Arch archiveArch,
java.lang.String archiveOsPath)
Called by the constructor to get the initial mArchives array. |
abstract java.lang.String |
installId()
Returns a short, reasonably unique string identifier that can be used to identify this package when installing from the command-line interface. |
boolean |
isLocal()
A package is local (that is 'installed locally') if it contains a single archive that is local. |
boolean |
isObsolete()
Returns true if the package is deemed obsolete, that is it contains an actual <obsolete> element. |
void |
postInstallHook(Archive archive,
ITaskMonitor monitor,
java.io.File installFolder)
Hook called right after an archive has been installed. |
void |
postUnzipFileHook(Archive archive,
ITaskMonitor monitor,
IFileOp fileOp,
java.io.File unzippedFile,
org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipEntry)
Hook called right after a file has been unzipped (during an install). |
boolean |
preInstallHook(Archive archive,
ITaskMonitor monitor,
java.lang.String osSdkRoot,
java.io.File installFolder)
Hook called right before an archive is installed. |
abstract boolean |
sameItemAs(Package pkg)
Returns whether the give package represents the same item as the current package. |
void |
saveProperties(java.util.Properties props)
Save the properties of the current packages in the given Properties object. |
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 |
|---|
public Package(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)
| Method Detail |
|---|
protected Archive[] initializeArchives(java.util.Properties props,
Archive.Os archiveOs,
Archive.Arch archiveArch,
java.lang.String archiveOsPath)
mArchives array.
This is invoked by the local-package constructor and allows mock testing
classes to override the archives created.
This is an implementation details and clients must not
rely on this.
public void saveProperties(java.util.Properties props)
Properties object.
These properties will later be give the constructor that takes a Properties object.
public SdkSource getParentSource()
public boolean isObsolete()
<obsolete> element.
public abstract FullRevision getRevision()
public Package.License getLicense()
public java.lang.String getDescription()
public java.lang.String getDescUrl()
public java.lang.String getReleaseNote()
public java.lang.String getReleaseNoteUrl()
public Archive[] getArchives()
public boolean hasArchive(Archive archive)
public boolean hasCompatibleArchive()
Package has at least one Archive compatible with
the host platform.
public abstract java.lang.String installId()
'android list sdk' will show these IDs and then in turn they can
be provided to 'android update sdk --no-ui --filter' to select
some specific packages.
The identifiers must have the following properties: comparisonKey()
and the Comparable interface.
public java.lang.String toString()
IDescription interface.
toString in class java.lang.Objectpublic abstract java.lang.String getListDescription()
getShortDescription() should be used if you want more details
such as the package revision number or the API, if applicable.
public abstract java.lang.String getShortDescription()
IDescription.
Can be empty but not null.
getShortDescription in interface IDescriptionpublic java.lang.String getLongDescription()
IDescription.
Can be empty but not null.
getLongDescription in interface IDescriptionpublic boolean isLocal()
public abstract java.io.File getInstallFolder(java.lang.String osSdkRoot,
SdkManager sdkManager)
osSdkRoot - The OS path of the SDK root folder.sdkManager - An existing SDK manager to list current platforms and addons.
File corresponding to the directory to use to install this package.
public boolean preInstallHook(Archive archive,
ITaskMonitor monitor,
java.lang.String osSdkRoot,
java.io.File installFolder)
getInstallFolder(java.lang.String, com.android.sdklib.SdkManager) just before installation, so they must not be
created here. This is also called before the previous install dir is removed
so the previous content is still there during upgrade.
archive - The archive that will be installedmonitor - The ITaskMonitor to display errors.osSdkRoot - The OS path of the SDK root folder.installFolder - The folder where the archive will be installed. Note that this
is not the folder where the archive was temporary
unzipped. The installFolder, if it exists, contains the old
archive that will soon be replaced by the new one.
public void postUnzipFileHook(Archive archive,
ITaskMonitor monitor,
IFileOp fileOp,
java.io.File unzippedFile,
org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipEntry)
archive - The archive that is being installed.monitor - The ITaskMonitor to display errors.fileOp - The IFileOp used by the archive installer.unzippedFile - The file that has just been unzipped in the install temp directory.zipEntry - The ZipArchiveEntry that has just been unzipped.
public void postInstallHook(Archive archive,
ITaskMonitor monitor,
java.io.File installFolder)
archive - The archive that has been installed.monitor - The ITaskMonitor to display errors.installFolder - The folder where the archive was successfully installed.
Null if the installation failed, in case the archive needs to
do some cleanup after preInstallHook.public abstract boolean sameItemAs(Package pkg)
pkg - the package to compare.
public abstract Package.UpdateInfo canBeUpdatedBy(Package replacementPackage)
replacementPackage - The potential replacement package.
Package.UpdateInfo values.sameItemAs(Package)public int compareTo(Package other)
sameItemAs(Package) or canBeUpdatedBy(Package).
The order done here is suitable for display, and this may not be the appropriate
order when comparing whether packages are equal or of greater revision -- if you need
to compare revisions, then use getRevision().compareTo(rev) directly.
This compareTo(Package) method is purely an implementation detail to
perform the right ordering of the packages in the list of available or installed packages.
Important: Derived classes should consider overriding comparisonKey()
instead of this method.
compareTo in interface java.lang.Comparable<Package>protected java.lang.String comparisonKey()
compareTo(Package).
The key is a string.
The base package class return a string that encodes the package type,
the revision number and the platform version, if applicable, in the form:
t:N|v:NNNN.P|r:NNNN|
All fields must start by a "letter colon" prefix and end with a vertical pipe (|, ASCII 124).
The string format may change between releases and clients should not
store them outside of the session or expect them to be consistent between
different releases. They are purely an internal implementation details of the
compareTo(Package) method.
Derived classes should get the string from the super class and then append
or insert their own |-separated content.
For example an extra vendor name & path can be inserted before the revision
number, since it has more sorting weight.
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||