Class Package

java.lang.Object
weka.core.packageManagement.Package
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
DefaultPackage

public abstract class Package extends Object implements Cloneable, Serializable
Abstract base class for Packages.
Version:
$Revision: 52462 $
Author:
mhall (mhall{[at]}pentaho{[dot]}com)
See Also:
  • Constructor Details

    • Package

      public Package()
  • Method Details

    • setPackageMetaData

      public void setPackageMetaData(Map<?,?> metaData)
      Set the meta data for this package.
      Parameters:
      metaData - the meta data for this package.
    • getPackageMetaData

      public Map<?,?> getPackageMetaData()
      Get the meta data for this package.
      Returns:
      the meta data for this package
    • getName

      public abstract String getName()
      Convenience method to return the name of this package.
      Returns:
      the name of this package.
    • getPackageURL

      public abstract URL getPackageURL() throws Exception
      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.
      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
    • equals

      public boolean equals(Package toCompare)
      Compare the supplied package to this package. Simply does an equals() comparison between the two. Concrete subclasses should override if they wan't to do comparison based on specific package meta data elements.
      Parameters:
      toCompare - the package to compare against.
      Returns:
      true if the supplied package is equal to this one.
    • getDependencies

      public abstract List<Dependency> getDependencies() throws Exception
      Get the list of packages that this package depends on.
      Returns:
      the list of packages that this package depends on.
      Throws:
      Exception - if a problem occurs while getting the list of dependencies.
    • isInstalled

      public abstract boolean isInstalled()
      Returns true if this package is already installed
      Returns:
      true if this package is installed
    • install

      public abstract void install() throws Exception
      Install this package.
      Throws:
      Exception - if something goes wrong during installation.
    • isCompatibleBaseSystem

      public abstract boolean isCompatibleBaseSystem() throws Exception
      Returns true if this package is compatible with the currently installed version of the base system.
      Returns:
      true if this package is compatible with the main software system.
      Throws:
      Exception - if a problem occurs while checking compatibility.
    • getBaseSystemDependency

      public abstract List<Dependency> getBaseSystemDependency() throws Exception
      Gets the dependency on the base system that this package requires.
      Returns:
      the base system dependency(s) for this package
      Throws:
      Exception - if the base system dependency can't be determined for some reason.
    • getMissingDependencies

      public abstract List<Dependency> getMissingDependencies() throws Exception
      Gets a list of packages that this package depends on that are not currently installed.
      Returns:
      a list of missing packages that this package depends on.
      Throws:
      Exception
    • getMissingDependencies

      public abstract List<Dependency> getMissingDependencies(List<Package> packages) throws Exception
      Gets a list of packages that this package depends on that are not in the supplied list of packages.
      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.
    • getIncompatibleDependencies

      public abstract List<Dependency> getIncompatibleDependencies() throws Exception
      Gets a list of installed packages that this package depends on that are currently incompatible with this package.
      Returns:
      a list of incompatible installed packages that this package depends on.
      Throws:
      Exception
    • getPrecludedPackages

      public abstract List<Package> getPrecludedPackages(List<Package> packages) throws 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
      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

      public abstract List<Dependency> getIncompatibleDependencies(List<Package> packages) throws Exception
      Gets those packages from the supplied list that this package depends on and are currently incompatible with this package.
      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.
    • getPackageMetaDataElement

      public Object getPackageMetaDataElement(Object key)
      Gets the package meta data element associated with the supplied key.
      Parameters:
      key - the key to use to look up a value in the meta data
      Returns:
      the meta data value or null if the key does not exist.
    • setPackageMetaDataElement

      public abstract void setPackageMetaDataElement(Object key, Object value) throws Exception
      Adds a key, value pair to the meta data map.
      Parameters:
      key - the key
      value - the value to add
      Throws:
      Exception - if there is no meta data map to add to.
    • clone

      public abstract Object clone()