Package aQute.bnd.header

Examples of aQute.bnd.header.Parameters


                out.println("[IMPEXP]");
                Manifest m = jar.getManifest();

                if (m != null) {
                    Domain domain = Domain.domain(m);
                    Parameters imports = domain.getImportPackage();
                    Parameters exports = domain.getExportPackage();
                    for (String p : exports.keySet()) {
                        if (imports.containsKey(p)) {
                            Attrs attrs = imports.get(p);
                            if (attrs.containsKey(VERSION_ATTRIBUTE)) {
                                exports.get(p).put("imported-as", attrs.get(VERSION_ATTRIBUTE));
                            }
                        }
                    }
                    print("Import-Package", new TreeMap<String,Attrs>(imports));
                    print("Export-Package", new TreeMap<String,Attrs>(exports));
View Full Code Here


            out.println("No manifest");
            return;
        }

        String componentHeader = manifest.getMainAttributes().getValue(Constants.SERVICE_COMPONENT);
        Parameters clauses = new Parameters(componentHeader);
        boolean printed = false;
        for (String path : clauses.keySet()) {
            printed = true;
            out.println(path);

            Resource r = jar.getResource(path);
            if (r != null) {
View Full Code Here

        }
        return result;
    }

    public static String getBundleSymbolicName(Attributes attribs) {
        Parameters header = new Parameters(attribs.getValue(Constants.BUNDLE_SYMBOLICNAME));
        if (header.size() != 1)
            return null;

        return header.keySet().iterator().next();
    }
