|
|||||||||
| 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
com.android.sdklib.internal.repository.packages.MajorRevisionPackage
com.android.sdklib.internal.repository.packages.MinToolsPackage
com.android.sdklib.internal.repository.packages.SamplePackage
public class SamplePackage
Represents a sample XML node in an SDK repository.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.android.sdklib.internal.repository.packages.Package |
|---|
Package.License, Package.UpdateInfo |
| Field Summary |
|---|
| Fields inherited from interface com.android.sdklib.internal.repository.packages.IMinApiLevelDependency |
|---|
MIN_API_LEVEL_NOT_SPECIFIED |
| Fields inherited from interface com.android.sdklib.internal.repository.packages.IMinToolsDependency |
|---|
MIN_TOOLS_REV_NOT_SPECIFIED |
| Constructor Summary | |
|---|---|
SamplePackage(SdkSource source,
org.w3c.dom.Node packageNode,
java.lang.String nsUri,
java.util.Map<java.lang.String,java.lang.String> licenses)
Creates a new sample package from the attributes and elements of the given XML node. |
|
| Method Summary | |
|---|---|
static Package |
create(IAndroidTarget target,
java.util.Properties props)
Creates a new sample package based on an actual IAndroidTarget (which
must have IAndroidTarget.isPlatform() true) from the SdkManager. |
static Package |
create(java.lang.String archiveOsPath,
java.util.Properties props)
Creates a new sample package from an actual directory path and previously saved properties. |
AndroidVersion |
getAndroidVersion()
Returns the matching platform version. |
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. |
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. |
int |
getMinApiLevel()
Returns the minimal API level required by this extra package, if > 0, or IMinApiLevelDependency.MIN_API_LEVEL_NOT_SPECIFIED if there is no such requirement. |
java.lang.String |
getShortDescription()
Returns a short description for an IDescription. |
java.lang.String |
installId()
Returns a string identifier to install this package from the command line. |
void |
postInstallHook(Archive archive,
ITaskMonitor monitor,
java.io.File installFolder)
Computes a hash of the installed content (in case of successful install.) 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)
Set all the files from a sample package as read-only so that users don't end up modifying sources by mistake in Eclipse (samples are copied if using the NPW > Create from sample.) |
boolean |
preInstallHook(Archive archive,
ITaskMonitor monitor,
java.lang.String osSdkRoot,
java.io.File installFolder)
Makes sure the base /samples folder exists before installing. |
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. |
| Methods inherited from class com.android.sdklib.internal.repository.packages.MinToolsPackage |
|---|
equals, getMinToolsRevision, hashCode |
| Methods inherited from class com.android.sdklib.internal.repository.packages.MajorRevisionPackage |
|---|
canBeUpdatedBy, getRevision |
| Methods inherited from class com.android.sdklib.internal.repository.packages.Package |
|---|
compareTo, comparisonKey, getArchives, getDescription, getDescUrl, getLicense, getParentSource, getReleaseNote, getReleaseNoteUrl, hasArchive, hasCompatibleArchive, initializeArchives, isLocal, isObsolete, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SamplePackage(SdkSource source,
org.w3c.dom.Node packageNode,
java.lang.String nsUri,
java.util.Map<java.lang.String,java.lang.String> licenses)
source - The SdkSource where this is loaded from.packageNode - The XML element being parsed.nsUri - The namespace URI of the originating XML document, to be able to deal with
parameters that vary according to the originating XML schema.licenses - The licenses loaded from the XML originating document.| Method Detail |
|---|
public static Package create(IAndroidTarget target,
java.util.Properties props)
IAndroidTarget (which
must have IAndroidTarget.isPlatform() true) from the SdkManager.
The target must have an existing sample directory that uses the /samples
root form rather than the old form where the samples dir was located under the
platform dir.
This is used to list local SDK folders in which case there is one archive which
URL is the actual samples path location.
By design, this creates a package with one and only one archive.
public static Package create(java.lang.String archiveOsPath,
java.util.Properties props)
throws AndroidVersion.AndroidVersionException
AndroidVersion.AndroidVersionException - if the AndroidVersion can't be restored
from properties.public void saveProperties(java.util.Properties props)
Properties object.
These properties will later be given to a constructor that takes a Properties object.
saveProperties in class MinToolsPackagepublic int getMinApiLevel()
IMinApiLevelDependency.MIN_API_LEVEL_NOT_SPECIFIED if there is no such requirement.
getMinApiLevel in interface IMinApiLevelDependency@NonNull public AndroidVersion getAndroidVersion()
getAndroidVersion in interface IAndroidVersionProviderpublic 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: Package.comparisonKey()
and the Comparable interface.
installId in class Packagepublic java.lang.String getListDescription()
Package.getShortDescription() should be used if you want more details
such as the package revision number or the API, if applicable.
getListDescription in class Packagepublic java.lang.String getShortDescription()
IDescription.
getShortDescription in interface IDescriptiongetShortDescription in class Packagepublic java.lang.String getLongDescription()
IDescription.
The long description is whatever the XML contains for the <description> field,
or the short description if the former is empty.
getLongDescription in interface IDescriptiongetLongDescription in class Package
public java.io.File getInstallFolder(java.lang.String osSdkRoot,
SdkManager sdkManager)
getInstallFolder in class PackageosSdkRoot - 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 sameItemAs(Package pkg)
Package
sameItemAs in class Packagepkg - the package to compare.
public boolean preInstallHook(Archive archive,
ITaskMonitor monitor,
java.lang.String osSdkRoot,
java.io.File installFolder)
Package.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.
preInstallHook in class Packagearchive - 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 postInstallHook(Archive archive,
ITaskMonitor monitor,
java.io.File installFolder)
postInstallHook in class Packagearchive - 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 void postUnzipFileHook(Archive archive,
ITaskMonitor monitor,
IFileOp fileOp,
java.io.File unzippedFile,
org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipEntry)
postUnzipFileHook in class Packagearchive - 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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||