public class DefaultPackageManager extends PackageManager
| Constructor and Description |
|---|
DefaultPackageManager()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
applySettings(Settings settings)
Apply settings.
|
static void |
deleteDir(File dir,
PrintStream... progress) |
List<Dependency> |
getAllDependenciesForPackage(Package target,
Map<String,List<Dependency>> conflicts)
Gets a full list of packages (encapsulated in Dependency objects) that are
required by directly and indirectly by the named target package.
|
List<Package> |
getAllPackages(PrintStream... progress)
Get all packages that the system knows about (i.e.
|
List<Package> |
getAvailablePackages()
Get a list of packages that are not currently installed.
|
Defaults |
getDefaultSettings()
Get the default settings for the default package manager
|
Package |
getInstalledPackageInfo(String packageName)
Get package information on the named installed package.
|
List<Package> |
getInstalledPackages()
Get a list of installed packages.
|
Package |
getPackageArchiveInfo(String packageArchivePath)
Get package information from the supplied package archive file.
|
Package |
getRepositoryPackageInfo(String packageName)
Get package information on the named package from the repository.
|
Package |
getRepositoryPackageInfo(String packageName,
Object version)
Get package information on the named package from the repository.
|
byte[] |
getRepositoryPackageMetaDataOnlyAsZip(PrintStream... progress)
Gets an array of bytes containing a zip of all the repository meta data and
supporting files.
|
byte[] |
getRepositoryPackageMetaDataOnlyAsZipLegacy(PrintStream... progress)
Gets an array of bytes containing a zip of all the repository meta data and
supporting files using the legacy approach.
|
List<Object> |
getRepositoryPackageVersions(String packageName)
Get a list of available versions of the named package.
|
Package |
getURLPackageInfo(URL packageURL)
Get package information on the package at the given URL.
|
String |
installPackageFromArchive(String packageArchivePath,
PrintStream... progress)
Install a package from an archive on the local file system.
|
void |
installPackageFromRepository(String packageName,
Object version,
PrintStream... progress)
Install a package sourced from the repository.
|
String |
installPackageFromURL(URL packageURL,
PrintStream... progress)
Install a package sourced from a given URL.
|
void |
installPackages(List<Package> toInstall,
PrintStream... progress)
Installs all the packages in the supplied list.
|
static void |
main(String[] args) |
void |
uninstallPackage(String packageName,
PrintStream... progress)
Uninstall a package.
|
create, establishProxy, getBaseSystemName, getBaseSystemVersion, getPackageHome, getPackageRepositoryURL, getProxy, setBaseSystemName, setBaseSystemVersion, setPackageHome, setPackageRepositoryURL, setProxy, setProxyAuthentication, setProxyPassword, setProxyUsernamepublic Defaults getDefaultSettings()
getDefaultSettings in class PackageManagerpublic void applySettings(Settings settings)
applySettings in class PackageManagersettings - the settings to applypublic Package getURLPackageInfo(URL packageURL) throws Exception
getURLPackageInfo in class PackageManagerpackageURL - the URL to the package.Exception - if the package meta data can't be retrieved.public Package getRepositoryPackageInfo(String packageName) throws Exception
getRepositoryPackageInfo in class PackageManagerpackageName - the name of the package to get information about.Exception - if the package meta data can't be retrieved.public List<Object> getRepositoryPackageVersions(String packageName) throws Exception
getRepositoryPackageVersions in class PackageManagerpackageName - the name of the package to get versions.Exception - if something goes wrong while trying to retrieve the list
of versions.public Package getRepositoryPackageInfo(String packageName, Object version) throws Exception
getRepositoryPackageInfo in class PackageManagerpackageName - the name of the package to get information about.version - the version of the package to retrieve (may be null if not
applicable).Exception - if the package meta data can't be retrieved.public Package getPackageArchiveInfo(String packageArchivePath) throws Exception
getPackageArchiveInfo in class PackageManagerpackageArchivePath - the path to the package archive fileException - if the package meta data can't be retrieved.public Package getInstalledPackageInfo(String packageName) throws Exception
getInstalledPackageInfo in class PackageManagerpackageName - the name of the package to get information about.Exception - if the package meta data can't be retrieved.public static void deleteDir(File dir, PrintStream... progress) throws Exception
Exceptionpublic void uninstallPackage(String packageName, PrintStream... progress) throws Exception
uninstallPackage in class PackageManagerpackageName - the package to uninstall.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.Exception - if the named package could not be removed for some
reason.public String installPackageFromArchive(String packageArchivePath, PrintStream... progress) throws Exception
installPackageFromArchive in class PackageManagerpackageArchivePath - the path to the package archive file.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.Exception - if the package can't be installed for some reason.public void installPackages(List<Package> toInstall, PrintStream... progress) throws Exception
installPackages in class PackageManagertoInstall - a list of Packages to install.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.Exception - if something goes wrong during the installation process.public List<Dependency> getAllDependenciesForPackage(Package target, Map<String,List<Dependency>> conflicts) throws Exception
getAllDependenciesForPackage in class PackageManagertarget - the package for which a list of dependencies is required.conflicts - will hold any conflicts that are discovered while building
the full dependency list.Exception - if a problem occurs while building the dependency list.public void installPackageFromRepository(String packageName, Object version, PrintStream... progress) throws Exception
installPackageFromRepository in class PackageManagerpackageName - the name of the package to installversion - the version of the package to install (may be null if not
applicable).progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.Exception - if the package can't be installed for some reason.public String installPackageFromURL(URL packageURL, PrintStream... progress) throws Exception
installPackageFromURL in class PackageManagerpackageURL - the URL to the package.progress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.Exception - if the package can't be installed for some reason.public byte[] getRepositoryPackageMetaDataOnlyAsZip(PrintStream... progress) throws Exception
getRepositoryPackageMetaDataOnlyAsZip in class PackageManagerprogress - optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.Exception - if the repository meta data can't be returned as a zippublic byte[] getRepositoryPackageMetaDataOnlyAsZipLegacy(PrintStream... progress) throws Exception
Exceptionpublic List<Package> getAllPackages(PrintStream... progress) throws Exception
getAllPackages in class PackageManagerprogress - optional varargs parameter, that, if supplied is expected
to contain one or more PrintStream objects to write progress to.Exception - if a list of packages can't be determined.public List<Package> getAvailablePackages() throws Exception
getAvailablePackages in class PackageManagerException - if a list of packages can't be determined.public List<Package> getInstalledPackages() throws Exception
getInstalledPackages in class PackageManagerException - if a list of packages can't be determined.public static void main(String[] args)
Copyright © 2016 University of Waikato, Hamilton, NZ. All Rights Reserved.