Package org.eclipse.osgi.service.resolver

Examples of org.eclipse.osgi.service.resolver.ImportPackageSpecification


        for (ResolverError error : errors) {
            logError(bundle, level, error);
            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            switch (error.getType()) {
                case MISSING_IMPORT_PACKAGE:
                    ImportPackageSpecification pkgSpec = (ImportPackageSpecification)constraint;
                    for (BundleDescription b : getBundles()) {
                        for (ExportPackageDescription pkg : b.getExportPackages()) {
                            if (pkg.getName().equals(pkgSpec.getName())) {
                                if (pkgSpec.getVersionRange().isIncluded(pkg.getVersion())) {
                                    if (!pkg.getExporter().isResolved()) {
                                        logError(b, level, "Bundle unresolved: " + pkg);
                                        analyzeErrors(pkg.getExporter(), bundles, level + 1);
                                    }
                                } else {
                                    logError(b, level, "Version mismatch: " + pkgSpec + " " + pkg);
                                }
                            }
                        }
                    }
                    break;
                case MISSING_REQUIRE_BUNDLE:
                case MISSING_FRAGMENT_HOST:
                    // BundleSpecification bundleSpec = (BundleSpecification)constraint;
                    for (BundleDescription b : getBundles()) {
                        if (b == bundle) {
                            continue;
                        }
                        if (b.getSymbolicName() == null) {
                            logError(b, level, "No SymbolicName for " + b.getLocation());
                            continue;
                        }
                        if (constraint.getName() == null) {
                            logError(bundle, level, "no constraint name: " + constraint);
                        }
                        if (b.getSymbolicName().equals(constraint.getName())) {
                            if (constraint.getVersionRange().isIncluded(b.getVersion())) {
                                // There must be something wrong in the bundle
                                analyzeErrors(b, bundles, level);
                            } else {
                                logError(bundle, level, "Version mismatch: " + constraint + " " + b);
                            }
                        }
                    }
                    break;
                case IMPORT_PACKAGE_USES_CONFLICT:
                    ImportPackageSpecification importPackage = (ImportPackageSpecification)constraint;
                    for (BundleDescription b : getBundles()) {
                        for (ExportPackageDescription pkg : b.getExportPackages()) {
                            if (pkg.getName().equals(importPackage.getName())) {
                                logError(pkg.getExporter(), level + 1, pkg.toString());
                            }
                        }
                    }
                    break;
View Full Code Here


        String[] uses = (String[]) exportedPackage.getDirective("uses");
        if (uses != null) {
            BundleDescription bundle = exportedPackage.getExporter();
            for (String usePackageName : uses) {
                // see uses clause points to import or export package
                ImportPackageSpecification useImportPackage = findImportPackage(usePackageName, bundle.getImportPackages());
                if (useImportPackage == null) {
                    ExportPackageDescription useExportPackage = findExportPackage(usePackageName, bundle.getExportPackages());
                    if (useExportPackage == null) {
                        throw new RuntimeException("No import or export package for an 'uses' package " + usePackageName + " in " + Utils.bundleToString(bundle));
                    } else {
View Full Code Here

                while (iterator.hasNext()) {
                    PackageEdge nextEdge = iterator.next();
                    PackageNode nextNode = nextEdge.getTarget();
                   
                    ImportPackageSpecification importPackage = nextEdge.getImportPackage();
                       
                    builder.append(usesToString(level + 1, node, nextNode, importPackage == null && !iterator.hasNext()));
                    builder.append(Utils.LINE_SEPARATOR);
                       
                    if (importPackage != null) {
                        if (importPackage.getBundle() == nextEdge.getTarget().getPackageExporter()) {
                            builder.append(selfImportToString(level + 1, nextEdge, !iterator.hasNext()));
                        } else {
                            builder.append(importToString(level + 1, nextEdge, !iterator.hasNext()));
                            level++;
                        }
View Full Code Here

        for (ResolverError error : errors) {
            Utils.displayError(bundle, level, error.toString());
            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            switch (error.getType()) {
                case MISSING_IMPORT_PACKAGE:
                    ImportPackageSpecification pkgSpec = (ImportPackageSpecification)constraint;
                    for (BundleDescription b : state.getBundles()) {
                        for (ExportPackageDescription pkg : b.getExportPackages()) {
                            if (pkg.getName().equals(pkgSpec.getName())) {
                                if (pkgSpec.getVersionRange().isIncluded(pkg.getVersion())) {
                                    if (!pkg.getExporter().isResolved()) {
                                        Utils.displayError(b, level + 1, "Bundle unresolved: " + pkg);
                                        analyzeErrors(pkg.getExporter(), state, bundles, level + 1);
                                    }
                                } else {
View Full Code Here

        ResolverError[] errors = state.getResolverErrors(bundle);
        for (ResolverError error : errors) {
            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            switch (error.getType()) {
                case MISSING_IMPORT_PACKAGE:
                    ImportPackageSpecification importPackageSpecification = (ImportPackageSpecification) constraint;
                    String resolution = (String) importPackageSpecification.getDirective(Constants.RESOLUTION_DIRECTIVE);
                    if (ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(resolution) || ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(resolution)) {
                        // don't care about unsatisfied optional or dynamic imports
                        continue;
                    }
                    if (isSatisfied(importPackageSpecification, bundleDescriptions) == null) {
View Full Code Here

        for (ResolverError error : errors) {
            logError(bundle, level, error);
            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            switch (error.getType()) {
                case MISSING_IMPORT_PACKAGE:
                    ImportPackageSpecification pkgSpec = (ImportPackageSpecification)constraint;
                    for (BundleDescription b : getBundles()) {
                        for (ExportPackageDescription pkg : b.getExportPackages()) {
                            if (pkg.getName().equals(pkgSpec.getName())) {
                                if (pkgSpec.getVersionRange().isIncluded(pkg.getVersion())) {
                                    if (!pkg.getExporter().isResolved()) {
                                        logError(b, level, "Bundle unresolved: " + pkg);
                                        analyzeErrors(pkg.getExporter(), bundles, level + 1);
                                    }
                                } else {
View Full Code Here

                System.out.println(Utils.formatMessage(level, "Package " + packageName + " paths:"));
               
                // just display one path to each conflicting package version found
                for (Map.Entry<PackageNode, ImportPackageSpecification> version : versions.entrySet()) {
                    PackageNode node = version.getKey();
                    ImportPackageSpecification importPackage = version.getValue();
                    if (importPackage == null) {
                        System.out.println(Utils.formatErrorMessage(level + 1, Utils.bundleToString(node.getPackageExporter()) + " exports " + Utils.exportPackageToString(node.getExportPackage())));                           
                        System.out.println();
                    } else {
                        PackageEdge edge = edges.get(importPackage);
View Full Code Here

        String[] uses = (String[]) exportedPackage.getDirective("uses");
        if (uses != null) {
            BundleDescription bundle = exportedPackage.getExporter();
            for (String usePackageName : uses) {
                // see uses clause points to import or export package
                ImportPackageSpecification useImportPackage = findImportPackage(usePackageName, bundle.getImportPackages());
                if (useImportPackage == null) {
                    ExportPackageDescription useExportPackage = findExportPackage(usePackageName, bundle.getExportPackages());
                    if (useExportPackage == null) {
                        // Ignore bad package in "uses" directive
                        // throw new RuntimeException("No import or export package for an 'uses' package " + usePackageName + " in " + Utils.bundleToString(bundle));
View Full Code Here

                while (iterator.hasNext()) {
                    PackageEdge nextEdge = iterator.next();
                    PackageNode nextNode = nextEdge.getTarget();
                   
                    ImportPackageSpecification importPackage = nextEdge.getImportPackage();
                       
                    builder.append(usesToString(level + 1, node, nextNode, importPackage == null && !iterator.hasNext()));
                    builder.append(Utils.LINE_SEPARATOR);
                       
                    if (importPackage != null) {
                        if (importPackage.getBundle() == nextEdge.getTarget().getPackageExporter()) {
                            builder.append(selfImportToString(level + 1, nextEdge, !iterator.hasNext()));
                        } else {
                            builder.append(importToString(level + 1, nextEdge, !iterator.hasNext()));
                            level++;
                        }
View Full Code Here

        ResolverError[] errors = state.getResolverErrors(bundle);
        for (ResolverError error : errors) {
            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            switch (error.getType()) {
                case MISSING_IMPORT_PACKAGE:
                    ImportPackageSpecification importPackageSpecification = (ImportPackageSpecification) constraint;
                    String resolution = (String) importPackageSpecification.getDirective(Constants.RESOLUTION_DIRECTIVE);
                    if (ImportPackageSpecification.RESOLUTION_OPTIONAL.equals(resolution) || ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(resolution)) {
                        // don't care about unsatisfied optional or dynamic imports
                        continue;
                    }
                    if (isSatisfied(importPackageSpecification, bundleDescriptions) == null) {
                        ErrorDetail errorDetail = new ErrorDetail("The package dependency " + versionToString(importPackageSpecification) + " required by bundle " + bundleToString(bundle) + " cannot be satisfied.");
                        getUnsatisfiedReason(state, importPackageSpecification, errorDetail);
                        errorList.add(errorDetail);
                    }
                    break;
                case MISSING_REQUIRE_BUNDLE:
                    BundleSpecification bundleSpecification = (BundleSpecification) constraint;
                    if (bundleSpecification.isOptional()) {
                        // don't care about unsatisfied optional require-bundle
                        continue;
                    }
                    if (isSatisfied(bundleSpecification, bundleDescriptions) == null) {
                        errorList.add(new ErrorDetail("The bundle dependency " + versionToString(bundleSpecification) + " required by bundle " + bundleToString(bundle) + " cannot be satisfied."));
                    }
                    break;
                case MISSING_FRAGMENT_HOST:
                    HostSpecification hostSpecification = (HostSpecification) constraint;
                    if (isSatisfied(hostSpecification, bundleDescriptions) == null) {
                        errorList.add(new ErrorDetail("The host bundle dependency " + versionToString(hostSpecification) + " required by bundle " + bundleToString(bundle) + " cannot be satisfied."));
                    }
                    break;
                case IMPORT_PACKAGE_USES_CONFLICT:
                    ImportPackageSpecification usesImportPackageSpecification = (ImportPackageSpecification) constraint;
                    errorList.add(new ErrorDetail("The package dependency " + versionToString(usesImportPackageSpecification) + " required by bundle " + bundleToString(bundle) + " cannot be resolved due to uses directive conflict."));
                    break;
                case REQUIRE_BUNDLE_USES_CONFLICT:
                    BundleSpecification usesBundleSpecification = (BundleSpecification) constraint;
                    errorList.add(new ErrorDetail("The bundle dependency " + versionToString(usesBundleSpecification) + " required by bundle " + bundleToString(bundle) + " cannot be resolved due to uses directive conflict."));
View Full Code Here

TOP

Related Classes of org.eclipse.osgi.service.resolver.ImportPackageSpecification

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.