View Full Code Here

        if (manifest == null)
            return;

        Attributes attribs = manifest.getMainAttributes();
        String exportPkgStr = attribs.getValue(Constants.EXPORT_PACKAGE);
        Parameters exportsMap = new Parameters(exportPkgStr);

        // Merge the exports
        Map<PackageRef,List<PackageRef>> uses = builder.getUses();
        for (Entry<String,Attrs> entry : exportsMap.entrySet()) {
            String pkgName = Processor.removeDuplicateMarker(entry.getKey());
            ExportPackage export = new ExportPackage(pkgName, entry.getValue(), uses.get(pkgName));
            List<ExportPackage> exportList = exports.get(export.getName());
            if (exportList == null) {
                exportList = new LinkedList<ExportPackage>();
View Full Code Here

            return;
        Attributes attribs = manifest.getMainAttributes();

        // Process imports
        String importPkgStr = attribs.getValue(Constants.IMPORT_PACKAGE);
        Parameters importsMap = new Parameters(importPkgStr);
        for (Entry<String,Attrs> entry : importsMap.entrySet()) {
            String pkgName = entry.getKey();
            Attrs importAttribs = entry.getValue();

            // Calculate the importing classes for this import
            Map<String,List<Clazz>> classMap = new HashMap<String,List<Clazz>>();
            Collection<Clazz> classes = Collections.emptyList();
            try {
                classes = builder.getClasses("", "IMPORTING", pkgName);
            } catch (Exception e) {
                logger.logError("Error querying importing classes.", e);
            }
            for (Clazz clazz : classes) {
                String fqn = clazz.getFQN();
                int index = fqn.lastIndexOf('.');
                if (index < 0)
                    continue;
                String pkg = fqn.substring(0, index);

                List<Clazz> list = classMap.get(pkg);
                if (list == null) {
                    list = new LinkedList<Clazz>();
                    classMap.put(pkg, list);
                }
                list.add(clazz);
            }

            // Check if this is a self-import
            boolean selfImport = false;
            List<ExportPackage> matchingExports = exports.get(pkgName);
            if (matchingExports != null) {
                String versionRangeStr = importAttribs.get(Constants.VERSION_ATTRIBUTE);
                VersionRange versionRange = (versionRangeStr != null) ? new VersionRange(versionRangeStr) : new VersionRange("0");
                for (ExportPackage export : matchingExports) {
                    String versionStr = export.getAttribs().get(Constants.VERSION_ATTRIBUTE);
                    Version version = (versionStr != null) ? new Version(versionStr) : new Version(0);
                    if (versionRange.includes(version)) {
                        selfImport = true;
                        break;
                    }
                }
            }
            ImportPackage importPackage = new ImportPackage(pkgName, selfImport, importAttribs, usedBy.get(pkgName), classMap);
            List<ImportPackage> importList = imports.get(pkgName);
            if (importList == null) {
                importList = new LinkedList<ImportPackage>();
                imports.put(pkgName, importList);
            }
            importList.add(importPackage);
        }

        // Process require-bundles
        String requireBundlesStr = attribs.getValue(Constants.REQUIRE_BUNDLE);
        final Parameters requiredBundleMap = new Parameters(requireBundlesStr);
        for (Entry<String,Attrs> entry : requiredBundleMap.entrySet()) {
            String name = entry.getKey();
            Attrs rbAttribs = entry.getValue();

            // Check if the required bundle is already included in the closure
            boolean satisfied = false;
View Full Code Here

                mf = JarUtils.loadJarManifest(new FileInputStream(c.getFile()));
            } catch (IOException e) {
                logger.logError("Unable to generate access rules from bundle " + c.getFile(), e);
                return;
            }
            Parameters exportPkgs = new Parameters(mf.getMainAttributes().getValue(new Name(Constants.EXPORT_PACKAGE)));
            List<IAccessRule> tmp = new LinkedList<IAccessRule>();
            for (String exportPkg : exportPkgs.keySet()) {
                String pathStr = exportPkg.replace('.', '/') + "/*";
                tmp.add(JavaCore.newAccessRule(new Path(pathStr), IAccessRule.K_ACCESSIBLE));
            }
            addAccessRules(projectAccessRules, c.getProject(), tmp);
        }
View Full Code Here

                out.println("[IMPEXP]");
                Manifest m = jar.getManifest();

                if (m != null) {
                    Domain domain = Domain.domain(m);
                    Parameters imports = domain.getImportPackage();
                    Parameters exports = domain.getExportPackage();
                    for (String p : exports.keySet()) {
                        if (imports.containsKey(p)) {
                            Attrs attrs = imports.get(p);
                            if (attrs.containsKey(VERSION_ATTRIBUTE)) {
                                exports.get(p).put("imported-as", attrs.get(VERSION_ATTRIBUTE));
                            }
                        }
                    }
                    print("Import-Package", new TreeMap<String,Attrs>(imports));
                    print("Export-Package", new TreeMap<String,Attrs>(exports));
View Full Code Here

            out.println("No manifest");
            return;
        }

        String componentHeader = manifest.getMainAttributes().getValue(Constants.SERVICE_COMPONENT);
        Parameters clauses = new Parameters(componentHeader);
        boolean printed = false;
        for (String path : clauses.keySet()) {
            printed = true;
            out.println(path);

            Resource r = jar.getResource(path);
            if (r != null) {
View Full Code Here

        }
        return result;
    }

    public static String getBundleSymbolicName(Attributes attribs) {
        Parameters header = new Parameters(attribs.getValue(Constants.BUNDLE_SYMBOLICNAME));
        if (header.size() != 1)
            return null;

        return header.keySet().iterator().next();
    }
View Full Code Here

                mf = JarUtils.loadJarManifest(new FileInputStream(c.getFile()));
            } catch (IOException e) {
                logger.logError("Unable to generate access rules from bundle " + c.getFile(), e);
                return;
            }
            Parameters exportPkgs = new Parameters(mf.getMainAttributes().getValue(new Name(Constants.EXPORT_PACKAGE)));
            List<IAccessRule> tmp = new LinkedList<IAccessRule>();
            for (String exportPkg : exportPkgs.keySet()) {
                String pathStr = exportPkg.replace('.', '/') + "/*";
                tmp.add(JavaCore.newAccessRule(new Path(pathStr), IAccessRule.K_ACCESSIBLE));
            }
            addAccessRules(projectAccessRules, c.getProject(), tmp);
        }
View Full Code Here

TOP

Related Classes of aQute.bnd.header.Parameters

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.