Package org.apache.maven.plugin.registry

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


    }

    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

    }

    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

    }

    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

    }

    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

    }

    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

    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

     * @param parser
     */
    private PluginRegistry parsePluginRegistry(String tagName, XmlPullParser parser, boolean strict, String encoding)
        throws IOException, XmlPullParserException
    {
        PluginRegistry pluginRegistry = new PluginRegistry();
        pluginRegistry.setModelEncoding( encoding );
        java.util.Set parsed = new java.util.HashSet();
        int eventType = parser.getEventType();
        boolean foundRoot = false;
        while ( eventType != XmlPullParser.END_DOCUMENT )
        {
            if ( eventType == XmlPullParser.START_TAG )
            {
                if ( parser.getName().equals( tagName ) )
                {
                    foundRoot = true;
                }
                else if ( parser.getName().equals( "updateInterval" )  )
                {
                    if ( parsed.contains( "updateInterval" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "updateInterval" );
                    pluginRegistry.setUpdateInterval( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "autoUpdate" )  )
                {
                    if ( parsed.contains( "autoUpdate" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "autoUpdate" );
                    pluginRegistry.setAutoUpdate( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "checkLatest" )  )
                {
                    if ( parsed.contains( "checkLatest" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "checkLatest" );
                    pluginRegistry.setCheckLatest( getTrimmedValue( parser.nextText()) );
                }
                else if ( parser.getName().equals( "plugins" )  )
                {
                    if ( parsed.contains( "plugins" ) )
                    {
                        throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
                    }
                    parsed.add( "plugins" );
                    java.util.List plugins = new java.util.ArrayList();
                    pluginRegistry.setPlugins( plugins );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "plugin" ) )
                        {
                            plugins.add( parsePlugin( "plugin", parser, strict, encoding ) );
View Full Code Here

     * @return PluginRegistry
     */
    private PluginRegistry parsePluginRegistry( String tagName, XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        PluginRegistry pluginRegistry = new PluginRegistry();
        java.util.Set parsed = new java.util.HashSet();
        int eventType = parser.getEventType();
        boolean foundRoot = false;
        while ( eventType != XmlPullParser.END_DOCUMENT )
        {
            if ( eventType == XmlPullParser.START_TAG )
            {
                if ( parser.getName().equals( tagName ) )
                {
                    foundRoot = true;
                }
                else if ( strict && ! foundRoot )
                {
                    throw new XmlPullParserException( "Expected root element '" + tagName + "' but found '" + parser.getName() + "'", parser, null );
                }
                else if ( checkFieldWithDuplicate( parser, "updateInterval", null, parsed ) )
                {
                    pluginRegistry.setUpdateInterval( getTrimmedValue( parser.nextText() ) );
                }
                else if ( checkFieldWithDuplicate( parser, "autoUpdate", null, parsed ) )
                {
                    pluginRegistry.setAutoUpdate( getTrimmedValue( parser.nextText() ) );
                }
                else if ( checkFieldWithDuplicate( parser, "checkLatest", null, parsed ) )
                {
                    pluginRegistry.setCheckLatest( getTrimmedValue( parser.nextText() ) );
                }
                else if ( checkFieldWithDuplicate( parser, "plugins", null, parsed ) )
                {
                    java.util.List plugins = new java.util.ArrayList/*<Plugin>*/();
                    pluginRegistry.setPlugins( plugins );
                    while ( parser.nextTag() == XmlPullParser.START_TAG )
                    {
                        if ( parser.getName().equals( "plugin" ) )
                        {
                            plugins.add( parsePlugin( "plugin", parser, strict ) );
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.registry.PluginRegistry

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.