// Path: centrepoint/modules/maven-importer/src/main/java/com/effectivemaven/centrepoint/maven/repository/RepositoryService.java
// @ImplementedBy( CentralRepositoryService.class )
// public interface RepositoryService
// {
//     /**
//      * Get the available versions for a given artifact by querying the repository metadata.
//      * The versions should be returned in sorted order from oldest to newest.
//      * 
//      * @param groupId the group ID of the artifact to query
//      * @param artifactId the artifact ID of the artifact to query
//      * @return versions available in the repository
//      * @throws RepositoryException
//      */
//     List<String> getAvailableVersions( String groupId, String artifactId )
//         throws RepositoryException;
// 
//     /**
//      * Retrieve a project from the repository and convert it to a basic Centrepoint project model.
//      * 
//      * @param groupId the Maven group ID to lookup
//      * @param artifactId the Maven artifact ID to lookup
//      * @param version the Maven artifact version to lookup
//      * @return the project created
//      * @throws RepositoryException
//      */
//     Project retrieveProject( String groupId, String artifactId, String version )
//         throws RepositoryException;
// }


import java.io.Serializable;
import java.util.List;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.Model;
import com.effectivemaven.centrepoint.maven.MavenProjectImporter;
import com.effectivemaven.centrepoint.maven.repository.RepositoryService;
import com.effectivemaven.centrepoint.model.Project;
import com.google.inject.Inject;
package com.effectivemaven.centrepoint.web;

/**
 * Copyright 2009
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */




/**
 * Page for importing a project into Centrepoint from Maven. The user is prompted for the group ID and artifact ID, and
 * a version is selected from a Maven repository. The POM is then imported and stored via the importer service.
 */
public class AddProjectFromMavenPage
    extends TemplatePage
{
    /**
     * Constructor.
     */
    public AddProjectFromMavenPage()
    {
        super();
        
        setPageTitle( "Add Project" );

        add( new FeedbackPanel( "feedback" ) );

        add( new InputForm( "addMavenProjectForm" ) );
    }

    @SuppressWarnings("serial")
    private static class InputFormModel
        implements Serializable
    {
        String groupId;

        String artifactId;
    }

    @SuppressWarnings("serial")
    private static class InputForm
        extends Form<InputFormModel>
    {
        /** Maven repository service for querying. */
        @Inject
// Path: centrepoint/modules/maven-importer/src/main/java/com/effectivemaven/centrepoint/maven/repository/RepositoryService.java
// @ImplementedBy( CentralRepositoryService.class )
// public interface RepositoryService
// {
//     /**
//      * Get the available versions for a given artifact by querying the repository metadata.
//      * The versions should be returned in sorted order from oldest to newest.
//      * 
//      * @param groupId the group ID of the artifact to query
//      * @param artifactId the artifact ID of the artifact to query
//      * @return versions available in the repository
//      * @throws RepositoryException
//      */
//     List<String> getAvailableVersions( String groupId, String artifactId )
//         throws RepositoryException;
// 
//     /**
//      * Retrieve a project from the repository and convert it to a basic Centrepoint project model.
//      * 
//      * @param groupId the Maven group ID to lookup
//      * @param artifactId the Maven artifact ID to lookup
//      * @param version the Maven artifact version to lookup
//      * @return the project created
//      * @throws RepositoryException
//      */
//     Project retrieveProject( String groupId, String artifactId, String version )
//         throws RepositoryException;
// }


// Path: centrepoint/modules/webapp/src/main/java/com/effectivemaven/centrepoint/web/AddProjectFromMavenPage.java
import java.io.Serializable;
import java.util.List;
import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.Model;
import com.effectivemaven.centrepoint.maven.MavenProjectImporter;
import com.effectivemaven.centrepoint.maven.repository.RepositoryService;
import com.effectivemaven.centrepoint.model.Project;
import com.google.inject.Inject;

package com.effectivemaven.centrepoint.web;

/**
 * Copyright 2009
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License. 
 */




/**
 * Page for importing a project into Centrepoint from Maven. The user is prompted for the group ID and artifact ID, and
 * a version is selected from a Maven repository. The POM is then imported and stored via the importer service.
 */
public class AddProjectFromMavenPage
    extends TemplatePage
{
    /**
     * Constructor.
     */
    public AddProjectFromMavenPage()
    {
        super();
        
        setPageTitle( "Add Project" );

        add( new FeedbackPanel( "feedback" ) );

        add( new InputForm( "addMavenProjectForm" ) );
    }

    @SuppressWarnings("serial")
    private static class InputFormModel
        implements Serializable
    {
        String groupId;

        String artifactId;
    }

    @SuppressWarnings("serial")
    private static class InputForm
        extends Form<InputFormModel>
    {
        /** Maven repository service for querying. */
        @Inject
        private RepositoryService repositoryService;