Examples of VersionConstraint


Examples of org.eclipse.aether.version.VersionConstraint

    {
        VersionRangeResult result = new VersionRangeResult( request );

        VersionScheme versionScheme = new GenericVersionScheme();

        VersionConstraint versionConstraint;
        try
        {
            versionConstraint = versionScheme.parseVersionConstraint( request.getArtifact().getVersion() );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            result.addException( e );
            throw new VersionRangeResolutionException( result );
        }

        result.setVersionConstraint( versionConstraint );

        if ( versionConstraint.getRange() == null )
        {
            result.addVersion( versionConstraint.getVersion() );
        }
        else
        {
            Map<String, ArtifactRepository> versionIndex = getVersions( session, result, request );

            List<Version> versions = new ArrayList<Version>();
            for ( Map.Entry<String, ArtifactRepository> v : versionIndex.entrySet() )
            {
                try
                {
                    Version ver = versionScheme.parseVersion( v.getKey() );
                    if ( versionConstraint.containsVersion( ver ) )
                    {
                        versions.add( ver );
                        result.setRepository( ver, v.getValue() );
                    }
                }
View Full Code Here

Examples of org.eclipse.aether.version.VersionConstraint

        if ( StringUtils.isBlank( versionRange ) )
        {
            throw new IllegalArgumentException( "Version range must not be empty" );
        }

        VersionConstraint constraint;
        try
        {
            constraint = versionScheme.parseVersionConstraint( versionRange );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new IllegalArgumentException( e.getMessage(), e );
        }

        Version current;
        try
        {
            String mavenVersion = getMavenVersion();
            if ( mavenVersion.length() <= 0 )
            {
                throw new IllegalStateException( "Could not determine current Maven version" );
            }

            current = versionScheme.parseVersion( mavenVersion );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            throw new IllegalStateException( "Could not parse current Maven version: " + e.getMessage(), e );
        }

        if ( constraint.getRange() == null )
        {
            return constraint.getVersion().compareTo( current ) <= 0;
        }
        return constraint.containsVersion( current );
    }
View Full Code Here

Examples of org.eclipse.aether.version.VersionConstraint

              verificationLog.append("WARNING: Could not determine version!").append(NL);
            }
            else {
              try {
                VersionScheme scheme = new GenericVersionScheme();
                VersionConstraint constraint = scheme.parseVersionConstraint(versionConstraint);
                Version _version = scheme.parseVersion(version);
                if (!constraint.containsVersion(_version)) {
                  message.append("\"").append(type).append("\" incompatible version");
                  verificationLog.append(NL);
                  verificationLog.append("Incompatible ").append(type).append(" version detected:").append(NL);
                  verificationLog.append("Detected version: ").append(_version).append(NL);
                  verificationLog.append("Compatible version constraint: ").append(constraint).append(NL);
View Full Code Here

Examples of org.eclipse.aether.version.VersionConstraint

    {
        VersionRangeResult result = new VersionRangeResult( request );

        VersionScheme versionScheme = new GenericVersionScheme();

        VersionConstraint versionConstraint;
        try
        {
            versionConstraint = versionScheme.parseVersionConstraint( request.getArtifact().getVersion() );
        }
        catch ( InvalidVersionSpecificationException e )
        {
            result.addException( e );
            throw new VersionRangeResolutionException( result );
        }

        result.setVersionConstraint( versionConstraint );

        if ( versionConstraint.getRange() == null )
        {
            result.addVersion( versionConstraint.getVersion() );
        }
        else
        {
            Map<String, ArtifactRepository> versionIndex = getVersions( session, result, request );

            List<Version> versions = new ArrayList<Version>();
            for ( Map.Entry<String, ArtifactRepository> v : versionIndex.entrySet() )
            {
                try
                {
                    Version ver = versionScheme.parseVersion( v.getKey() );
                    if ( versionConstraint.containsVersion( ver ) )
                    {
                        versions.add( ver );
                        result.setRepository( ver, v.getValue() );
                    }
                }
View Full Code Here

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

        ResolverError[] bundleErrors = state.getResolverErrors(bundle);
        for (int j = 0; j < bundleErrors.length; j++) {
            ResolverError error = bundleErrors[j];
            errors.add(error);

            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
                BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
                for (int i = 0; i < requiredBundles.length; i++) {
                    getRelevantErrors(errors, requiredBundles[i]);
                }
            }
        }
View Full Code Here

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

        }
        bundles.add(bundle);
        ResolverError[] errors = state.getResolverErrors(bundle);
        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);
                            }
View Full Code Here

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

            System.out.println(Utils.formatMessage(level, "Resolver errors:"));
        }
        PackageUsesHelper helper = null;
        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 {
                                    Utils.displayError(b, level + 1, "Version mismatch: " + pkgSpec + " " + pkg);
                                }
                            }
                        }
                    }
                    break;
                case MISSING_REQUIRE_BUNDLE:
                case MISSING_FRAGMENT_HOST:
                    for (BundleDescription b : state.getBundles()) {
                        if (b == bundle) {
                            continue;
                        }
                        if (b.getSymbolicName() == null) {
                            Utils.displayError(b, level, "No SymbolicName for " + b.getLocation());
                            continue;
                        }
                        if (constraint.getName() == null) {
                            Utils.displayError(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, state, bundles, level + 1);
                            } else {
                                Utils.displayError(bundle, level, "Version mismatch: " + constraint + " " + b);
                            }
View Full Code Here

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

    }
       
    private void collectErrors(BundleDescription bundle, State state, List<BundleDescription> bundleDescriptions, Collection<String> errorList) {
        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)) {
View Full Code Here

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

    ResolverError[] bundleErrors = state.getResolverErrors(bundle);
        for (int j = 0; j < bundleErrors.length; j++) {
            ResolverError error = bundleErrors[j];
            errors.add(error);

            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
                BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
                for (int i = 0; i < requiredBundles.length; i++) {
                  getRelevantErrors(state, errors, requiredBundles[i]);
                }
            }
        }
View Full Code Here

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

        ResolverError[] bundleErrors = state.getResolverErrors(bundle);
        for (int j = 0; j < bundleErrors.length; j++) {
            ResolverError error = bundleErrors[j];
            errors.add(error);

            VersionConstraint constraint = error.getUnsatisfiedConstraint();
            if (constraint instanceof BundleSpecification || constraint instanceof HostSpecification) {
                BundleDescription[] requiredBundles = state.getBundles(constraint.getName());
                for (int i = 0; i < requiredBundles.length; i++) {
                    getRelevantErrors(errors, requiredBundles[i]);
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.