org.pentaho.packageManagement
Class Package

java.lang.Object
  extended by org.pentaho.packageManagement.Package
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
DefaultPackage

public abstract class Package
extends Object
implements Cloneable

Abstract base class for Packages.

Version:
$Revision: 44030 $
Author:
mhall (mhall{[at]}pentaho{[dot]}com)

Field Summary
protected  Map<?,?> m_packageMetaData
          The meta data for the package
 
Constructor Summary
Package()
           
 
Method Summary
abstract  Object clone()
           
 boolean equals(Package toCompare)
          Compare the supplied package to this package.
abstract  List<Dependency> getBaseSystemDependency()
          Gets the dependency on the base system that this package requires.
abstract  List<Dependency> getDependencies()
          Get the list of packages that this package depends on.
abstract  List<Dependency> getIncompatibleDependencies()
          Gets a list of installed packages that this package depends on that are currently incompatible with this package.
abstract  List<Dependency> getIncompatibleDependencies(List<Package> packages)
          Gets those packages from the supplied list that this package depends on and are currently incompatible with this package.
abstract  List<Dependency> getMissingDependencies()
          Gets a list of packages that this package depends on that are not currently installed.
abstract  List<Dependency> getMissingDependencies(List<Package> packages)
          Gets a list of packages that this package depends on that are not in the supplied list of packages.
abstract  String getName()
          Convenience method to return the name of this package.
 Map<?,?> getPackageMetaData()
          Get the meta data for this package.
 Object getPackageMetaDataElement(Object key)
          Gets the package meta data element associated with the supplied key.
abstract  URL getPackageURL()
          Convenience method that returns the URL to the package (i.e the provider's URL).
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(Map<?,?> metaData)
          Set the meta data for this package.
abstract  void setPackageMetaDataElement(Object key, Object value)
          Adds a key, value pair to the meta data map.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_packageMetaData

protected Map<?,?> m_packageMetaData
The meta data for the package

Constructor Detail

Package

public Package()
Method Detail

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

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()
Overrides:
clone in class Object


Copyright © 2013. All Rights Reserved.