001    package org.apache.maven.plugin.version;
002    
003    /*
004     * Licensed to the Apache Software Foundation (ASF) under one
005     * or more contributor license agreements.  See the NOTICE file
006     * distributed with this work for additional information
007     * regarding copyright ownership.  The ASF licenses this file
008     * to you under the Apache License, Version 2.0 (the
009     * "License"); you may not use this file except in compliance
010     * with the License.  You may obtain a copy of the License at
011     *
012     *   http://www.apache.org/licenses/LICENSE-2.0
013     *
014     * Unless required by applicable law or agreed to in writing,
015     * software distributed under the License is distributed on an
016     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017     * KIND, either express or implied.  See the License for the
018     * specific language governing permissions and limitations
019     * under the License.
020     */
021    
022    import java.util.List;
023    
024    import org.apache.maven.model.Model;
025    import org.sonatype.aether.RepositorySystemSession;
026    import org.sonatype.aether.repository.RemoteRepository;
027    
028    /**
029     * Collects settings required to resolve the version for a plugin.
030     * 
031     * @since 3.0
032     * @author Benjamin Bentmann
033     */
034    public interface PluginVersionRequest
035    {
036    
037        /**
038         * Gets the group id of the plugin.
039         * 
040         * @return The group id of the plugin.
041         */
042        String getGroupId();
043    
044        /**
045         * Sets the group id of the plugin.
046         * 
047         * @param groupId The group id of the plugin.
048         * @return This request, never {@code null}.
049         */
050        PluginVersionRequest setGroupId( String groupId );
051    
052        /**
053         * Gets the artifact id of the plugin.
054         * 
055         * @return The artifact id of the plugin.
056         */
057        String getArtifactId();
058    
059        /**
060         * Sets the artifact id of the plugin.
061         * 
062         * @param artifactId The artifact id of the plugin.
063         * @return This request, never {@code null}.
064         */
065        PluginVersionRequest setArtifactId( String artifactId );
066    
067        /**
068         * Gets the POM whose build plugins are to be scanned for the version.
069         * 
070         * @return The POM whose build plugins are to be scanned for the verion or {@code null} to only search the plugin
071         *         repositories.
072         */
073        Model getPom();
074    
075        /**
076         * Sets the POM whose build plugins are to be scanned for the version.
077         * 
078         * @param pom The POM whose build plugins are to be scanned for the version, may be {@code null} to only search the
079         *            plugin repositories.
080         * @return This request, never {@code null}.
081         */
082        PluginVersionRequest setPom( Model pom );
083    
084        /**
085         * Gets the remote repositories to use.
086         * 
087         * @return The remote repositories to use, never {@code null}.
088         */
089        List<RemoteRepository> getRepositories();
090    
091        /**
092         * Sets the remote repositories to use. <em>Note:</em> When creating a request from a project, be sure to use the
093         * plugin repositories and not the regular project repositories.
094         * 
095         * @param repositories The remote repositories to use.
096         * @return This request, never {@code null}.
097         */
098        PluginVersionRequest setRepositories( List<RemoteRepository> repositories );
099    
100        /**
101         * Gets the session to use for repository access.
102         * 
103         * @return The repository session or {@code null} if not set.
104         */
105        RepositorySystemSession getRepositorySession();
106    
107        /**
108         * Sets the session to use for repository access.
109         * 
110         * @param repositorySession The repository session to use.
111         * @return This request, never {@code null}.
112         */
113        PluginVersionRequest setRepositorySession( RepositorySystemSession repositorySession );
114    
115    }