01: package com.kirkk.analyzer.framework.bcelbundle;
02:
03: import java.util.*;
04: import java.io.*;
05: import com.kirkk.analyzer.framework.*;
06:
07: public class JarRelationshipDecorator extends JarCollectionDecorator {
08:
09: public JarRelationshipDecorator(JarCollection jarCollection) {
10: super (jarCollection);
11: this .buildJarRelationships();
12: }
13:
14: private void buildJarRelationships() {
15: while (this .jarCollection.hasNext()) {
16: Jar jar = this .jarCollection.nextJar();
17: Iterator externalImports = jar
18: .getAllExternallyReferencedPackages().iterator();
19: while (externalImports.hasNext()) {
20: String packageName = (String) externalImports.next();
21: Jar dependentJar = this.jarCollection
22: .getJarContainingPackage(packageName);
23: if (dependentJar != null) {
24: jar.addOutgoingDependency(dependentJar);
25: }
26: }
27: }
28: }
29:
30: }
|