com.sun.enterprise.tools.verifier.hk2
Class PackageAnalyser

java.lang.Object
  extended by com.sun.enterprise.tools.verifier.hk2.PackageAnalyser

public class PackageAnalyser
extends java.lang.Object

A class that inspects module definitions of a bundle and processes them to come up with package dependency matrix, split-packages, etc. Does not handle version information correctly while matching exporter to importers, so it assumes a package or a bundle has only one version at any given time in a distribution.

Author:
Sanjeeb.Sahoo@Sun.COM

Nested Class Summary
static class PackageAnalyser.Bundle
          A dats structure to capture bundle details needed for our processing.
static class PackageAnalyser.PackageCapability
          Holds information about an exported package.
static class PackageAnalyser.SplitPackage
          Holds information about a split-package.
static class PackageAnalyser.Wire
          A wire represents a connection between an exporter bundle to an importer bundle for a particular package.
 
Field Summary
 java.util.Set<PackageAnalyser.Bundle> bundles
           
 
Constructor Summary
PackageAnalyser(com.sun.enterprise.module.Repository moduleRepository)
           
PackageAnalyser(com.sun.enterprise.module.Repository repo, java.util.logging.Logger logger)
           
 
Method Summary
 void analyse(PackageAnalyser.Bundle bundle)
          Analyse the dependency of a bundle and updates it in the given bundle object.
 java.util.Collection<PackageAnalyser.Wire> analyseWirings()
           
 java.util.Set<PackageAnalyser.Bundle> findAllBundles()
           
 java.util.Collection<java.lang.String> findAllExportedPackageNames()
           
 java.util.Collection<PackageAnalyser.PackageCapability> findAllExportedPackages()
           
 java.util.Collection<PackageAnalyser.SplitPackage> findDuplicatePackages()
          Inspects bundles and reports duplicate packages.
 java.util.Collection<PackageAnalyser.PackageCapability> findUnusedExports()
           
 java.util.Collection<PackageAnalyser.PackageCapability> findUnusedExports(PackageAnalyser.Bundle exporter)
          Find unused exported packages for a given bundle
 void generateBundleReport(java.io.PrintStream out)
           
 void generateWiringReport(java.util.Collection<java.lang.String> exportedPkgs, java.util.Collection<PackageAnalyser.Wire> wires, java.io.PrintStream out)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bundles

public java.util.Set<PackageAnalyser.Bundle> bundles
Constructor Detail

PackageAnalyser

public PackageAnalyser(com.sun.enterprise.module.Repository moduleRepository)

PackageAnalyser

public PackageAnalyser(com.sun.enterprise.module.Repository repo,
                       java.util.logging.Logger logger)
Method Detail

analyse

public void analyse(PackageAnalyser.Bundle bundle)
             throws java.io.IOException
Analyse the dependency of a bundle and updates it in the given bundle object.

Parameters:
bundle - to be analysed
Throws:
java.io.IOException

analyseWirings

public java.util.Collection<PackageAnalyser.Wire> analyseWirings()
                                                          throws java.io.IOException
Throws:
java.io.IOException

findDuplicatePackages

public java.util.Collection<PackageAnalyser.SplitPackage> findDuplicatePackages()
Inspects bundles and reports duplicate packages. Before calling this method, you must call this#analyseWirings() The colection is already sorted.

Returns:
set of split-packages, en empty set if none is found.

findAllExportedPackages

public java.util.Collection<PackageAnalyser.PackageCapability> findAllExportedPackages()

findAllExportedPackageNames

public java.util.Collection<java.lang.String> findAllExportedPackageNames()

findAllBundles

public java.util.Set<PackageAnalyser.Bundle> findAllBundles()

findUnusedExports

public java.util.Collection<PackageAnalyser.PackageCapability> findUnusedExports()

findUnusedExports

public java.util.Collection<PackageAnalyser.PackageCapability> findUnusedExports(PackageAnalyser.Bundle exporter)
Find unused exported packages for a given bundle

Parameters:
exporter -
Returns:

generateWiringReport

public void generateWiringReport(java.util.Collection<java.lang.String> exportedPkgs,
                                 java.util.Collection<PackageAnalyser.Wire> wires,
                                 java.io.PrintStream out)

generateBundleReport

public void generateBundleReport(java.io.PrintStream out)

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2011 Oracle Corporation. All Rights Reserved.