Package aQute.bnd.osgi

Examples of aQute.bnd.osgi.Processor$SetLocationImpl


        GitOBRRepo repo = new GitOBRRepo();
        repo.setProperties(properties);

        Properties props = new Properties();
        props.put(Processor.PLUGIN, org.osgi.impl.bundle.bindex.BundleIndexerImpl.class.getName());
        Processor processor = new Processor();
        processor.setProperties(props);
        repo.setReporter(processor);
        repo.setRegistry(processor);
        return repo;
    }
View Full Code Here


            //
            // The BndEdit model does not do property expansion. So
            // get the processor to get the expansions.
            //

            Processor p = model.getProperties();

            String runfw = p.getProperty(Constants.RUNFW);
            if (runfw == null)
                return new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, Messages.ResolutionJob_errorFrameworkOrExecutionEnvironmentUnspecified, null);

            EE ee = EE.parse(p.getProperty(Constants.RUNEE));
            if (ee == null)
                return new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, Messages.ResolutionJob_errorFrameworkOrExecutionEnvironmentUnspecified, null);

            return Status.OK_STATUS;
        } catch (Exception e) {
View Full Code Here

        // go!

        init();

        String generationDate = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm'Z'" ).format( new Date() );
        Reporter reporter = new Processor();

        try
        {
            Set<Info> infoSet = new Baseline( reporter, new DiffPluginImpl() )
                                .baseline( currentBundle, previousBundle, packageFilters );

            startBaseline( generationDate, project.getArtifactId(), project.getVersion(), comparisonVersion );

            final Info[] infos = infoSet.toArray( new Info[infoSet.size()] );
            Arrays.sort( infos, new InfoComparator() );

            for ( Info info : infos )
            {
                DiffMessage diffMessage = null;
                Version newerVersion = info.newerVersion;
                Version suggestedVersion = info.suggestedVersion;

                if ( suggestedVersion != null )
                {
                    if ( newerVersion.compareTo( suggestedVersion ) > 0 )
                    {
                        diffMessage = new DiffMessage( "Excessive version increase", DiffMessage.Type.warning );
                        reporter.warning( "%s: %s; detected %s, suggested %s",
                                          info.packageName, diffMessage, info.newerVersion, info.suggestedVersion );
                    }
                    else if ( newerVersion.compareTo( suggestedVersion ) < 0 )
                    {
                        diffMessage = new DiffMessage( "Version increase required", DiffMessage.Type.error );
                        reporter.error( "%s: %s; detected %s, suggested %s",
                                        info.packageName, diffMessage, info.newerVersion, info.suggestedVersion );
                    }
                }

                Diff packageDiff = info.packageDiff;

                Delta delta = packageDiff.getDelta();

                switch ( delta )
                {
                    case UNCHANGED:
                        if ( ( suggestedVersion.getMajor() != newerVersion.getMajor() )
                            || ( suggestedVersion.getMicro() != newerVersion.getMicro() )
                            || ( suggestedVersion.getMinor() != newerVersion.getMinor() ) )
                        {
                            diffMessage = new DiffMessage( "Version has been increased but analysis detected no changes", DiffMessage.Type.warning );
                            reporter.warning( "%s: %s; detected %s, suggested %s",
                                              info.packageName, diffMessage, info.newerVersion, info.suggestedVersion );
                        }
                        break;

                    case REMOVED:
                        diffMessage = new DiffMessage( "Package removed", DiffMessage.Type.info );
                        reporter.trace( "%s: %s ", info.packageName, diffMessage );
                        break;

                    case CHANGED:
                    case MICRO:
                    case MINOR:
                    case MAJOR:
                    case ADDED:
                    default:
                        // ok
                        break;
                }

                boolean mismatch = info.mismatch;
                String packageName = info.packageName;
                String shortDelta = getShortDelta( info.packageDiff.getDelta() );
                String deltaString = StringUtils.lowerCase( String.valueOf( info.packageDiff.getDelta() ) );
                String newerVersionString = String.valueOf( info.newerVersion );
                String olderVersionString = String.valueOf( info.olderVersion );
                String suggestedVersionString = String.valueOf( ( info.suggestedVersion == null ) ? "-" : info.suggestedVersion );
                Map<String,String> attributes = info.attributes;

                startPackage( mismatch,
                              packageName,
                              shortDelta,
                              deltaString,
                              newerVersionString,
                              olderVersionString,
                              suggestedVersionString,
                              diffMessage,
                              attributes );

                if ( Delta.REMOVED != delta )
                {
                    doPackageDiff( packageDiff );
                }

                endPackage();
            }

            endBaseline();
        }
        catch ( Exception e )
        {
            throw new MojoExecutionException( "Impossible to calculate the baseline", e );
        }
        finally
        {
            closeJars( currentBundle, previousBundle );
        }

        // check if it has to fail if some error has been detected

        boolean fail = false;

        if ( !reporter.isOk() )
        {
            for ( String errorMessage : reporter.getErrors() )
            {
                getLog().error( errorMessage );
            }

            if ( failOnError )
            {
                fail = true;
            }
        }

        // check if it has to fail if some warning has been detected

        if ( !reporter.getWarnings().isEmpty() )
        {
            for ( String warningMessage : reporter.getWarnings() )
            {
                getLog().warn( warningMessage );
            }

            if ( failOnWarning )
            {
                fail = true;
            }
        }

        getLog().info( String.format( "Baseline analysis complete, %s error(s), %s warning(s)",
                                      reporter.getErrors().size(),
                                      reporter.getWarnings().size() ) );

        if ( fail )
        {
            throw new MojoFailureException( "Baseline failed, see generated report" );
        }
View Full Code Here

                        ranges = new HashMap<VersionRange, Map<String, String>>();
                        result.put(parts[0], ranges);
                    }
                    String version = parts[1];
                    if (!version.startsWith("[") && !version.startsWith("(")) {
                        Processor processor = new Processor();
                        processor.setProperty("@", VersionTable.getVersion(version).toString());
                        Macro macro = new Macro(processor);
                        version = macro.process("${range;[==,=+)}");
                    }
                    VersionRange range = new VersionRange(version);
                    Map<String, String> hdrs = ranges.get(range);
