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 and 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 and Description
    --- | ---
    `java.lang.Object` | `clone()` 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.String` | `getName()` Convenience method to return the name of this package.
    `java.net.URL` | `getPackageURL()` 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.
    `void` | `install()` Install this package.
    `boolean` | `isCompatibleBaseSystem()` Returns true if this package is compatible with the currently installed version of the base system.
    `boolean` | `isInstalled()` Returns true if this package is already installed
    `static void` | `main(java.lang.String[] args)`
    `void` | `setPackageManager(PackageManager p)` Set the package manager for this package
    `void` | `setPackageMetaDataElement(java.lang.Object key, java.lang.Object value)` Adds a key, value pair to the meta data map.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class weka.core.packageManagement.Package

      `equals, getPackageMetaData, getPackageMetaDataElement, setPackageMetaData`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### 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
      Specified by:
        `clone` in class `Package`
      Returns:
        a copy of this package

    - #### 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.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.
      Specified by:
        `getPackageURL` in class `Package`
      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.
      Specified by:
        `getName` in class `Package`
      Returns:
        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:
        `getDependencies` in class `Package`
      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:
        `getBaseSystemDependency` in class `Package`
      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:
        `getMissingDependencies` in class `Package`
      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:
        `getMissingDependencies` in class `Package`
      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:
        `getPrecludedPackages` in class `Package`
      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:
        `getIncompatibleDependencies` in class `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:
        `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:
        `getIncompatibleDependencies` in class `Package`
      Returns:
        a list of incompatible installed packages that this package depends on.
      Throws:
        `java.lang.Exception`

    - #### isCompatibleBaseSystem

          public boolean isCompatibleBaseSystem()
                                         throws java.lang.Exception

      Returns true if this package is compatible with the currently installed version of the base system.
      Specified by:
        `isCompatibleBaseSystem` in class `Package`
      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.Exception

      Install this package.
      Specified by:
        `install` in class `Package`
      Throws:
        `java.lang.Exception` - if something goes wrong during installation.

    - #### isInstalled

          public boolean isInstalled()

      Returns true if this package is already installed
      Specified by:
        `isInstalled` in class `Package`
      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.Exception

      Adds a key, value pair to the meta data map.
      Specified by:
        `setPackageMetaDataElement` in class `Package`
      Parameters:
        `key` - the key
        `value` - 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:
        `toString` in class `java.lang.Object`