Class Package

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Direct Known Subclasses:
    DefaultPackage

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

      Constructors 
      Constructor Description
      Package()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.Object clone()  
      boolean equals​(Package toCompare)
      Compare the supplied package to this package.
      abstract java.util.List<Dependency> getBaseSystemDependency()
      Gets the dependency on the base system that this package requires.
      abstract java.util.List<Dependency> getDependencies()
      Get the list of packages that this package depends on.
      abstract java.util.List<Dependency> getIncompatibleDependencies()
      Gets a list of installed packages that this package depends on that are currently incompatible with this package.
      abstract 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.
      abstract java.util.List<Dependency> getMissingDependencies()
      Gets a list of packages that this package depends on that are not currently installed.
      abstract 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.
      abstract java.lang.String getName()
      Convenience method to return the name of this package.
      java.util.Map<?,​?> getPackageMetaData()
      Get the meta data for this package.
      java.lang.Object getPackageMetaDataElement​(java.lang.Object key)
      Gets the package meta data element associated with the supplied key.
      abstract java.net.URL getPackageURL()
      Convenience method that returns the URL to the package (i.e the provider's URL).
      abstract java.util.List<Package> getPrecludedPackages​(java.util.List<Package> packages)
      Compares this package's precluded list (if any) against the list of supplied packages.
      abstract void install()
      Install this package.
      abstract boolean isCompatibleBaseSystem()
      Returns true if this package is compatible with the currently installed version of the base system.
      abstract boolean isInstalled()
      Returns true if this package is already installed
      void setPackageMetaData​(java.util.Map<?,​?> metaData)
      Set the meta data for this package.
      abstract void setPackageMetaDataElement​(java.lang.Object key, java.lang.Object value)
      Adds a key, value pair to the meta data map.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Package

        public Package()
    • Method Detail

      • setPackageMetaData

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

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

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

        public abstract 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.
        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
      • 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 java.util.List<Dependency> getDependencies()
                                                            throws java.lang.Exception
        Get the list of packages that this package depends on.
        Returns:
        the list of packages that this package depends on.
        Throws:
        java.lang.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 java.lang.Exception
        Install this package.
        Throws:
        java.lang.Exception - if something goes wrong during installation.
      • isCompatibleBaseSystem

        public abstract boolean isCompatibleBaseSystem()
                                                throws java.lang.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:
        java.lang.Exception - if a problem occurs while checking compatibility.
      • getBaseSystemDependency

        public abstract java.util.List<Dependency> getBaseSystemDependency()
                                                                    throws java.lang.Exception
        Gets the dependency on the base system that this package requires.
        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 abstract java.util.List<Dependency> getMissingDependencies()
                                                                   throws java.lang.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:
        java.lang.Exception
      • getMissingDependencies

        public abstract 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.
        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.
      • getIncompatibleDependencies

        public abstract 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.
        Returns:
        a list of incompatible installed packages that this package depends on.
        Throws:
        java.lang.Exception
      • getPrecludedPackages

        public abstract 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
        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 abstract 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.
        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.
      • getPackageMetaDataElement

        public java.lang.Object getPackageMetaDataElement​(java.lang.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​(java.lang.Object key,
                                                       java.lang.Object value)
                                                throws java.lang.Exception
        Adds a key, value pair to the meta data map.
        Parameters:
        key - the key
        value - the value to add
        Throws:
        java.lang.Exception - if there is no meta data map to add to.
      • clone

        public abstract java.lang.Object clone()