Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 4264 invoked from network); 11 Nov 2007 22:16:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Nov 2007 22:16:04 -0000 Received: (qmail 30300 invoked by uid 500); 11 Nov 2007 22:15:52 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 30275 invoked by uid 500); 11 Nov 2007 22:15:52 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 30261 invoked by uid 99); 11 Nov 2007 22:15:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Nov 2007 14:15:51 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Nov 2007 22:16:46 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9115E1A9832; Sun, 11 Nov 2007 14:15:40 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r593974 - /maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigureAppearanceAction.java Date: Sun, 11 Nov 2007 22:15:40 -0000 To: continuum-commits@maven.apache.org From: olamy@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071111221540.9115E1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: olamy Date: Sun Nov 11 14:15:39 2007 New Revision: 593974 URL: http://svn.apache.org/viewvc?rev=593974&view=rev Log: [CONTINUUM-1559] use repositories declared in settings.xml to load company pom Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigureAppearanceAction.java Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigureAppearanceAction.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigureAppearanceAction.java?rev=593974&r1=593973&r2=593974&view=diff ============================================================================== --- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigureAppearanceAction.java (original) +++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/ConfigureAppearanceAction.java Sun Nov 11 14:15:39 2007 @@ -1,27 +1,29 @@ package org.apache.maven.continuum.web.action.admin; /* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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. + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license + * agreements. See the NOTICE file distributed with this work for additional information regarding + * copyright ownership. The ASF licenses this file to you 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. */ import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.continuum.execution.maven.m2.MavenBuilderHelper; import org.apache.maven.continuum.execution.maven.m2.SettingsConfigurationException; import org.apache.maven.continuum.security.ContinuumRoleConstants; @@ -29,6 +31,10 @@ import org.apache.maven.continuum.web.appareance.AppareanceConfiguration; import org.apache.maven.model.Model; import org.apache.maven.project.ProjectBuildingException; +import org.apache.maven.settings.MavenSettingsBuilder; +import org.apache.maven.settings.Profile; +import org.apache.maven.settings.Repository; +import org.apache.maven.settings.Settings; import org.apache.maven.shared.app.company.CompanyPomHandler; import org.apache.maven.shared.app.configuration.Configuration; import org.apache.maven.shared.app.configuration.MavenAppConfiguration; @@ -37,6 +43,7 @@ import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle; import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException; import org.codehaus.plexus.registry.RegistryException; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import com.opensymphony.xwork.ModelDriven; @@ -70,13 +77,27 @@ * @plexus.requirement */ private MavenBuilderHelper helper; - /** * @plexus.requirement - */ + */ + private MavenSettingsBuilder mavenSettingsBuilder; + + /** + * @plexus.requirement + */ + private ArtifactRepositoryFactory artifactRepositoryFactory; + + /** + * @plexus.requirement role-hint="default" + */ + private ArtifactRepositoryLayout layout; + + /** + * @plexus.requirement + */ private AppareanceConfiguration appareanceConfiguration; - + public String execute() throws IOException, RegistryException { @@ -90,20 +111,45 @@ { return INPUT; } - + public Object getModel() { return configuration; } public void prepare() - throws ProjectBuildingException, ArtifactMetadataRetrievalException, SettingsConfigurationException + throws ProjectBuildingException, ArtifactMetadataRetrievalException, SettingsConfigurationException, + XmlPullParserException, IOException { + + Settings settings = mavenSettingsBuilder.buildSettings( false ); + + // Load extra repositories from active profiles + List profileIds = settings.getActiveProfiles(); + List profiles = settings.getProfiles(); + List remoteRepositories = new ArrayList(); + Map profilesAsMap = settings.getProfilesAsMap(); + if ( profileIds != null && !profileIds.isEmpty() ) + { + for ( String profileId : profileIds ) + { + Profile profile = profilesAsMap.get( profileId ); + List repos = profile.getRepositories(); + if ( repos != null && !repos.isEmpty() ) + { + for ( Repository repo : repos ) + { + remoteRepositories.add( artifactRepositoryFactory.createArtifactRepository( repo.getId(), repo + .getUrl(), layout, null, null ) ); + } + } + } + } configuration = appConfiguration.getConfiguration(); - companyModel = - companyPomHandler.getCompanyPomModel( configuration.getCompanyPom(), helper.getLocalRepository() ); - + companyModel = companyPomHandler.getCompanyPomModel( configuration.getCompanyPom(), + helper.getLocalRepository(), remoteRepositories ); + this.setFooter( appareanceConfiguration.getFooter() ); }