View Full Code Here

        return resource;
    }

    protected static void addDependency(FeatureResource resource, String name, String version, String featureRange) {
        if (!version.startsWith("[") && !version.startsWith("(")) {
            Processor processor = new Processor();
            processor.setProperty("@", VersionTable.getVersion(version).toString());
            Macro macro = new Macro(processor);
            version = macro.process(featureRange);
        }
        Map<String, String> dirs;
        Map<String, Object> attrs;
View Full Code Here

        registerMatchingFeatures(feature.getName(), feature.getVersion());
    }

    public void registerMatchingFeatures(String name, String version) throws IOException {
        if (!version.startsWith("[") && !version.startsWith("(")) {
            Processor processor = new Processor();
            processor.setProperty("@", VersionTable.getVersion(version).toString());
            Macro macro = new Macro(processor);
            version = macro.process(featureRange);
        }
        registerMatchingFeatures(name, new VersionRange(version));
    }
View Full Code Here

    }

    @Test
    public void testRange() throws Exception {
        Processor processor = new Processor();
        processor.setProperty("@", "1.2.3.redhat-61-SNAPSHOT");
        Macro macro = new Macro(processor);

        assertEquals("[1.2,1.3)", macro.process("${range;[==,=+)}"));
        assertEquals("[1.2.3.redhat-61-SNAPSHOT,2)", macro.process("${range;[====,+)}"));
    }
View Full Code Here

TOP

Related Classes of aQute.bnd.osgi.Processor$SetLocationImpl

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.