Package com.sun.enterprise.tools.verifier.hk2

Examples of com.sun.enterprise.tools.verifier.hk2.PackageAnalyser$PackageCapability


                if (!location.exists()) {
                    throw new MojoExecutionException(location + " does not exist, so can't execute. Package the artifact first.");
                }
            }
            ModuleDefinition moduleDef = new MavenModuleDefinition(repo, location);
            ModuleDependencyAnalyser analyser = new ModuleDependencyAnalyser(moduleDef, repo);
            if (excludedPatterns!=null) {
                analyser.excludePatterns(excludedPatterns);
            }
            if (!analyser.analyse()) {
                String msg = "Missing dependency. See details below:\n" + analyser.getResultAsString();
                if (failOnVerificationError) {
                    throw new MojoExecutionException(msg);
                } else {
                    logger.logp(Level.WARNING, "DependencyAnalyserMojo", "execute", msg);
                }
View Full Code Here


        try {
            HK2Factory.initialize();
            MavenProjectRepository repo = new MavenProjectRepository(
                    project, artifactResolver, localRepository, artifactFactory);
            repo.initialize();
            PackageAnalyser analyser = new PackageAnalyser(repo, logger);
            Collection<PackageAnalyser.Wire> wires = analyser.analyseWirings();
            StringBuilder sb = new StringBuilder("Wiring details are given below:\n");
            for (PackageAnalyser.Wire w : wires) {
                sb.append(w + "\n");
            }
            sb.append("Total number of wires = " + wires.size() + "\n");
            sb.append("Split-Package details are given below:\n");
            Collection<PackageAnalyser.SplitPackage> splitPkgs = analyser.findDuplicatePackages();
            for (PackageAnalyser.SplitPackage p : splitPkgs) sb.append(p+"\n");
            sb.append("Total number of Split Packages = " + splitPkgs.size() + "\n");

            int totalUnusedPkgs = 0;
            for (PackageAnalyser.Bundle b : analyser.bundles) {
                Collection<PackageAnalyser.PackageCapability> unusedPackages = analyser.findUnusedExports(b);
                if (!unusedPackages.isEmpty()) {
                    sb.append("<Bundle name=" + b.getName()+", totalUnusedPkgs = " + unusedPackages.size() + "> \n" );
                    for (PackageAnalyser.PackageCapability p : unusedPackages) sb.append("\t" + p + "\n");
                    sb.append("</Bundle>\n");
                }
                totalUnusedPkgs += unusedPackages.size();
            }
            sb.append("Total number of Unused Packages = " + totalUnusedPkgs);

            sb.append("******** GROSS STATISTICS *********\n");
            sb.append("Total number of bundles in this repository: " + analyser.findAllBundles().size()+"\n");
            sb.append("Total number of wires = " + wires.size() + "\n");
            Collection<String> exportedPkgs = analyser.findAllExportedPackageNames();
            sb.append("Total number of exported packages = " + exportedPkgs.size() + "\n");
            sb.append("Total number of split-packages = " + splitPkgs.size()+"\n");
            sb.append("Total number of unused-packages = " + totalUnusedPkgs +"\n");

            logger.logp(Level.INFO, "PackageAnalyserMojo", "execute", "{0}", new Object[]{sb});
            String reportFilePath =
                    System.getProperty("WiringReportPath",
                            System.getProperty("java.io.tmpdir")+ File.separator + "wires.xml");
            analyser.generateWiringReport(exportedPkgs, wires, new PrintStream(new FileOutputStream(new File(reportFilePath))));
            System.out.println("Wiring reported can be found at " + reportFilePath);
        } catch (IOException e) {
            throw new MojoExecutionException("Unexpected exception", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.tools.verifier.hk2.PackageAnalyser$PackageCapability

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.