All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.maven.model.Plugin Maven / Gradle / Ivy

Go to download

Statistical sampling library for use in virtdata libraries, based on apache commons math 4

There is a newer version: 5.17.0
Show newest version
/*
 =================== DO NOT EDIT THIS FILE ====================
 Generated by Modello 1.0.1 on 2009-08-06 15:13:09,
 any modifications will be overwritten.
 ==============================================================
 */

package org.apache.maven.model;

/**
 * 
 *         
 *         The <plugin> element contains
 * informations required for a plugin.
 *         
 *       
 * 
 * @version $Revision$ $Date$
 */
public class Plugin
    extends ConfigurationContainer
    implements java.io.Serializable
{

      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * The group ID of the plugin in the repository.
     */
    private String groupId = "org.apache.maven.plugins";

    /**
     * The artifact ID of the plugin in the repository.
     */
    private String artifactId;

    /**
     * The version (or valid range of versions) of the plugin to be
     * used.
     */
    private String version;

    /**
     * Whether to load Maven extensions (such as packaging and type
     * handlers) from
     *             this plugin. For performance reasons, this
     * should only be enabled when necessary.
     */
    private boolean extensions = false;

    /**
     * Field executions.
     */
    private java.util.List executions;

    /**
     * Field dependencies.
     */
    private java.util.List dependencies;

    /**
     * 
     *             
     *             Deprecated. Unused by Maven.
     *             
     *           
     */
    private Object goals;


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Method addDependency.
     * 
     * @param dependency
     */
    public void addDependency( Dependency dependency )
    {
        if ( !(dependency instanceof Dependency) )
        {
            throw new ClassCastException( "Plugin.addDependencies(dependency) parameter must be instanceof " + Dependency.class.getName() );
        }
        getDependencies().add( dependency );
    } //-- void addDependency( Dependency )

    /**
     * Method addExecution.
     * 
     * @param pluginExecution
     */
    public void addExecution( PluginExecution pluginExecution )
    {
        if ( !(pluginExecution instanceof PluginExecution) )
        {
            throw new ClassCastException( "Plugin.addExecutions(pluginExecution) parameter must be instanceof " + PluginExecution.class.getName() );
        }
        getExecutions().add( pluginExecution );
    } //-- void addExecution( PluginExecution )

    /**
     * Get the artifact ID of the plugin in the repository.
     * 
     * @return String
     */
    public String getArtifactId()
    {
        return this.artifactId;
    } //-- String getArtifactId()

    /**
     * Method getDependencies.
     * 
     * @return List
     */
    public java.util.List getDependencies()
    {
        if ( this.dependencies == null )
        {
            this.dependencies = new java.util.ArrayList();
        }

        return this.dependencies;
    } //-- java.util.List getDependencies()

    /**
     * Method getExecutions.
     * 
     * @return List
     */
    public java.util.List getExecutions()
    {
        if ( this.executions == null )
        {
            this.executions = new java.util.ArrayList();
        }

        return this.executions;
    } //-- java.util.List getExecutions()

    /**
     * Get Deprecated. Unused by Maven.
     * 
     * @return Object
     */
    public Object getGoals()
    {
        return this.goals;
    } //-- Object getGoals()

    /**
     * Get the group ID of the plugin in the repository.
     * 
     * @return String
     */
    public String getGroupId()
    {
        return this.groupId;
    } //-- String getGroupId()

    /**
     * Get the version (or valid range of versions) of the plugin
     * to be used.
     * 
     * @return String
     */
    public String getVersion()
    {
        return this.version;
    } //-- String getVersion()

    /**
     * Get whether to load Maven extensions (such as packaging and
     * type handlers) from
     *             this plugin. For performance reasons, this
     * should only be enabled when necessary.
     * 
     * @return boolean
     */
    public boolean isExtensions()
    {
        return this.extensions;
    } //-- boolean isExtensions()

    /**
     * Method removeDependency.
     * 
     * @param dependency
     */
    public void removeDependency( Dependency dependency )
    {
        if ( !(dependency instanceof Dependency) )
        {
            throw new ClassCastException( "Plugin.removeDependencies(dependency) parameter must be instanceof " + Dependency.class.getName() );
        }
        getDependencies().remove( dependency );
    } //-- void removeDependency( Dependency )

    /**
     * Method removeExecution.
     * 
     * @param pluginExecution
     */
    public void removeExecution( PluginExecution pluginExecution )
    {
        if ( !(pluginExecution instanceof PluginExecution) )
        {
            throw new ClassCastException( "Plugin.removeExecutions(pluginExecution) parameter must be instanceof " + PluginExecution.class.getName() );
        }
        getExecutions().remove( pluginExecution );
    } //-- void removeExecution( PluginExecution )

    /**
     * Set the artifact ID of the plugin in the repository.
     * 
     * @param artifactId
     */
    public void setArtifactId( String artifactId )
    {
        this.artifactId = artifactId;
    } //-- void setArtifactId( String )

    /**
     * Set additional dependencies that this project needs to
     * introduce to the plugin's
     *             classloader.
     * 
     * @param dependencies
     */
    public void setDependencies( java.util.List dependencies )
    {
        this.dependencies = dependencies;
    } //-- void setDependencies( java.util.List )

    /**
     * Set multiple specifications of a set of goals to execute
     * during the build
     *             lifecycle, each having (possibly) a different
     * configuration.
     * 
     * @param executions
     */
    public void setExecutions( java.util.List executions )
    {
        this.executions = executions;
    } //-- void setExecutions( java.util.List )

    /**
     * Set whether to load Maven extensions (such as packaging and
     * type handlers) from
     *             this plugin. For performance reasons, this
     * should only be enabled when necessary.
     * 
     * @param extensions
     */
    public void setExtensions( boolean extensions )
    {
        this.extensions = extensions;
    } //-- void setExtensions( boolean )

    /**
     * Set Deprecated. Unused by Maven.
     * 
     * @param goals
     */
    public void setGoals( Object goals )
    {
        this.goals = goals;
    } //-- void setGoals( Object )

    /**
     * Set the group ID of the plugin in the repository.
     * 
     * @param groupId
     */
    public void setGroupId( String groupId )
    {
        this.groupId = groupId;
    } //-- void setGroupId( String )

    /**
     * Set the version (or valid range of versions) of the plugin
     * to be used.
     * 
     * @param version
     */
    public void setVersion( String version )
    {
        this.version = version;
    } //-- void setVersion( String )


            
    private java.util.Map executionMap = null;

    /**
     * Reset the executionMap field to null
     */
    public void flushExecutionMap()
    {
        this.executionMap = null;
    }

    /**
     * @return a Map of executions field with PluginExecution#getId() as key
     * @see org.apache.maven.model.PluginExecution#getId()
     */
    public java.util.Map getExecutionsAsMap()
    {
        if ( executionMap == null )
        {
            executionMap = new java.util.LinkedHashMap();
            if ( getExecutions() != null )
            {
                for ( java.util.Iterator i = getExecutions().iterator(); i.hasNext(); )
                {
                    PluginExecution exec = (PluginExecution) i.next();

                    if ( executionMap.containsKey( exec.getId() ) )
                    {
                        throw new IllegalStateException( "You cannot have two plugin executions with the same (or missing)  elements.\nOffending execution\n\nId: \'" + exec.getId() + "\'\nPlugin:\'" + getKey() + "\'\n\n" );
                    }

                    executionMap.put( exec.getId(), exec );
                }
            }
        }

        return executionMap;
    }

    private String key;

    /**
     * @return the key of the plugin, ie groupId:artifactId
     */
    public String getKey()
    {
        if ( key == null )
        {
            key = constructKey( groupId, artifactId ).intern();
        }
        return key;
    }

    /**
     * @param groupId
     * @param artifactId
     * @return the key of the plugin, ie groupId:artifactId
     */
    public static String constructKey( String groupId, String artifactId )
    {
        return groupId + ":" + artifactId;
    }

    /**
     * @see java.lang.Object#equals(java.lang.Object)
     */
    public boolean equals( Object other )
    {
        if ( this == other )
        {
            return true;
        }

        if ( other instanceof Plugin )
        {
            Plugin otherPlugin = (Plugin) other;

            return getKey().equals( otherPlugin.getKey() );
        }

        return false;
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode()
    {
        return getKey().hashCode();
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString()
    {
        return "Plugin [" + getKey() + "]";
    }
            
          
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy