Package weka.core.packageManagement
Class DefaultPackage
- java.lang.Object
-
- weka.core.packageManagement.Package
-
- weka.core.packageManagement.DefaultPackage
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class DefaultPackage extends Package implements java.io.Serializable
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultPackage(java.io.File packageHome, PackageManager manager)Constructs a new DefaultPackage.DefaultPackage(java.io.File packageHome, PackageManager manager, java.util.Map<?,?> packageMetaData)Constructs an new DefaultPackage.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Clone this package.java.util.List<Dependency>getBaseSystemDependency()Gets the dependency on the base system that this package requires.java.util.List<Dependency>getDependencies()Get the list of packages that this package depends on.java.util.List<Dependency>getIncompatibleDependencies()Gets a list of installed packages that this package depends on that are currently incompatible with this package.java.util.List<Dependency>getIncompatibleDependencies(java.util.List<Package> packages)Gets those packages from the supplied list that this package depends on and are currently incompatible with this package.java.util.List<Dependency>getMissingDependencies()Gets a list of packages that this package depends on that are not currently installed.java.util.List<Dependency>getMissingDependencies(java.util.List<Package> packages)Gets a list of packages that this package depends on that are not in the supplied list of packages.java.lang.StringgetName()Convenience method to return the name of this package.java.net.URLgetPackageURL()Convenience method that returns the URL to the package (i.e the provider's URL).java.util.List<Package>getPrecludedPackages(java.util.List<Package> packages)Compares this package's precluded list (if any) against the list of supplied packages.voidinstall()Install this package.booleanisCompatibleBaseSystem()Returns true if this package is compatible with the currently installed version of the base system.booleanisInstalled()Returns true if this package is already installedstatic voidmain(java.lang.String[] args)voidsetPackageManager(PackageManager p)Set the package manager for this packagevoidsetPackageMetaDataElement(java.lang.Object key, java.lang.Object value)Adds a key, value pair to the meta data map.java.lang.StringtoString()-
Methods inherited from class weka.core.packageManagement.Package
equals, getPackageMetaData, getPackageMetaDataElement, setPackageMetaData
-
-
-
-
Constructor Detail
-
DefaultPackage
public DefaultPackage(java.io.File packageHome, PackageManager manager, java.util.Map<?,?> packageMetaData)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
public DefaultPackage(java.io.File packageHome, PackageManager manager)Constructs a new DefaultPackage.- Parameters:
packageHome- the directory that packages are installed into.manager- the package manager in use.
-
-
Method Detail
-
clone
public java.lang.Object clone()
Clone this package. Only makes a shallow copy of the meta data map
-
setPackageManager
public void setPackageManager(PackageManager p)
Set the package manager for this package- Parameters:
p- the package manager to use
-
getPackageURL
public java.net.URL getPackageURL() throws java.lang.ExceptionConvenience 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:
getPackageURLin classPackage- Returns:
- the URL to the package or null if the URL is not available for some reason
- Throws:
java.lang.Exception- if the URL can't be retrieved for some reason
-
getName
public java.lang.String getName()
Convenience method to return the name of this package.
-
getDependencies
public java.util.List<Dependency> getDependencies() throws java.lang.Exception
Get the list of packages that this package depends on.- Specified by:
getDependenciesin classPackage- Returns:
- the list of packages that this package depends on.
- Throws:
java.lang.Exception- if a problem occurs while getting the list of dependencies.
-
getBaseSystemDependency
public java.util.List<Dependency> getBaseSystemDependency() throws java.lang.Exception
Gets the dependency on the base system that this package requires.- Specified by:
getBaseSystemDependencyin classPackage- Returns:
- the base system dependency(s) for this package
- Throws:
java.lang.Exception- if the base system dependency can't be determined for some reason.
-
getMissingDependencies
public java.util.List<Dependency> getMissingDependencies(java.util.List<Package> packages) throws java.lang.Exception
Gets a list of packages that this package depends on that are not in the supplied list of packages.- Specified by:
getMissingDependenciesin 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:
java.lang.Exception- if the list of missing depenencies can't be determined for some reason.
-
getMissingDependencies
public java.util.List<Dependency> getMissingDependencies() throws java.lang.Exception
Gets a list of packages that this package depends on that are not currently installed.- Specified by:
getMissingDependenciesin classPackage- Returns:
- a list of missing packages that this package depends on.
- Throws:
java.lang.Exception
-
getPrecludedPackages
public java.util.List<Package> getPrecludedPackages(java.util.List<Package> packages) throws java.lang.Exception
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:
getPrecludedPackagesin 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:
java.lang.Exception- if a problem occurs
-
getIncompatibleDependencies
public java.util.List<Dependency> getIncompatibleDependencies(java.util.List<Package> packages) throws java.lang.Exception
Gets those packages from the supplied list that this package depends on and are currently incompatible with this package.- Specified by:
getIncompatibleDependenciesin 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:
java.lang.Exception- if the list of incompatible dependencies can't be generated for some reason.
-
getIncompatibleDependencies
public java.util.List<Dependency> getIncompatibleDependencies() throws java.lang.Exception
Gets a list of installed packages that this package depends on that are currently incompatible with this package.- Specified by:
getIncompatibleDependenciesin classPackage- Returns:
- a list of incompatible installed packages that this package depends on.
- Throws:
java.lang.Exception
-
isCompatibleBaseSystem
public boolean isCompatibleBaseSystem() throws java.lang.ExceptionReturns true if this package is compatible with the currently installed version of the base system.- Specified by:
isCompatibleBaseSystemin classPackage- Returns:
- true if this package is compatible with the main software system.
- Throws:
java.lang.Exception- if a problem occurs while checking compatibility.
-
install
public void install() throws java.lang.ExceptionInstall this package.
-
isInstalled
public boolean isInstalled()
Returns true if this package is already installed- Specified by:
isInstalledin classPackage- Returns:
- true if this package is installed
-
main
public static void main(java.lang.String[] args)
-
setPackageMetaDataElement
public void setPackageMetaDataElement(java.lang.Object key, java.lang.Object value) throws java.lang.ExceptionAdds a key, value pair to the meta data map.- Specified by:
setPackageMetaDataElementin classPackage- Parameters:
key- the keyvalue- the value to add- Throws:
java.lang.Exception- if there is no meta data map to add to.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-