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(java.io.File dir,
java.io.PrintStream... progress) |
java.util.List<Dependency> |
getAllDependenciesForPackage(Package target,
java.util.Map<java.lang.String,java.util.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.
|
java.util.List<Package> |
getAllPackages(java.io.PrintStream... progress)
Get all packages that the system knows about (i.e.
|
java.util.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(java.lang.String packageName)
Get package information on the named installed package.
|
java.util.List<Package> |
getInstalledPackages()
Get a list of installed packages.
|
Package |
getPackageArchiveInfo(java.lang.String packageArchivePath)
Get package information from the supplied package archive file.
|
Package |
getRepositoryPackageInfo(java.lang.String packageName)
Get package information on the named package from the repository.
|
Package |
getRepositoryPackageInfo(java.lang.String packageName,
java.lang.Object version)
Get package information on the named package from the repository.
|
byte[] |
getRepositoryPackageMetaDataOnlyAsZip(java.io.PrintStream... progress)
Gets an array of bytes containing a zip of all the repository meta data and
supporting files.
|
byte[] |
getRepositoryPackageMetaDataOnlyAsZipLegacy(java.io.PrintStream... progress)
Gets an array of bytes containing a zip of all the repository meta data and
supporting files using the legacy approach.
|
java.util.List<java.lang.Object> |
getRepositoryPackageVersions(java.lang.String packageName)
Get a list of available versions of the named package.
|
Package |
getURLPackageInfo(java.net.URL packageURL)
Get package information on the package at the given URL.
|
java.lang.String |
installPackageFromArchive(java.lang.String packageArchivePath,
java.io.PrintStream... progress)
Install a package from an archive on the local file system.
|
void |
installPackageFromRepository(java.lang.String packageName,
java.lang.Object version,
java.io.PrintStream... progress)
Install a package sourced from the repository.
|
java.lang.String |
installPackageFromURL(java.net.URL packageURL,
java.io.PrintStream... progress)
Install a package sourced from a given URL.
|
void |
installPackages(java.util.List<Package> toInstall,
java.io.PrintStream... progress)
Installs all the packages in the supplied list.
|
static void |
main(java.lang.String[] args) |
void |
uninstallPackage(java.lang.String packageName,
java.io.PrintStream... progress)
Uninstall a package.
|
create, establishProxy, getBaseSystemName, getBaseSystemVersion, getPackageHome, getPackageRepositoryURL, getProxy, setBaseSystemName, setBaseSystemVersion, setPackageHome, setPackageRepositoryURL, setProxy, setProxyAuthentication, setProxyPassword, setProxyUsername
public Defaults getDefaultSettings()
getDefaultSettings
in class PackageManager
public void applySettings(Settings settings)
applySettings
in class PackageManager
settings
- the settings to applypublic Package getURLPackageInfo(java.net.URL packageURL) throws java.lang.Exception
getURLPackageInfo
in class PackageManager
packageURL
- the URL to the package.java.lang.Exception
- if the package meta data can't be retrieved.public Package getRepositoryPackageInfo(java.lang.String packageName) throws java.lang.Exception
getRepositoryPackageInfo
in class PackageManager
packageName
- the name of the package to get information about.java.lang.Exception
- if the package meta data can't be retrieved.public java.util.List<java.lang.Object> getRepositoryPackageVersions(java.lang.String packageName) throws java.lang.Exception
getRepositoryPackageVersions
in class PackageManager
packageName
- the name of the package to get versions.java.lang.Exception
- if something goes wrong while trying to retrieve the list
of versions.public Package getRepositoryPackageInfo(java.lang.String packageName, java.lang.Object version) throws java.lang.Exception
getRepositoryPackageInfo
in class PackageManager
packageName
- the name of the package to get information about.version
- the version of the package to retrieve (may be null if not
applicable).java.lang.Exception
- if the package meta data can't be retrieved.public Package getPackageArchiveInfo(java.lang.String packageArchivePath) throws java.lang.Exception
getPackageArchiveInfo
in class PackageManager
packageArchivePath
- the path to the package archive filejava.lang.Exception
- if the package meta data can't be retrieved.public Package getInstalledPackageInfo(java.lang.String packageName) throws java.lang.Exception
getInstalledPackageInfo
in class PackageManager
packageName
- the name of the package to get information about.java.lang.Exception
- if the package meta data can't be retrieved.public static void deleteDir(java.io.File dir, java.io.PrintStream... progress) throws java.lang.Exception
java.lang.Exception
public void uninstallPackage(java.lang.String packageName, java.io.PrintStream... progress) throws java.lang.Exception
uninstallPackage
in class PackageManager
packageName
- the package to uninstall.progress
- optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.java.lang.Exception
- if the named package could not be removed for some
reason.public java.lang.String installPackageFromArchive(java.lang.String packageArchivePath, java.io.PrintStream... progress) throws java.lang.Exception
installPackageFromArchive
in class PackageManager
packageArchivePath
- 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.java.lang.Exception
- if the package can't be installed for some reason.public void installPackages(java.util.List<Package> toInstall, java.io.PrintStream... progress) throws java.lang.Exception
installPackages
in class PackageManager
toInstall
- 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.java.lang.Exception
- if something goes wrong during the installation process.public java.util.List<Dependency> getAllDependenciesForPackage(Package target, java.util.Map<java.lang.String,java.util.List<Dependency>> conflicts) throws java.lang.Exception
getAllDependenciesForPackage
in class PackageManager
target
- the package for which a list of dependencies is required.conflicts
- will hold any conflicts that are discovered while building
the full dependency list.java.lang.Exception
- if a problem occurs while building the dependency list.public void installPackageFromRepository(java.lang.String packageName, java.lang.Object version, java.io.PrintStream... progress) throws java.lang.Exception
installPackageFromRepository
in class PackageManager
packageName
- 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.java.lang.Exception
- if the package can't be installed for some reason.public java.lang.String installPackageFromURL(java.net.URL packageURL, java.io.PrintStream... progress) throws java.lang.Exception
installPackageFromURL
in class PackageManager
packageURL
- 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.java.lang.Exception
- if the package can't be installed for some reason.public byte[] getRepositoryPackageMetaDataOnlyAsZip(java.io.PrintStream... progress) throws java.lang.Exception
getRepositoryPackageMetaDataOnlyAsZip
in class PackageManager
progress
- optional varargs parameter, that, if supplied, is expected
to contain one or more PrintStream objects to write progress to.java.lang.Exception
- if the repository meta data can't be returned as a zippublic byte[] getRepositoryPackageMetaDataOnlyAsZipLegacy(java.io.PrintStream... progress) throws java.lang.Exception
java.lang.Exception
public java.util.List<Package> getAllPackages(java.io.PrintStream... progress) throws java.lang.Exception
getAllPackages
in class PackageManager
progress
- optional varargs parameter, that, if supplied is expected
to contain one or more PrintStream objects to write progress to.java.lang.Exception
- if a list of packages can't be determined.public java.util.List<Package> getAvailablePackages() throws java.lang.Exception
getAvailablePackages
in class PackageManager
java.lang.Exception
- if a list of packages can't be determined.public java.util.List<Package> getInstalledPackages() throws java.lang.Exception
getInstalledPackages
in class PackageManager
java.lang.Exception
- if a list of packages can't be determined.public static void main(java.lang.String[] args)