public abstract class PackageManager
extends java.lang.Object
Constructor and Description |
---|
PackageManager() |
Modifier and Type | Method and Description |
---|---|
void |
applySettings(Settings settings)
Apply the supplied settings.
|
static PackageManager |
create() |
void |
establishProxy()
Tries to configure a Proxy object for use in an Authenticator if there is a
proxy defined by the properties http.proxyHost and http.proxyPort, and if
the user has set values for the properties (note, these are not standard
java properties) http.proxyUser and http.proxyPassword.
|
abstract 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.
|
abstract java.util.List<Package> |
getAllPackages(java.io.PrintStream... progress)
Get all packages that the system knows about (i.e.
|
abstract java.util.List<Package> |
getAvailablePackages()
Get a list of packages that are not currently installed.
|
java.lang.String |
getBaseSystemName()
Get the name of the main software system for which we manage packages.
|
java.lang.Object |
getBaseSystemVersion()
Get the current installed version of the main system for which we manage
packages.
|
Defaults |
getDefaultSettings()
Get the default settings of this package manager.
|
abstract Package |
getInstalledPackageInfo(java.lang.String packageName)
Get package information on the named installed package.
|
abstract java.util.List<Package> |
getInstalledPackages()
Get a list of installed packages.
|
abstract Package |
getPackageArchiveInfo(java.lang.String packageArchivePath)
Get package information from the supplied package archive file.
|
java.io.File |
getPackageHome()
Get the location (directory) of installed packages
|
java.net.URL |
getPackageRepositoryURL()
Get the URL to the repository of package meta data.
|
java.net.Proxy |
getProxy()
Get the proxy in use.
|
abstract Package |
getRepositoryPackageInfo(java.lang.String packageName)
Get package information on the named package from the repository.
|
abstract Package |
getRepositoryPackageInfo(java.lang.String packageName,
java.lang.Object version)
Get package information on the named package from the repository.
|
abstract byte[] |
getRepositoryPackageMetaDataOnlyAsZip(java.io.PrintStream... progress)
Gets an array of bytes containing a zip of all the repository meta data and
supporting files.
|
abstract java.util.List<java.lang.Object> |
getRepositoryPackageVersions(java.lang.String packageName)
Get a list of available versions of the named package.
|
abstract Package |
getURLPackageInfo(java.net.URL packageURL)
Get package information on the package at the given URL.
|
abstract java.lang.String |
installPackageFromArchive(java.lang.String packageArchivePath,
java.io.PrintStream... progress)
Install a package from an archive on the local file system.
|
abstract void |
installPackageFromRepository(java.lang.String packageName,
java.lang.Object version,
java.io.PrintStream... progress)
Install a package sourced from the repository.
|
abstract java.lang.String |
installPackageFromURL(java.net.URL packageURL,
java.io.PrintStream... progress)
Install a package sourced from a given URL.
|
abstract void |
installPackages(java.util.List<Package> toInstall,
java.io.PrintStream... progress)
Installs all the packages in the supplied list.
|
void |
setBaseSystemName(java.lang.String baseS)
Set the name of the main software system for which we manage packages.
|
void |
setBaseSystemVersion(java.lang.Object systemV)
Set the current version of the base system for which we manage packages.
|
void |
setPackageHome(java.io.File packageHome)
Set the location (directory) of installed packages.
|
void |
setPackageRepositoryURL(java.net.URL repositoryURL)
Set the URL to the repository of package meta data.
|
void |
setProxy(java.net.Proxy proxyToUse)
Set a proxy to use for accessing the internet (default is no proxy).
|
boolean |
setProxyAuthentication(java.net.URL urlToConnectTo)
Sets an new default Authenticator that will return the values set through
setProxyUsername() and setProxyPassword() (if applicable).
|
void |
setProxyPassword(java.lang.String proxyPassword)
Set the password for authentication with the proxy.
|
void |
setProxyUsername(java.lang.String proxyUsername)
Set the user name for authentication with the proxy.
|
abstract void |
uninstallPackage(java.lang.String packageName,
java.io.PrintStream... progress)
Uninstall a package.
|
public static PackageManager create()
public void establishProxy()
public boolean setProxyAuthentication(java.net.URL urlToConnectTo)
public void setPackageHome(java.io.File packageHome)
packageHome
- the file system location of installed packages.public java.io.File getPackageHome()
public void setBaseSystemName(java.lang.String baseS)
baseS
- the name of the base software systempublic java.lang.String getBaseSystemName()
public void setBaseSystemVersion(java.lang.Object systemV)
systemV
- the current version of the main software system.public java.lang.Object getBaseSystemVersion()
public void setPackageRepositoryURL(java.net.URL repositoryURL)
repositoryURL
- the URL to the repository of package meta data.public java.net.URL getPackageRepositoryURL()
public void setProxy(java.net.Proxy proxyToUse)
proxyToUse
- a proxy to use.public java.net.Proxy getProxy()
public void setProxyUsername(java.lang.String proxyUsername)
proxyUsername
- the user name to use for proxy authentication.public void setProxyPassword(java.lang.String proxyPassword)
proxyPassword
- the password to use for proxy authentication.public Defaults getDefaultSettings()
public void applySettings(Settings settings)
settings
- the settings to applypublic abstract byte[] getRepositoryPackageMetaDataOnlyAsZip(java.io.PrintStream... progress) throws java.lang.Exception
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 abstract Package getPackageArchiveInfo(java.lang.String packageArchivePath) throws java.lang.Exception
packageArchivePath
- the path to the package archive filejava.lang.Exception
- if the package meta data can't be retrieved.public abstract Package getInstalledPackageInfo(java.lang.String packageName) throws java.lang.Exception
packageName
- the name of the package to get information about.java.lang.Exception
- if the package meta data can't be retrieved.public abstract Package getRepositoryPackageInfo(java.lang.String packageName) throws java.lang.Exception
packageName
- the name of the package to get information about.java.lang.Exception
- if the package meta data can't be retrieved.public abstract Package getRepositoryPackageInfo(java.lang.String packageName, java.lang.Object version) throws java.lang.Exception
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 abstract java.util.List<java.lang.Object> getRepositoryPackageVersions(java.lang.String packageName) throws java.lang.Exception
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 abstract Package getURLPackageInfo(java.net.URL packageURL) throws java.lang.Exception
packageURL
- the URL to the package.java.lang.Exception
- if the package meta data can't be retrieved.public abstract java.lang.String installPackageFromArchive(java.lang.String packageArchivePath, java.io.PrintStream... progress) throws java.lang.Exception
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 abstract void installPackageFromRepository(java.lang.String packageName, java.lang.Object version, java.io.PrintStream... progress) throws java.lang.Exception
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 abstract java.lang.String installPackageFromURL(java.net.URL packageURL, java.io.PrintStream... progress) throws java.lang.Exception
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 abstract void installPackages(java.util.List<Package> toInstall, java.io.PrintStream... progress) throws java.lang.Exception
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 abstract void uninstallPackage(java.lang.String packageName, java.io.PrintStream... progress) throws java.lang.Exception
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 abstract java.util.List<Package> getInstalledPackages() throws java.lang.Exception
java.lang.Exception
- if a list of packages can't be determined.public abstract java.util.List<Package> getAllPackages(java.io.PrintStream... progress) throws java.lang.Exception
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 abstract java.util.List<Package> getAvailablePackages() throws java.lang.Exception
java.lang.Exception
- if a list of packages can't be determined.public abstract java.util.List<Dependency> getAllDependenciesForPackage(Package target, java.util.Map<java.lang.String,java.util.List<Dependency>> conflicts) throws java.lang.Exception
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.