org.pentaho.packageManagement
Class PackageConstraint

java.lang.Object
  extended by org.pentaho.packageManagement.PackageConstraint
Direct Known Subclasses:
VersionPackageConstraint, VersionRangePackageConstraint

public abstract class PackageConstraint
extends Object

Abstract base class for package constraints. An example implementation might be to encapsulate a constraint with respect to a version number. Checking against a target in this case would typically assume the same package for both this and the target.

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

Field Summary
protected  Package m_thePackage
           
 
Constructor Summary
PackageConstraint()
           
 
Method Summary
abstract  boolean checkConstraint(Package target)
          Check the target package against the constraint embodied in this PackageConstraint.
abstract  PackageConstraint checkConstraint(PackageConstraint target)
          Check the target package constraint against the constraint embodied in this package constraint.
 Package getPackage()
          Get the package that this constraint applies to.
 void setPackage(Package p)
          Set the package that this constraint applies to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_thePackage

protected Package m_thePackage
Constructor Detail

PackageConstraint

public PackageConstraint()
Method Detail

setPackage

public void setPackage(Package p)
Set the package that this constraint applies to.

Parameters:
p - the package that this constraint applies to.

getPackage

public Package getPackage()
Get the package that this constraint applies to.

Returns:
the Package that this constraint applies to.

checkConstraint

public abstract boolean checkConstraint(Package target)
                                 throws Exception
Check the target package against the constraint embodied in this PackageConstraint.

Parameters:
target - a package to check with respect to the encapsulated package and the constraint.
Returns:
true if the constraint is met by the target package with respect to the encapsulated package + constraint.
Throws:
Exception - if the constraint can't be checked for some reason.

checkConstraint

public abstract PackageConstraint checkConstraint(PackageConstraint target)
                                           throws Exception
Check the target package constraint against the constraint embodied in this package constraint. Returns either the package constraint that covers both this and the target constraint, or null if this and the target are incompatible.

Parameters:
target - the package constraint to compare against
Returns:
a package constraint that covers this and the supplied constraint, or null if they are incompatible.
Throws:
Exception


Copyright © 2013. All Rights Reserved.