Package org.apache.felix.tool.mangen

Examples of org.apache.felix.tool.mangen.OsgiPackage$PackageComparator


    {
        StringBuffer expanded = new StringBuffer();
       
        for(Iterator i = pkgSet.iterator(); i.hasNext(); )
        {
            OsgiPackage pkg = (OsgiPackage) i.next();
            // recurse to expand tags, but this time only need to supply package
            expanded.append(expandTags(template, null, pkg));
        }
       
        return expanded.toString();
View Full Code Here


     */
    protected void showDiffs(Set genSet, Set currSet, PrintStream rpt)
    {
        for(Iterator i = genSet.iterator(); i.hasNext(); )
        {
            OsgiPackage newPkg = (OsgiPackage) i.next();
            if (!currSet.contains(newPkg))
            {
                rpt.println("   +++ ADDED   :" + newPkg);
            }
        }
       
        for(Iterator i = currSet.iterator(); i.hasNext(); )
        {
            OsgiPackage oldPkg = (OsgiPackage) i.next();
            if (!genSet.contains(oldPkg))
            {
                rpt.println("   --- REMOVED :" + oldPkg);
            }
        }
View Full Code Here

    {
        rptOut.println("");
        rptOut.println("... merge to " + qualName);
        for(Iterator i = currentSet.iterator(); i.hasNext(); )
        {
            OsgiPackage pkg = (OsgiPackage) i.next();
            if (isPackageMatch(pkg, qualName))
            {
                merge(pkg, mangenSet);
            }
        }
View Full Code Here

     */
    protected void merge(OsgiPackage pkgToMerge, Set set)
    {
        // oops, set doesn't have a "get". Guess we could move to using Map
        // but Sets are working for most other cases, so find by hand for now.
        OsgiPackage existingPkg = getPackageFromSet(pkgToMerge, set);

        // if not present in any form, then we can add
        if (existingPkg == null)
        {
            set.add(pkgToMerge);
            rptOut.println("   > adding : " + pkgToMerge);
            return;
        }
       
        // There's no added value in merging string packages to anything already present
        // since they carry no extra package attributes
        if (pkgToMerge instanceof OsgiStringPackage)
        {
            return;
        }
       
        // string packages can be replaced with R4 package, which will have
        // extended package attributes.
        if (existingPkg instanceof OsgiStringPackage)
        {
            set.remove(existingPkg);
            set.add(pkgToMerge);
            rptOut.println("   > replacing : " + existingPkg + "  with : " + pkgToMerge);
            return;
        }
       
        // if present and don't match then throw error
        if (existingPkg instanceof OsgiR4Package && existingPkg.compareTo(pkgToMerge) != 0)
        {
            rptOut.println("*** ERROR *** can't merge conflicting package details: " + pkgToMerge
                           + "  !=  " +  existingPkg);
            return;
        }
View Full Code Here

            rptOut.println("> " + bund.getName() + " :");  
           
            Set exports = bund.getPossibleExports();
            for(Iterator j = exports.iterator(); j.hasNext(); )
            {
                OsgiPackage pkg = (OsgiPackage) j.next();
                if (allImports.contains(pkg))
                {
                    // exports matches imports, move it to resolved list or report
                    // duplicate if already there
                    allImports.remove(pkg);
                    resolvedImports.add(pkg);
                    rptOut.println(" ... resolved export: "  + pkg);
                }
                else if (resolvedImports.contains(pkg))
                {
                    MangenMain.warning(rptOut, "*** WARNING *** duplicate export, removing: " + pkg);
                    //TODO: for now we'll suppress the duplicate, which means first
                    //      seen becomes the exporter. Probably need to handle
                    //      better e.g. using versions or wilcard rules in manifest
                    //      to decide who exports
                    j.remove();
                }
                else
                {
                    // export doesn't match any imports, so remove it
                    rptOut.println(" ... removing un-needed export: "  + pkg);
                    j.remove();
                }
            }
        }
       
        rptOut.println("");
       
        // report any unresolved imports
        for(Iterator i = allImports.iterator(); i.hasNext(); )
        {
            OsgiPackage pkg = (OsgiPackage) i.next();
            if (!isPackageMatch(pkg, "sys-packages"))
            {
                MangenMain.warning(rptOut, "*** WARNING *** unresolved import: "  + pkg);
            }
        }
View Full Code Here

     */
    public void removeMatchingPackages(Set set, String qualName)
    {
        for(Iterator i = set.iterator(); i.hasNext(); )
        {
            OsgiPackage pkg = (OsgiPackage) i.next();
            if (isPackageMatch(pkg, qualName))
            {
                rptOut.println("... removing ignored package from "  + qualName + " : "  + pkg);
                i.remove();
            }
View Full Code Here

    {
        rptOut.println("");
        rptOut.println("... stamping packages in " + qualName);
        for(Iterator i = set.iterator(); i.hasNext(); )
        {
            OsgiPackage pkg = (OsgiPackage) i.next();
            String stamp = getMatchingPatternString(pkg, qualName, true);
            if (stamp != null)
            {
                stamp(pkg, stamp, set, export);
            }
View Full Code Here

        if (newPkgs.length != 1)
        {
            MangenMain.error(rptOut, "*** ERROR *** stamp doesn't create a single package : " + stamp);
            return;
        }
        OsgiPackage stampedPkg = newPkgs[0];
       
        // replace a simple string package with the stamped package
        if (pkg instanceof OsgiStringPackage)
        {
            set.remove(pkg);
View Full Code Here

TOP

Related Classes of org.apache.felix.tool.mangen.OsgiPackage$PackageComparator

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.