Package weka.core.packageManagement
Class DefaultPackage
java.lang.Object
weka.core.packageManagement.Package
weka.core.packageManagement.DefaultPackage
- All Implemented Interfaces:
Serializable
,Cloneable
A concrete implementation of Package that uses Java properties files/classes
to manage package meta data. Assumes that meta data for individual packages
is stored on the central repository (or possibly in a local cache - both
accessible via http) in properties files that live in a sub-directory with
the same name as the package. Furthermore, each property file is assumed to
be named as the version number of the package in question with a ".props"
extension. A "Latest.props" file should exist for each package and should
always hold meta data on the latest version of a package.
- Version:
- $Revision: 52462 $
- Author:
- mhall (mhall{[at]}pentaho{[dot]}com).
- See Also:
-
Constructor Summary
ConstructorDescriptionDefaultPackage
(File packageHome, PackageManager manager) Constructs a new DefaultPackage.DefaultPackage
(File packageHome, PackageManager manager, Map<?, ?> packageMetaData) Constructs an new DefaultPackage. -
Method Summary
Modifier and TypeMethodDescriptionclone()
Clone this package.Gets the dependency on the base system that this package requires.Get the list of packages that this package depends on.Gets a list of installed packages that this package depends on that are currently incompatible with this package.getIncompatibleDependencies
(List<Package> packages) Gets those packages from the supplied list that this package depends on and are currently incompatible with this package.Gets a list of packages that this package depends on that are not currently installed.getMissingDependencies
(List<Package> packages) Gets a list of packages that this package depends on that are not in the supplied list of packages.getName()
Convenience method to return the name of this package.Convenience method that returns the URL to the package (i.e the provider's URL).getPrecludedPackages
(List<Package> packages) Compares this package's precluded list (if any) against the list of supplied packages.void
install()
Install this package.boolean
Returns true if this package is compatible with the currently installed version of the base system.boolean
Returns true if this package is already installedstatic void
void
Set the package manager for this packagevoid
setPackageMetaDataElement
(Object key, Object value) Adds a key, value pair to the meta data map.toString()
Methods inherited from class weka.core.packageManagement.Package
equals, getPackageMetaData, getPackageMetaDataElement, setPackageMetaData
-
Constructor Details
-
DefaultPackage
Constructs an new DefaultPackage.- Parameters:
packageHome
- the directory that packages are installed into.manager
- the package manager in use.packageMetaData
- A Map of package meta data for this package.
-
DefaultPackage
Constructs a new DefaultPackage.- Parameters:
packageHome
- the directory that packages are installed into.manager
- the package manager in use.
-
-
Method Details
-
clone
Clone this package. Only makes a shallow copy of the meta data map -
setPackageManager
Set the package manager for this package- Parameters:
p
- the package manager to use
-
getPackageURL
Convenience method that returns the URL to the package (i.e the provider's URL). This information is assumed to be stored in the package meta data.- Specified by:
getPackageURL
in classPackage
- Returns:
- the URL to the package or null if the URL is not available for some reason
- Throws:
Exception
- if the URL can't be retrieved for some reason
-
getName
Convenience method to return the name of this package. -
getDependencies
Get the list of packages that this package depends on.- Specified by:
getDependencies
in classPackage
- Returns:
- the list of packages that this package depends on.
- Throws:
Exception
- if a problem occurs while getting the list of dependencies.
-
getBaseSystemDependency
Gets the dependency on the base system that this package requires.- Specified by:
getBaseSystemDependency
in classPackage
- Returns:
- the base system dependency(s) for this package
- Throws:
Exception
- if the base system dependency can't be determined for some reason.
-
getMissingDependencies
Gets a list of packages that this package depends on that are not in the supplied list of packages.- Specified by:
getMissingDependencies
in classPackage
- Parameters:
packages
- a list of packages to compare this package's dependencies against.- Returns:
- those packages that this package depends on that aren't in the supplied list.
- Throws:
Exception
- if the list of missing depenencies can't be determined for some reason.
-
getMissingDependencies
Gets a list of packages that this package depends on that are not currently installed.- Specified by:
getMissingDependencies
in classPackage
- Returns:
- a list of missing packages that this package depends on.
- Throws:
Exception
-
getPrecludedPackages
Compares this package's precluded list (if any) against the list of supplied packages. Any packages in the supplied list that match (by name and version constraints) any in the precluded list are returned- Specified by:
getPrecludedPackages
in classPackage
- Parameters:
packages
- a list of packages to compare against those in this package's precluded list- Returns:
- a list of packages that are covered by those in the precluded list
- Throws:
Exception
- if a problem occurs
-
getIncompatibleDependencies
Gets those packages from the supplied list that this package depends on and are currently incompatible with this package.- Specified by:
getIncompatibleDependencies
in classPackage
- Parameters:
packages
- a list of packages to compare this package's dependencies against- Returns:
- those packages from the supplied list that are incompatible with respect to this package's dependencies
- Throws:
Exception
- if the list of incompatible dependencies can't be generated for some reason.
-
getIncompatibleDependencies
Gets a list of installed packages that this package depends on that are currently incompatible with this package.- Specified by:
getIncompatibleDependencies
in classPackage
- Returns:
- a list of incompatible installed packages that this package depends on.
- Throws:
Exception
-
isCompatibleBaseSystem
Returns true if this package is compatible with the currently installed version of the base system.- Specified by:
isCompatibleBaseSystem
in classPackage
- Returns:
- true if this package is compatible with the main software system.
- Throws:
Exception
- if a problem occurs while checking compatibility.
-
install
Install this package. -
isInstalled
public boolean isInstalled()Returns true if this package is already installed- Specified by:
isInstalled
in classPackage
- Returns:
- true if this package is installed
-
main
-
setPackageMetaDataElement
Adds a key, value pair to the meta data map.- Specified by:
setPackageMetaDataElement
in classPackage
- Parameters:
key
- the keyvalue
- the value to add- Throws:
Exception
- if there is no meta data map to add to.
-
toString
-