org.ungoverned.oscar
Class OSGiCompatibilityPolicy

java.lang.Object
  extended byorg.ungoverned.oscar.OSGiCompatibilityPolicy
All Implemented Interfaces:
CompatibilityPolicy

public class OSGiCompatibilityPolicy
extends java.lang.Object
implements CompatibilityPolicy


Constructor Summary
OSGiCompatibilityPolicy(Oscar oscar)
           
 
Method Summary
 int compare(java.lang.Object leftId, java.lang.Object leftVersion, java.lang.Object rightId, java.lang.Object rightVersion)
          Compares two versioned identifiers.
 boolean isCompatible(java.lang.Object leftId, java.lang.Object leftVersion, java.lang.Object rightId, java.lang.Object rightVersion)
          Returns whether the first import/export target is compatible with the second.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiCompatibilityPolicy

public OSGiCompatibilityPolicy(Oscar oscar)
Method Detail

compare

public int compare(java.lang.Object leftId,
                   java.lang.Object leftVersion,
                   java.lang.Object rightId,
                   java.lang.Object rightVersion)
Compares two versioned identifiers.

Specified by:
compare in interface CompatibilityPolicy
Parameters:
leftId - the identifier to test for compatibility.
leftVersion - the version number to test for compatibility.
rightId - the identifier used as the compatibility base line.
rightVersion - the version used as the compatibility base line.
Returns:
0 if the identifiers are equal, -1 if the left identifier is less then the right identifier, and 1 if the left identifier is greater than the right identifier.
Throws:
java.lang.IllegalArgumentException - if the two identifiers are not comparable, i.e., they refer to completely different entities.

isCompatible

public boolean isCompatible(java.lang.Object leftId,
                            java.lang.Object leftVersion,
                            java.lang.Object rightId,
                            java.lang.Object rightVersion)
Returns whether the first import/export target is compatible with the second.

Specified by:
isCompatible in interface CompatibilityPolicy
Parameters:
leftId - the identifier to test for compatibility.
leftVersion - the version number to test for compatibility.
rightId - the identifier used as the compatibility base line.
rightVersion - the version used as the compatibility base line.
Returns:
true if the left version number object is compatible with the right version number object, otherwise false.