Examples of PluginRegistry


Examples of org.apache.maven.plugin.registry.PluginRegistry

     * @throws MojoExecutionException if any
     */
    private void updatePluginVersionInRegistry( String aGroupId, String anArtifactId, String aVersion )
        throws MojoExecutionException
    {
        PluginRegistry pluginRegistry;
        try
        {
            pluginRegistry = getPluginRegistry( aGroupId, anArtifactId );
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "Failed to read plugin registry.", e );
        }
        catch ( XmlPullParserException e )
        {
            throw new MojoExecutionException( "Failed to parse plugin registry.", e );
        }

        String pluginKey = ArtifactUtils.versionlessKey( aGroupId, anArtifactId );
        Plugin plugin = (Plugin) pluginRegistry.getPluginsByKey().get( pluginKey );

        // if we can find the plugin, but we've gotten here, the useVersion must be missing; fill it in.
        if ( plugin != null )
        {
            if ( TrackableBase.GLOBAL_LEVEL.equals( plugin.getSourceLevel() ) )
            {
                // do nothing. We don't rewrite the globals, under any circumstances.
                getLog().warn( "Cannot update registered version for plugin {" + aGroupId + ":" + anArtifactId
                    + "}; it is specified in the global registry." );
            }
            else
            {
                plugin.setUseVersion( aVersion );

                SimpleDateFormat format =
                    new SimpleDateFormat( org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT );

                plugin.setLastChecked( format.format( new Date() ) );
            }
        }
        else
        {
            plugin = new org.apache.maven.plugin.registry.Plugin();

            plugin.setGroupId( aGroupId );
            plugin.setArtifactId( anArtifactId );
            plugin.setUseVersion( aVersion );

            pluginRegistry.addPlugin( plugin );

            pluginRegistry.flushPluginsByKey();
        }

        writeUserRegistry( aGroupId, anArtifactId, pluginRegistry );
    }
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

     */
    private void writeUserRegistry( String aGroupId, String anArtifactId, PluginRegistry pluginRegistry )
    {
        File pluginRegistryFile = pluginRegistry.getRuntimeInfo().getFile();

        PluginRegistry extractedUserRegistry = PluginRegistryUtils.extractUserPluginRegistry( pluginRegistry );

        // only rewrite the user-level registry if one existed before, or if we've created user-level data here.
        if ( extractedUserRegistry != null )
        {
            Writer fWriter = null;
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

     * @throws XmlPullParserException if any
     */
    private PluginRegistry getPluginRegistry( String aGroupId, String anArtifactId )
        throws IOException, XmlPullParserException
    {
        PluginRegistry pluginRegistry = null;

        pluginRegistry = pluginRegistryBuilder.buildPluginRegistry();

        if ( pluginRegistry == null )
        {
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

    }

    private boolean shouldCheckForUpdates( String groupId, String artifactId )
        throws PluginVersionResolutionException
    {
        PluginRegistry pluginRegistry = getPluginRegistry( groupId, artifactId );

        org.apache.maven.plugin.registry.Plugin plugin = getPlugin( groupId, artifactId, pluginRegistry );

        if ( plugin == null )
        {
            return true;
        }
        else
        {
            String lastChecked = plugin.getLastChecked();

            if ( StringUtils.isEmpty( lastChecked ) )
            {
                return true;
            }
            else
            {
                SimpleDateFormat format =
                    new SimpleDateFormat( org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT );

                try
                {
                    Date lastCheckedDate = format.parse( lastChecked );

                    return IntervalUtils.isExpired( pluginRegistry.getUpdateInterval(), lastCheckedDate );
                }
                catch ( ParseException e )
                {
                    getLogger().warn( "Last-checked date for plugin {" + constructPluginKey( groupId, artifactId ) +
                        "} is invalid. Checking for updates." );
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

    }

    private boolean checkForRejectedStatus( String groupId, String artifactId, String version )
        throws PluginVersionResolutionException
    {
        PluginRegistry pluginRegistry = getPluginRegistry( groupId, artifactId );

        org.apache.maven.plugin.registry.Plugin plugin = getPlugin( groupId, artifactId, pluginRegistry );

        return plugin.getRejectedVersions().contains( version );
    }
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

    }

    private void addNewVersionToRejectedListInExisting( String groupId, String artifactId, String rejectedVersion )
        throws PluginVersionResolutionException
    {
        PluginRegistry pluginRegistry = getPluginRegistry( groupId, artifactId );

        org.apache.maven.plugin.registry.Plugin plugin = getPlugin( groupId, artifactId, pluginRegistry );

        String pluginKey = constructPluginKey( groupId, artifactId );
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

    }

    private String resolveExistingFromPluginRegistry( String groupId, String artifactId )
        throws PluginVersionResolutionException
    {
        PluginRegistry pluginRegistry = getPluginRegistry( groupId, artifactId );

        org.apache.maven.plugin.registry.Plugin plugin = getPlugin( groupId, artifactId, pluginRegistry );

        String version = null;
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

    }

    private void updatePluginVersionInRegistry( String groupId, String artifactId, String version )
        throws PluginVersionResolutionException
    {
        PluginRegistry pluginRegistry = getPluginRegistry( groupId, artifactId );

        org.apache.maven.plugin.registry.Plugin plugin = getPlugin( groupId, artifactId, pluginRegistry );

        // if we can find the plugin, but we've gotten here, the useVersion must be missing; fill it in.
        if ( plugin != null )
        {
            if ( PluginRegistry.GLOBAL_LEVEL.equals( plugin.getSourceLevel() ) )
            {
                // do nothing. We don't rewrite the globals, under any circumstances.
                getLogger().warn( "Cannot update registered version for plugin {" + groupId + ":" + artifactId +
                    "}; it is specified in the global registry." );
            }
            else
            {
                plugin.setUseVersion( version );

                SimpleDateFormat format =
                    new SimpleDateFormat( org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT );

                plugin.setLastChecked( format.format( new Date() ) );
            }
        }
        else
        {
            plugin = new org.apache.maven.plugin.registry.Plugin();

            plugin.setGroupId( groupId );
            plugin.setArtifactId( artifactId );
            plugin.setUseVersion( version );

            pluginRegistry.addPlugin( plugin );

            pluginRegistry.flushPluginsByKey();
        }

        writeUserRegistry( groupId, artifactId, pluginRegistry );
    }
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

    private void writeUserRegistry( String groupId, String artifactId, PluginRegistry pluginRegistry )
    {
        File pluginRegistryFile = pluginRegistry.getRuntimeInfo().getFile();

        PluginRegistry extractedUserRegistry = PluginRegistryUtils.extractUserPluginRegistry( pluginRegistry );

        // only rewrite the user-level registry if one existed before, or if we've created user-level data here.
        if ( extractedUserRegistry != null )
        {
            FileWriter fWriter = null;
View Full Code Here

Examples of org.apache.maven.plugin.registry.PluginRegistry

    }

    private boolean shouldCheckForUpdates( String groupId, String artifactId )
        throws PluginVersionResolutionException
    {
        PluginRegistry pluginRegistry = getPluginRegistry( groupId, artifactId );

        org.apache.maven.plugin.registry.Plugin plugin = getPlugin( groupId, artifactId, pluginRegistry );

        if ( plugin == null )
        {
            return true;
        }
        else
        {
            String lastChecked = plugin.getLastChecked();

            if ( StringUtils.isEmpty( lastChecked ) )
            {
                return true;
            }
            else
            {
                SimpleDateFormat format =
                    new SimpleDateFormat( org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT );

                try
                {
                    Date lastCheckedDate = format.parse( lastChecked );

                    return IntervalUtils.isExpired( pluginRegistry.getUpdateInterval(), lastCheckedDate );
                }
                catch ( ParseException e )
                {
                    getLogger().warn( "Last-checked date for plugin {" + constructPluginKey( groupId, artifactId ) +
                        "} is invalid. Checking for updates." );
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.