in nbm-maven-plugin/src/main/java/org/apache/netbeans/nbm/CreateClusterAppMojo.java [1278:1322]
private static void walkKnownBundleDependenciesUp( List<BundleTuple> known, List<BundleTuple> toProcess )
{
boolean atLeastOneWasFound = false;
for ( Iterator<BundleTuple> it = toProcess.iterator(); it.hasNext(); )
{
BundleTuple bundleTuple = it.next();
boolean found = false;
for ( BundleTuple knownBT : known )
{
Sets.SetView<String> is = Sets.intersection( bundleTuple.manifest.getOsgiImports(), knownBT.manifest.
getOsgiExports() );
if ( !is.isEmpty() )
{
found = true;
bundleTuple.cluster = knownBT.cluster;
break;
}
//dependencyTokens are requireBundle - matches the module property
is = Sets.intersection( Collections.singleton( knownBT.manifest.getModule() ), new HashSet(
bundleTuple.manifest.getDependencyTokens() ) );
if ( !is.isEmpty() )
{
found = true;
bundleTuple.cluster = knownBT.cluster;
break;
}
}
if ( found )
{
atLeastOneWasFound = true;
it.remove();
known.add( bundleTuple );
}
}
if ( !toProcess.isEmpty() && atLeastOneWasFound )
{
walkKnownBundleDependenciesDown( known, toProcess );
}
if ( !toProcess.isEmpty() && atLeastOneWasFound )
{
walkKnownBundleDependenciesUp( known, toProcess );
}
}