org.pentaho.packageManagement
Class VersionRangePackageConstraint

java.lang.Object
  extended by org.pentaho.packageManagement.PackageConstraint
      extended by org.pentaho.packageManagement.VersionRangePackageConstraint

public class VersionRangePackageConstraint
extends PackageConstraint

A concrete implementation of PackgageConstraint that encapsulates ranged version number constraints. Handles constraints of the form (u.v.w < package < x.y.z) and (package < u.v.w OR package > x.y.z)

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

Field Summary
protected  boolean m_boundOr
          is false for version1 <= package <= version2
protected  String m_lowerBound
          the lower bound
protected  VersionPackageConstraint.VersionComparison m_lowerConstraint
          the comparison for the lower bound
protected  String m_upperBound
          the upper bound
protected  VersionPackageConstraint.VersionComparison m_upperConstraint
          the comparison for the upper bound
 
Fields inherited from class org.pentaho.packageManagement.PackageConstraint
m_thePackage
 
Constructor Summary
VersionRangePackageConstraint(Package p)
          Constructor
 
Method Summary
 boolean checkConstraint(Package target)
          Check the target package against the constraint embodied in this PackageConstraint.
 PackageConstraint checkConstraint(PackageConstraint target)
          Check the target package constraint against the constraint embodied in this package constraint.
protected static boolean checkConstraint(String toCheck, VersionPackageConstraint.VersionComparison comp1, String bound1, VersionPackageConstraint.VersionComparison comp2, String bound2, boolean boundOr)
           
protected  PackageConstraint checkTargetVersionPackageConstraint(VersionPackageConstraint target)
           
protected  PackageConstraint checkTargetVersionRangePackageConstraint(VersionRangePackageConstraint target)
           
 String getLowerBound()
          Get the lower bound of this range
 VersionPackageConstraint.VersionComparison getLowerComparison()
          Get the lower comparison
 String getUpperBound()
          Get the upper bound of this range
 VersionPackageConstraint.VersionComparison getUpperComparison()
          Get the upper comparison
 boolean isBoundOR()
          Returns true if this is a bounded OR type of constraint
 void setRangeConstraint(String bound1, VersionPackageConstraint.VersionComparison comp1, String bound2, VersionPackageConstraint.VersionComparison comp2)
          Set the range bounds and constraints.
 
Methods inherited from class org.pentaho.packageManagement.PackageConstraint
getPackage, setPackage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_lowerBound

protected String m_lowerBound
the lower bound


m_lowerConstraint

protected VersionPackageConstraint.VersionComparison m_lowerConstraint
the comparison for the lower bound


m_upperBound

protected String m_upperBound
the upper bound


m_upperConstraint

protected VersionPackageConstraint.VersionComparison m_upperConstraint
the comparison for the upper bound


m_boundOr

protected boolean m_boundOr
is false for version1 <= package <= version2

Constructor Detail

VersionRangePackageConstraint

public VersionRangePackageConstraint(Package p)
Constructor

Parameters:
p - the package to base this constraint on
Method Detail

setRangeConstraint

public void setRangeConstraint(String bound1,
                               VersionPackageConstraint.VersionComparison comp1,
                               String bound2,
                               VersionPackageConstraint.VersionComparison comp2)
                        throws Exception
Set the range bounds and constraints.

Parameters:
bound1 - the first bound
comp1 - the first comparison
bound2 - the second bound
comp2 - the second comparison
Throws:
Exception - if the range constraint is malformed

getLowerBound

public String getLowerBound()
Get the lower bound of this range

Returns:
the lower bound

getUpperBound

public String getUpperBound()
Get the upper bound of this range

Returns:
the upper bound

getLowerComparison

public VersionPackageConstraint.VersionComparison getLowerComparison()
Get the lower comparison

Returns:
the lower comparison

getUpperComparison

public VersionPackageConstraint.VersionComparison getUpperComparison()
Get the upper comparison

Returns:
the upper comparison

isBoundOR

public boolean isBoundOR()
Returns true if this is a bounded OR type of constraint

Returns:
true if this is a bounded OR type of constraint

checkConstraint

protected static boolean checkConstraint(String toCheck,
                                         VersionPackageConstraint.VersionComparison comp1,
                                         String bound1,
                                         VersionPackageConstraint.VersionComparison comp2,
                                         String bound2,
                                         boolean boundOr)

checkConstraint

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

Specified by:
checkConstraint in class 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.

checkTargetVersionRangePackageConstraint

protected PackageConstraint checkTargetVersionRangePackageConstraint(VersionRangePackageConstraint target)
                                                              throws Exception
Throws:
Exception

checkTargetVersionPackageConstraint

protected PackageConstraint checkTargetVersionPackageConstraint(VersionPackageConstraint target)
                                                         throws Exception
Throws:
Exception

checkConstraint

public PackageConstraint checkConstraint(PackageConstraint target)
                                  throws Exception
Description copied from class: PackageConstraint
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.

Specified by:
checkConstraint in class PackageConstraint
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.