Package aQute.bnd.header

Examples of aQute.bnd.header.Attrs$DataType


public class APITemplate implements IProjectTemplate {

    public void modifyInitialBndModel(BndEditModel model, String projectName, ProjectPaths projectPaths) {
        model.setExportedPackages(Arrays.asList(new ExportedPackage[] {
            new ExportedPackage(projectName, new Attrs())
        }));

        // Bundle-Version: 1.0.0
        model.setBundleVersion("1.0.0.${tstamp}");

        // -buildpath
        List<VersionedClause> buildPath = new ArrayList<VersionedClause>();
        List<VersionedClause> tmp;
        tmp = model.getBuildPath();
        if (tmp != null)
            buildPath.addAll(tmp);
        buildPath.add(new VersionedClause("biz.aQute.bnd.annotation", new Attrs()));
        buildPath.add(new VersionedClause("${junit}", new Attrs()));
        model.setBuildPath(buildPath);
    }
View Full Code Here


            added = new LinkedList<ExportedPackage>();

            // Select the results
            for (Object result : results) {
                String newPackageName = (String) result;
                ExportedPackage newPackage = new ExportedPackage(newPackageName, new Attrs());
                added.add(newPackage);
            }
        }
        return added;
    }
View Full Code Here

        }
    }

    @Override
    protected ExportedPackage newHeaderClause(String text) {
        return new ExportedPackage(text, new Attrs());
    }
View Full Code Here

    private static VersionedClause resourceToRunBundle(Resource resource) {
        Capability idCap = ResourceUtils.getIdentityCapability(resource);
        String identity = ResourceUtils.getIdentity(idCap);

        // Map version range string, using "latest" for any workspace resources
        Attrs attribs = new Attrs();
        String versionRangeStr;
        if (isWorkspace(resource)) {
            versionRangeStr = VERSION_LATEST;
        } else {
            Version version = ResourceUtils.getVersion(idCap);
            VersionRange versionRange = createVersionRange(version);
            versionRangeStr = versionRange.toString();
        }
        attribs.put(Constants.VERSION_ATTRIBUTE, versionRangeStr);

        return new VersionedClause(identity, attribs);

    }
View Full Code Here

                    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

        boolean appendStar = getClauses().isEmpty();

        super.doAddClauses(clauses, index, select);

        if (appendStar) {
            ImportPattern starPattern = new ImportPattern("*", new Attrs()); //$NON-NLS-1$
            super.doAddClauses(Arrays.asList(starPattern), -1, false);
        }
    }
View Full Code Here

        }
    }

    @Override
    protected ImportPattern newHeaderClause(String text) {
        return new ImportPattern(text, new Attrs());
    }
View Full Code Here

        // 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;
            Set<Version> includedVersions = bundleVersions.get(name);
            if (includedVersions != null) {
                String versionRangeStr = rbAttribs.get(Constants.BUNDLE_VERSION_ATTRIBUTE);
                VersionRange versionRange = (versionRangeStr != null) ? new VersionRange(versionRangeStr) : new VersionRange("0");
                for (Version includedVersion : includedVersions) {
                    if (versionRange.includes(includedVersion)) {
                        satisfied = true;
                        break;
View Full Code Here

                    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

            }

            // Add a "*" at the end, if not already present
            List<ImportPattern> patterns = getClauses();
            if (patterns.size() != 0 && !patterns.get(patterns.size() - 1).getName().equals("*")) {
                ImportPattern starPattern = new ImportPattern("*", new Attrs());
                ImportPatternsListPart.super.doAddClauses(Arrays.asList(starPattern), -1, false);
            }
        }
View Full Code Here

TOP

Related Classes of aQute.bnd.header.Attrs$DataType

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.