org.apache.aries.application.modelling.internal
Class PackageRequirementMerger

java.lang.Object
  extended by org.apache.aries.application.modelling.internal.PackageRequirementMerger

public final class PackageRequirementMerger
extends Object

A class to merge collections of package requirements, such that multiple requirements for the same package are consolidated to a single requirement with a version constraint that is the intersection of the original version requirements.


Constructor Summary
PackageRequirementMerger(Collection<org.apache.aries.application.modelling.ImportedPackage> requirements)
          Constructor.
 
Method Summary
 Set<String> getInvalidRequirements()
          Get the names of packages that caused the merge to fail due to their constraints being mutually exclusive.
 Collection<org.apache.aries.application.modelling.ImportedPackage> getMergedRequirements()
          Get the merged package requirements.
 boolean isMergeSuccessful()
          Check if the requirements could be successfully merged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageRequirementMerger

public PackageRequirementMerger(Collection<org.apache.aries.application.modelling.ImportedPackage> requirements)
Constructor.

Parameters:
requirements - the package requirements to be merged.
Throws:
NullPointerException - if the parameter is null.
Method Detail

isMergeSuccessful

public boolean isMergeSuccessful()
Check if the requirements could be successfully merged.

Returns:
true if the merge was successful; false if the requirements were not compatible.

getMergedRequirements

public Collection<org.apache.aries.application.modelling.ImportedPackage> getMergedRequirements()
Get the merged package requirements. The result will mirror the input collection, except that multiple requirements for the same package will be replaced by a single requirement that is the intersection of all the input requirements.

The isMergeSuccessful method should be checked for success prior to calling this method.

Parameters:
inputRequirements -
Returns:
A collection of package requirements, or null if the input contained incompatible requirements.
Throws:
IllegalStateException - if the merge was not successful.

getInvalidRequirements

public Set<String> getInvalidRequirements()
Get the names of packages that caused the merge to fail due to their constraints being mutually exclusive.

Returns:
an unmodifiable set of package names.


Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.