From archiva-commits-returnwurobert@example.net Mon Dec 10 21:25:41 2007 Return-Path: <archiva-commits-returnwurobert@example.net> Delivered-To: wurobert@example.net Received: (qmail 5260 invoked from network); 10 Dec 2007 21:25:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 10 Dec 2007 21:25:41 -0000 Received: (qmail 46805 invoked by uid 500); 10 Dec 2007 21:25:29 -0000 Delivered-To: wurobert@example.net Received: (qmail 46768 invoked by uid 500); 10 Dec 2007 21:25:29 -0000 Mailing-List: contact wurobert@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:wurobert@example.net> List-Unsubscribe: <mailto:wurobert@example.net> List-Post: <mailto:wurobert@example.net> List-Id: <archiva-commits.maven.apache.org> Reply-To: wurobert@example.net Delivered-To: mailing list wurobert@example.net Delivered-To: moderator for wurobert@example.net Received: (qmail 15913 invoked by uid 99); 10 Dec 2007 14:43:49 -0000 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r602916 - in /maven/archiva/trunk/archiva-base/archiva-configuration: ./ src/main/mdo/ src/main/resources/org/apache/maven/archiva/configuration/ src/test/java/org/apache/maven/archiva/configuration/ Date: Mon, 10 Dec 2007 14:43:39 -0000 To: wurobert@example.net From: wurobert@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <wurobert@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: nicolas Date: Mon Dec 10 06:43:38 2007 New Revision: 602916 URL: http://svn.apache.org/viewvc?rev=602916&view=rev Log: MRM-594 store exception to default legacy-path 2 artifact resolution in archiva.xml Default configuration includes jaxen-1.0-FCS-full.jar, used by some core maven1 plugins. Added: maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java Modified: maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml Modified: maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml?rev=602916&r1=602915&r2=602916&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml (original) +++ maven/archiva/trunk/archiva-base/archiva-configuration/pom.xml Mon Dec 10 06:43:38 2007 @@ -37,6 +37,10 @@ <artifactId>archiva-policies</artifactId> </dependency> <dependency> + <groupId>org.apache.maven.archiva</groupId> + <artifactId>archiva-model</artifactId> + </dependency> + <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-component-api</artifactId> </dependency> Modified: maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo?rev=602916&r1=602915&r2=602916&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo (original) +++ maven/archiva/trunk/archiva-base/archiva-configuration/src/main/mdo/configuration.mdo Mon Dec 10 06:43:38 2007 @@ -48,7 +48,7 @@ </description> <name>repositories</name> <version>1.0.0</version> - <association java.generate-add="false" + <association java.generate-add="false" java.generate-remove="false" java.generate-break="false" java.generate-create="false"> @@ -106,6 +106,17 @@ </description> </field> <field> + <name>legacyArtifactPaths</name> + <version>1.0.0+</version> + <association> + <type>LegacyArtifactPath</type> + <multiplicity>*</multiplicity> + </association> + <description> + The list of custom legacy path to artifact. + </description> + </field> + <field> <name>repositoryScanning</name> <version>1.0.0+</version> <association> @@ -156,10 +167,10 @@ } return map; } - + public java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> getProxyConnectorAsMap() { - java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap = + java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap = new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>(); java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator(); @@ -181,7 +192,7 @@ } return proxyConnectorMap; - } + } public java.util.Map<String, RemoteRepositoryConfiguration> getRemoteRepositoriesAsMap() { @@ -247,7 +258,7 @@ </codeSegments> </class> - <!-- + <!-- ____ _ _ | _ \ ___ _ __ ___ ___(_) |_ ___ _ __ _ _ | |_) / _ \ '_ \ / _ \/ __| | __/ _ \| '__| | | | @@ -430,7 +441,58 @@ </fields> </class> - <!-- + <class> + <name>LegacyArtifactPath</name> + <version>1.0.0+</version> + <fields> + <field> + <name>path</name> + <version>1.0.0+</version> + <type>String</type> + <required>true</required> + <description> + The legacy path. + </description> + </field> + <field> + <name>artifact</name> + <version>1.0.0+</version> + <type>String</type> + <required>true</required> + <description> + The artifact reference, as " [groupId] : [artifactId] : [version] : [classifier] : [type] ". + </description> + </field> + </fields> + <codeSegments> + <codeSegment> + <version>1.0.0+</version> + <code><![CDATA[ + public boolean match( String path ) + { + return path.equals( this.path ); + } + + public org.apache.maven.archiva.model.ArtifactReference getArtifactReference() + { + org.apache.maven.archiva.model.ArtifactReference reference = new org.apache.maven.archiva.model.ArtifactReference(); + String[] parts = artifact.split( ":" ); + reference.setGroupId( parts[0] ); + reference.setArtifactId( parts[1] ); + reference.setVersion( parts[2] ); + if ( parts[3].length() > 0 ) + { + reference.setClassifier( parts[3] ); + } + reference.setType( parts[4] ); + return reference; + } + ]]></code> + </codeSegment> + </codeSegments> + </class> + + <!-- ____ _ / ___|___ _ __ _ __ ___ ___| |_ ___ _ __ ___ | | / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __| @@ -519,7 +581,7 @@ <code><![CDATA[ /** * Obtain a specific policy from the underlying connector. - * + * * @param policyId the policy id to fetch. * @param defaultValue the default value for the policy id. * @return the configured policy value (or default value if not found). @@ -568,10 +630,10 @@ * The order id for UNORDERED */ public static final int UNORDERED = 0; - + /** * The policy key {@link #getPolicies()} for snapshot handling. - * See {@link org.apache.maven.archiva.policies.SnapshotsPolicy} + * See {@link org.apache.maven.archiva.policies.SnapshotsPolicy} * for details on potential values to this policy key. */ public static final String POLICY_SNAPSHOTS = "snapshots"; @@ -624,7 +686,7 @@ </fields> </class> - <!-- + <!-- ____ _ | _ \ _ __ _____ _(_) ___ ___ | |_) | '__/ _ \ \/ / |/ _ \/ __| @@ -692,7 +754,7 @@ </fields> </class> - <!-- + <!-- ____ _ / ___| ___ __ _ _ __ _ __ (_)_ __ __ _ \___ \ / __/ _` | '_ \| '_ \| | '_ \ / _` | @@ -809,13 +871,13 @@ </fields> </class> - <!-- - __ _______ ____ _ ____ ____ - \ \ / / ____| __ ) / \ | _ \| _ \ + <!-- + __ _______ ____ _ ____ ____ + \ \ / / ____| __ ) / \ | _ \| _ \ \ \ /\ / /| _| | _ \ / _ \ | |_) | |_) | - \ V V / | |___| |_) / ___ \| __/| __/ - \_/\_/ |_____|____/_/ \_\_| |_| - + \ V V / | |___| |_) / ___ \| __/| __/ + \_/\_/ |_____|____/_/ \_\_| |_| + --> <class> Modified: maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml?rev=602916&r1=602915&r2=602916&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml (original) +++ maven/archiva/trunk/archiva-base/archiva-configuration/src/main/resources/org/apache/maven/archiva/configuration/default-archiva.xml Mon Dec 10 06:43:38 2007 @@ -71,6 +71,13 @@ </proxyConnector> </proxyConnectors> + <legacyArtifactPaths> + <legacyArtifactPath> + <path>jaxen/jars/jaxen-1.0-FCS-full.jar</path> + <artifact>jaxen:jaxen:1.0-FCS:full:jar</artifact> + </legacyArtifactPath> + </legacyArtifactPaths> + <repositoryScanning> <fileTypes> <fileType> Added: maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java?rev=602916&view=auto ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java (added) +++ maven/archiva/trunk/archiva-base/archiva-configuration/src/test/java/org/apache/maven/archiva/configuration/LegacyArtifactPathTest.java Mon Dec 10 06:43:38 2007 @@ -0,0 +1,59 @@ +package org.apache.maven.archiva.configuration; + +import junit.framework.TestCase; + +import org.apache.maven.archiva.model.ArtifactReference; + +/* + * 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. + */ + +/** + * Test the generated LegacyArtifactPath class from Modello. This is primarily to test the hand coded methods. + */ +public class LegacyArtifactPathTest + extends TestCase +{ + + private LegacyArtifactPath legacyArtifactPath = new LegacyArtifactPath(); + + public void testLegacyArtifactPathWithClassifierResolution() + { + legacyArtifactPath.setArtifact( "groupId:artifactId:version:classifier:type" ); + + ArtifactReference artifact = legacyArtifactPath.getArtifactReference(); + assertEquals( "groupId", artifact.getGroupId() ); + assertEquals( "artifactId", artifact.getArtifactId() ); + assertEquals( "version", artifact.getVersion() ); + assertEquals( "classifier", artifact.getClassifier() ); + assertEquals( "type", artifact.getType() ); + } + + + public void testLegacyArtifactPathWithoutClassifierResolution() + { + legacyArtifactPath.setArtifact( "groupId:artifactId:version888a:dbb7:2d49:b3f6:8605:bf4e:caed:e5a4type" ); + + ArtifactReference artifact = legacyArtifactPath.getArtifactReference(); + assertEquals( "groupId", artifact.getGroupId() ); + assertEquals( "artifactId", artifact.getArtifactId() ); + assertEquals( "version", artifact.getVersion() ); + assertEquals( null, artifact.getClassifier() ); + assertEquals( "type", artifact.getType() ); + } +} From archiva-commits-returnwurobert@example.net Mon Dec 10 21:25:51 2007 Return-Path: <archiva-commits-returnwurobert@example.net> Delivered-To: wurobert@example.net Received: (qmail 5398 invoked from network); 10 Dec 2007 21:25:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 10 Dec 2007 21:25:50 -0000 Received: (qmail 46959 invoked by uid 500); 10 Dec 2007 21:25:39 -0000 Delivered-To: wurobert@example.net Received: (qmail 46928 invoked by uid 500); 10 Dec 2007 21:25:39 -0000 Mailing-List: contact wurobert@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:wurobert@example.net> List-Unsubscribe: <mailto:wurobert@example.net> List-Post: <mailto:wurobert@example.net> List-Id: <archiva-commits.maven.apache.org> Reply-To: wurobert@example.net Delivered-To: mailing list wurobert@example.net Delivered-To: moderator for wurobert@example.net Received: (qmail 34285 invoked by uid 99); 10 Dec 2007 14:58:43 -0000 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r602922 - in /maven/archiva/trunk/archiva-base/archiva-repository-layer/src: main/java/org/apache/maven/archiva/repository/content/ test/java/org/apache/maven/archiva/repository/content/ Date: Mon, 10 Dec 2007 14:58:16 -0000 To: wurobert@example.net From: wurobert@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <wurobert@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: nicolas Date: Mon Dec 10 06:58:14 2007 New Revision: 602922 URL: http://svn.apache.org/viewvc?rev=602922&view=rev Log: MRM-594 convert PathParsers to a plexus component, so that it can access the archivaConfiguration and read custom legacyPath 2 artifact references. Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/PathParser.java Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java Mon Dec 10 06:58:14 2007 @@ -28,7 +28,7 @@ import org.apache.maven.archiva.repository.layout.LayoutException; /** - * AbstractDefaultRepositoryContent - common methods for working with default (maven 2) layout. + * AbstractDefaultRepositoryContent - common methods for working with default (maven 2) layout. * * @author <a href="mailto:wurobert@example.net">Joakim Erdfelt</a> * @version $Id$ @@ -43,27 +43,32 @@ protected static final char ARTIFACT_SEPARATOR = '-'; + /** + * @plexus.requirement role-hint="default" + */ + private PathParser defaultPathParser; + public ArtifactReference toArtifactReference( String path ) throws LayoutException { - return DefaultPathParser.toArtifactReference( path ); + return defaultPathParser.toArtifactReference( path ); } public String toMetadataPath( ProjectReference reference ) { StringBuffer path = new StringBuffer(); - + path.append( formatAsDirectory( reference.getGroupId() ) ).append( PATH_SEPARATOR ); path.append( reference.getArtifactId() ).append( PATH_SEPARATOR ); path.append( MAVEN_METADATA ); - + return path.toString(); } public String toMetadataPath( VersionedReference reference ) { StringBuffer path = new StringBuffer(); - + path.append( formatAsDirectory( reference.getGroupId() ) ).append( PATH_SEPARATOR ); path.append( reference.getArtifactId() ).append( PATH_SEPARATOR ); if ( reference.getVersion() != null ) @@ -72,10 +77,10 @@ path.append( VersionUtil.getBaseVersion( reference.getVersion() ) ).append( PATH_SEPARATOR ); } path.append( MAVEN_METADATA ); - + return path.toString(); } - + public String toPath( ArchivaArtifact reference ) { if ( reference == null ) Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContent.java Mon Dec 10 06:58:14 2007 @@ -28,7 +28,7 @@ import java.util.Map; /** - * AbstractLegacyRepositoryContent + * AbstractLegacyRepositoryContent * * @author <a href="mailto:wurobert@example.net">Joakim Erdfelt</a> * @version $Id$ @@ -49,10 +49,15 @@ typeToDirectoryMap.put( "javadoc", "javadoc.jar" ); } + /** + * @plexus.requirement role-hint="legacy" + */ + private PathParser legacyPathParser; + public ArtifactReference toArtifactReference( String path ) throws LayoutException { - return LegacyPathParser.toArtifactReference( path ); + return legacyPathParser.toArtifactReference( path ); } public String toPath( ArchivaArtifact reference ) Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ArtifactExtensionMapping.java Mon Dec 10 06:58:14 2007 @@ -37,7 +37,7 @@ public static final String MAVEN_ARCHETYPE = "maven-archetype"; public static final String MAVEN_PLUGIN = "maven-plugin"; - + private static final Map<String, String> typeToExtensionMap; private static final Pattern mavenPluginPattern = Pattern.compile( "^(maven-.*-plugin)|(.*-maven-plugin)$" ); @@ -115,10 +115,10 @@ return normalizedName.substring( idx + 1 ); } } - + /** * Determine if a given artifact Id conforms to the naming scheme for a maven plugin. - * + * * @param artifactId the artifactId to test. * @return true if this artifactId conforms to the naming scheme for a maven plugin. */ Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java Mon Dec 10 06:58:14 2007 @@ -25,25 +25,22 @@ import org.apache.maven.archiva.repository.layout.LayoutException; /** - * DefaultPathParser is a parser for maven 2 (default layout) paths to ArtifactReference. + * DefaultPathParser is a parser for maven 2 (default layout) paths to ArtifactReference. * * @author <a href="mailto:wurobert@example.net">Joakim Erdfelt</a> * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.repository.content.DefaultPathParser" + * + * @plexus.component role="org.apache.maven.archiva.repository.content.PathParser" role-hint="default" */ -public class DefaultPathParser +public class DefaultPathParser implements PathParser { private static final String INVALID_ARTIFACT_PATH = "Invalid path to Artifact: "; /** - * Convert a path to an ArtifactReference. - * - * @param path - * @return - * @throws LayoutException + * {@inheritDoc} + * @see org.apache.maven.archiva.repository.content.PathParser#toArtifactReference(java.lang.String) */ - protected static ArtifactReference toArtifactReference( String path ) + public ArtifactReference toArtifactReference( String path ) throws LayoutException { if ( StringUtils.isBlank( path ) ) @@ -148,7 +145,7 @@ case '-': // Definately a classifier. artifact.setClassifier( parser.remaining() ); - + // Set the type. artifact.setType( ArtifactExtensionMapping.guessTypeFromFilename( filename ) ); break; @@ -162,9 +159,9 @@ artifact.setType( ArtifactExtensionMapping.guessTypeFromFilename( filename ) ); break; } - + // Special case for maven plugins - if ( StringUtils.equals( "jar", artifact.getType() ) && + if ( StringUtils.equals( "jar", artifact.getType() ) && ArtifactExtensionMapping.isMavenPlugin( artifact.getArtifactId() ) ) { artifact.setType( ArtifactExtensionMapping.MAVEN_PLUGIN ); @@ -201,5 +198,5 @@ return artifact; } - + } Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java Mon Dec 10 06:58:14 2007 @@ -19,23 +19,54 @@ * under the License. */ +import java.util.Collection; +import java.util.Iterator; +import java.util.Properties; + import org.apache.commons.lang.StringUtils; +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.LegacyArtifactPath; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.repository.layout.LayoutException; /** - * LegacyPathParser is a parser for maven 1 (legacy layout) paths to ArtifactReference. + * LegacyPathParser is a parser for maven 1 (legacy layout) paths to + * ArtifactReference. * * @author <a href="mailto:wurobert@example.net">Joakim Erdfelt</a> * @version $Id$ + * @plexus.component role="org.apache.maven.archiva.repository.content.PathParser" + * role-hint="legacy" */ public class LegacyPathParser + implements PathParser { private static final String INVALID_ARTIFACT_PATH = "Invalid path to Artifact: "; - protected static ArtifactReference toArtifactReference( String path ) + /** + * @plexus.requirement + */ + protected ArchivaConfiguration configuration; + + /** + * {@inheritDoc} + * + * @see org.apache.maven.archiva.repository.content.PathParser#toArtifactReference(java.lang.String) + */ + public ArtifactReference toArtifactReference( String path ) throws LayoutException { + // First, look if a custom resolution rule has been set for this artifact + Collection legacy = configuration.getConfiguration().getLegacyArtifactPaths(); + for ( Iterator iterator = legacy.iterator(); iterator.hasNext(); ) + { + LegacyArtifactPath legacyPath = (LegacyArtifactPath) iterator.next(); + if ( legacyPath.match( path ) ) + { + return legacyPath.getArtifactReference(); + } + } + ArtifactReference artifact = new ArtifactReference(); String normalizedPath = StringUtils.replace( path, "\\", "/" ); @@ -54,8 +85,8 @@ { // Illegal Path Parts Length. throw new LayoutException( INVALID_ARTIFACT_PATH - + "legacy paths should only have 3 parts [groupId]/[type]s/[artifactId]-[version].[type], found " - + pathParts.length + " instead." ); + + "legacy paths should only have 3 parts [groupId]/[type]s/[artifactId]-[version].[type], found " + + pathParts.length + " instead." ); } // The Group ID. @@ -68,7 +99,7 @@ if ( !expectedType.endsWith( "s" ) ) { throw new LayoutException( INVALID_ARTIFACT_PATH - + "legacy paths should have an expected type ending in [s] in the second part of the path." ); + + "legacy paths should have an expected type ending in [s] in the second part of the path." ); } // The Filename. @@ -88,7 +119,7 @@ parser.reset(); // Take the first section regardless of content. String artifactId = parser.next(); - + // Is there anything more that is considered not a version id? String moreArtifactId = parser.nextNonVersion(); if ( StringUtils.isNotBlank( moreArtifactId ) ) @@ -129,7 +160,7 @@ // Set Type artifact.setType( ArtifactExtensionMapping.guessTypeFromFilename( filename ) ); - + // Sanity Check: does it have an extension? if ( StringUtils.isEmpty( artifact.getType() ) ) { @@ -145,10 +176,10 @@ { // Sanity Check: does extension match pathType on path? String trimPathType = expectedType.substring( 0, expectedType.length() - 1 ); - + String expectedExtension = ArtifactExtensionMapping.getExtension( trimPathType ); String actualExtension = parser.getExtension(); - + if ( !expectedExtension.equals( actualExtension ) ) { throw new LayoutException( INVALID_ARTIFACT_PATH + "mismatch on extension [" + actualExtension Added: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/PathParser.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/PathParser.java?rev=602922&view=auto ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/PathParser.java (added) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/PathParser.java Mon Dec 10 06:58:14 2007 @@ -0,0 +1,19 @@ +/** + * + */ +package org.apache.maven.archiva.repository.content; + +import org.apache.maven.archiva.model.ArtifactReference; +import org.apache.maven.archiva.repository.layout.LayoutException; + +/** + * @author ndeloof + * + */ +public interface PathParser +{ + + public ArtifactReference toArtifactReference( String path ) + throws LayoutException; + +} Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java Mon Dec 10 06:58:14 2007 @@ -38,12 +38,12 @@ /** * RepositoryRequest is used to determine the type of request that is incoming, and convert it to an appropriate - * ArtifactReference. + * ArtifactReference. * * @author <a href="mailto:wurobert@example.net">Joakim Erdfelt</a> * @version $Id$ - * - * @plexus.component + * + * @plexus.component * role="org.apache.maven.archiva.repository.content.RepositoryRequest" */ public class RepositoryRequest @@ -59,11 +59,21 @@ */ private ArchivaConfiguration archivaConfiguration; + /** + * @plexus.requirement role-hint="default" + */ + private PathParser defaultPathParser; + + /** + * @plexus.requirement role-hint="legacy" + */ + private PathParser legacyPathParser; + private List<String> artifactPatterns; /** * Test path to see if it is an artifact being requested (or not). - * + * * @param requestedPath the path to test. * @return true if it is an artifact being requested. */ @@ -91,10 +101,10 @@ /** * Takes an incoming requested path (in "/" format) and gleans the layout * and ArtifactReference appropriate for that content. - * + * * @param requestedPath the relative path to the content. * @return the ArtifactReference for the requestedPath. - * @throws LayoutException if the request path is not layout valid. + * @throws LayoutException if the request path is not layout valid. */ public ArtifactReference toArtifactReference( String requestedPath ) throws LayoutException @@ -103,7 +113,7 @@ { throw new LayoutException( "Blank request path is not a valid." ); } - + String path = requestedPath; while ( path.startsWith( "/" ) ) { @@ -118,18 +128,18 @@ if ( isDefault( path ) ) { - return DefaultPathParser.toArtifactReference( path ); + return defaultPathParser.toArtifactReference( path ); } else if ( isLegacy( path ) ) { - return LegacyPathParser.toArtifactReference( path ); + return legacyPathParser.toArtifactReference( path ); } else { throw new LayoutException( "Not a valid request path layout, too short." ); } } - + /** * <p> * Tests the path to see if it conforms to the expectations of a metadata request. @@ -138,8 +148,8 @@ * NOTE: This does a cursory check on the path's last element. A result of true * from this method is not a guarantee that the metadata is in a valid format, or * that it even contains data. - * </p> - * + * </p> + * * @param requestedPath the path to test. * @return true if the requestedPath is likely a metadata request. */ @@ -147,7 +157,7 @@ { return requestedPath.endsWith( "/" + MetadataTools.MAVEN_METADATA ); } - + /** * <p> * Tests the path to see if it conforms to the expectations of a support file request. @@ -159,8 +169,8 @@ * NOTE: This does a cursory check on the path's extension only. A result of true * from this method is not a guarantee that the support resource is in a valid format, or * that it even contains data. - * </p> - * + * </p> + * * @param requestedPath the path to test. * @return true if the requestedPath is likely that of a support file request. */ @@ -175,7 +185,7 @@ String ext = requestedPath.substring( idx ); return ( ".sha1".equals( ext ) || ".md5".equals( ext ) || ".asc".equals( ext ) || ".pgp".equals( ext ) ); } - + /** * <p> * Tests the path to see if it conforms to the expectations of a default layout request. @@ -183,10 +193,10 @@ * <p> * NOTE: This does a cursory check on the count of path elements only. A result of * true from this method is not a guarantee that the path sections are valid and - * can be resolved to an artifact reference. use {@link #toArtifactReference(String)} + * can be resolved to an artifact reference. use {@link #toArtifactReference(String)} * if you want a more complete analysis of the validity of the path. * </p> - * + * * @param requestedPath the path to test. * @return true if the requestedPath is likely that of a default layout request. */ @@ -196,11 +206,11 @@ { return false; } - + String pathParts[] = StringUtils.splitPreserveAllTokens( requestedPath, '/' ); return pathParts.length > 3; } - + /** * <p> * Tests the path to see if it conforms to the expectations of a legacy layout request. @@ -208,10 +218,10 @@ * <p> * NOTE: This does a cursory check on the count of path elements only. A result of * true from this method is not a guarantee that the path sections are valid and - * can be resolved to an artifact reference. use {@link #toArtifactReference(String)} + * can be resolved to an artifact reference. use {@link #toArtifactReference(String)} * if you want a more complete analysis of the validity of the path. * </p> - * + * * @param requestedPath the path to test. * @return true if the requestedPath is likely that of a legacy layout request. */ @@ -221,18 +231,18 @@ { return false; } - + String pathParts[] = StringUtils.splitPreserveAllTokens( requestedPath, '/' ); return pathParts.length == 3; } - + /** * Adjust the requestedPath to conform to the native layout of the provided {@link ManagedRepositoryContent}. - * + * * @param requestedPath the incoming requested path. * @param repository the repository to adjust to. * @return the adjusted (to native) path. - * @throws LayoutException if the path cannot be parsed. + * @throws LayoutException if the path cannot be parsed. */ public String toNativePath( String requestedPath, ManagedRepositoryContent repository ) throws LayoutException { @@ -240,11 +250,11 @@ { throw new LayoutException( "Request Path is blank." ); } - + String referencedResource = requestedPath; // No checksum by default. String supportfile = ""; - + // Figure out support file, and actual referencedResource. if( isSupportFile( requestedPath ) ) { @@ -259,7 +269,7 @@ { throw new LayoutException( "Cannot translate metadata request to legacy layout." ); } - + /* Nothing to translate. * Default layout is the only layout that can contain maven-metadata.xml files, and * if the managedRepository is layout legacy, this request would never occur. Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/AbstractLegacyRepositoryContentTestCase.java Mon Dec 10 06:58:14 2007 @@ -24,7 +24,7 @@ import org.apache.maven.archiva.repository.layout.LayoutException; /** - * AbstractLegacyRepositoryContentTestCase + * AbstractLegacyRepositoryContentTestCase * * @author <a href="mailto:wurobert@example.net">Joakim Erdfelt</a> * @version $Id$ @@ -58,10 +58,10 @@ assertBadPath( "org.apache.maven.test/jars/artifactId-1.0.war", "wrong package extension" ); } - /** + /** * [MRM-432] Oddball version spec. * Example of an oddball / unusual version spec. - * @throws LayoutException + * @throws LayoutException */ public void testGoodButOddVersionSpecGanymedSsh2() throws LayoutException Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java Mon Dec 10 06:58:14 2007 @@ -6,7 +6,7 @@ import org.apache.maven.archiva.repository.layout.LayoutException; /** - * DefaultPathParserTest + * DefaultPathParserTest * * @author <a href="mailto:wurobert@example.net">Joakim Erdfelt</a> * @version $Id$ @@ -14,6 +14,8 @@ public class DefaultPathParserTest extends AbstractRepositoryLayerTestCase { + private PathParser parser = new DefaultPathParser(); + public void testBadPathMissingType() { assertBadPath( "invalid/invalid/1/invalid-1", "missing type" ); @@ -51,8 +53,8 @@ "wrong artifact id" ); } - /** - * [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error + /** + * [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error */ public void testGoodButDualExtensions() throws LayoutException @@ -66,11 +68,11 @@ assertLayout( path, groupId, artifactId, version, classifier, type ); } - - /** + + /** * [MRM-432] Oddball version spec. * Example of an oddball / unusual version spec. - * @throws LayoutException + * @throws LayoutException */ public void testGoodButOddVersionSpecGanymedSsh2() throws LayoutException @@ -85,10 +87,10 @@ assertLayout( path, groupId, artifactId, version, classifier, type ); } - /** + /** * [MRM-432] Oddball version spec. * Example of an oddball / unusual version spec. - * @throws LayoutException + * @throws LayoutException */ public void testGoodButOddVersionSpecJavaxComm() throws LayoutException @@ -105,11 +107,11 @@ /** * Test the ejb-client type spec. - * Type specs are not a 1 to 1 map to the extension. + * Type specs are not a 1 to 1 map to the extension. * This tests that effect. - * @throws LayoutException + * @throws LayoutException */ - /* TODO: Re-enabled in the future. + /* TODO: Re-enabled in the future. public void testGoodFooEjbClient() throws LayoutException { @@ -124,10 +126,10 @@ } */ - /** + /** * [MRM-432] Oddball version spec. * Example of an oddball / unusual version spec. - * @throws LayoutException + * @throws LayoutException */ public void testGoodButOddVersionSpecJavaxPersistence() throws LayoutException @@ -139,11 +141,11 @@ String type = "jar"; String path = "javax/persistence/ejb/3.0-public_review/ejb-3.0-public_review.jar"; - /* + /* * The version id of "public_review" can cause problems. is it part of * the version spec? or the classifier? * Since the path spec below shows it in the path, then it is really - * part of the version spec. + * part of the version spec. */ assertLayout( path, groupId, artifactId, version, classifier, type ); @@ -225,7 +227,7 @@ /** * Test the classifier, and java-source type spec. - * @throws LayoutException + * @throws LayoutException */ public void testGoodFooLibSources() throws LayoutException @@ -242,7 +244,7 @@ /** * A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory. - * @throws LayoutException + * @throws LayoutException */ public void testGoodSnapshotMavenTest() throws LayoutException @@ -311,7 +313,7 @@ { try { - DefaultPathParser.toArtifactReference( "" ); + parser.toArtifactReference( "" ); fail( "Should have failed due to empty path." ); } catch ( LayoutException e ) @@ -324,7 +326,7 @@ { try { - DefaultPathParser.toArtifactReference( null ); + parser.toArtifactReference( null ); fail( "Should have failed due to null path." ); } catch ( LayoutException e ) @@ -337,7 +339,7 @@ { try { - DefaultPathParser.toArtifactReference( "" ); + parser.toArtifactReference( "" ); fail( "Should have failed due to empty path." ); } catch ( LayoutException e ) @@ -350,7 +352,7 @@ { try { - DefaultPathParser.toArtifactReference( null ); + parser.toArtifactReference( null ); fail( "Should have failed due to null path." ); } catch ( LayoutException e ) @@ -360,14 +362,14 @@ } /** - * Perform a path to artifact reference lookup, and verify the results. + * Perform a path to artifact reference lookup, and verify the results. */ private void assertLayout( String path, String groupId, String artifactId, String version, String classifier, String type ) throws LayoutException { // Path to Artifact Reference. - ArtifactReference testReference = DefaultPathParser.toArtifactReference( path ); + ArtifactReference testReference = parser.toArtifactReference( path ); assertArtifactReference( testReference, groupId, artifactId, version, classifier, type ); } @@ -393,7 +395,7 @@ { try { - DefaultPathParser.toArtifactReference( path ); + parser.toArtifactReference( path ); fail( "Should have thrown a LayoutException on the invalid path [" + path + "] because of [" + reason + "]" ); } catch ( LayoutException e ) Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/LegacyPathParserTest.java Mon Dec 10 06:58:14 2007 @@ -20,6 +20,9 @@ */ +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.DefaultArchivaConfiguration; +import org.apache.maven.archiva.configuration.LegacyArtifactPath; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.repository.AbstractRepositoryLayerTestCase; import org.apache.maven.archiva.repository.layout.LayoutException; @@ -33,6 +36,26 @@ public class LegacyPathParserTest extends AbstractRepositoryLayerTestCase { + private LegacyPathParser parser = new LegacyPathParser(); + + /** + * Configure the ArchivaConfiguration + * {@inheritDoc} + * @see org.codehaus.plexus.PlexusTestCase#setUp() + */ + protected void setUp() + throws Exception + { + super.setUp(); + ArchivaConfiguration config = (ArchivaConfiguration) lookup( ArchivaConfiguration.class ); + LegacyArtifactPath jaxen = new LegacyArtifactPath(); + jaxen.setPath( "jaxen/jars/jaxen-1.0-FCS-full.jar" ); + jaxen.setArtifact( "jaxen:jaxen:1.0-FCS:full:jar" ); + config.getConfiguration().addLegacyArtifactPath( jaxen ); + parser.configuration = config; + } + + public void testBadPathArtifactIdMissingA() { assertBadPath( "groupId/jars/-1.0.jar", "artifactId is missing" ); @@ -339,21 +362,36 @@ } /** + * [MRM-594] add some hook in LegacyPathParser to allow exceptions in artifact resolution + */ + public void testCustomExceptionsInArtifactResolution() + throws LayoutException + { + String groupId = "jaxen"; + String artifactId = "jaxen"; + String version = "1.0-FCS"; + String type = "jar"; + String classifier = "full"; + String path = "jaxen/jars/jaxen-1.0-FCS-full.jar"; + + assertLayout( path, groupId, artifactId, version, classifier, type ); + } + + /** * Perform a path to artifact reference lookup, and verify the results. - * @param classifier TODO */ private void assertLayout( String path, String groupId, String artifactId, String version, String classifier, String type ) throws LayoutException { // Path to Artifact Reference. - ArtifactReference testReference = LegacyPathParser.toArtifactReference( path ); + ArtifactReference testReference = parser.toArtifactReference( path ); assertArtifactReference( testReference, groupId, artifactId, version, classifier, type ); } private void assertArtifactReference( ArtifactReference actualReference, String groupId, String artifactId, String version, String classifier, String type ) { - String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + type; + String expectedId = "ArtifactReference - " + groupId + ":" + artifactId + ":" + version + ":" + classifier + ":" + type; assertNotNull( expectedId + " - Should not be null.", actualReference ); @@ -368,7 +406,7 @@ { try { - LegacyPathParser.toArtifactReference( path ); + parser.toArtifactReference( path ); fail( "Should have thrown a LayoutException on the invalid path [" + path + "] because of [" + reason + "]" ); } catch ( LayoutException e ) Modified: maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java?rev=602922&r1=602921&r2=602922&view=diff ============================================================================== --- maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java (original) +++ maven/archiva/trunk/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/RepositoryRequestTest.java Mon Dec 10 06:58:14 2007 @@ -130,7 +130,7 @@ // Starting slash should not prevent detection. assertValid( "/org.apache.derby/poms/derby-83.161.120.155.pom", "org.apache.derby", "derby", "83.161.120.155", null, "pom" ); } - + public void testValidDefaultDerbyPom() throws Exception { @@ -214,7 +214,7 @@ assertTrue( repoRequest.isArtifact( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) ); assertTrue( repoRequest.isArtifact( "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) ); assertTrue( repoRequest.isArtifact( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz" ) ); - + assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz.sha1" ) ); assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz.md5" ) ); assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz.asc" ) ); @@ -222,7 +222,7 @@ assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/83.161.120.155/maven-metadata.xml" ) ); assertFalse( repoRequest.isArtifact( "org/apache/derby/derby/maven-metadata.xml" ) ); } - + public void testIsSupportFile() { assertTrue( repoRequest.isSupportFile( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz.sha1" ) ); @@ -231,7 +231,7 @@ assertTrue( repoRequest.isSupportFile( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz.pgp" ) ); assertTrue( repoRequest.isSupportFile( "org/apache/derby/derby/83.161.120.155/maven-metadata.xml.sha1" ) ); assertTrue( repoRequest.isSupportFile( "org/apache/derby/derby/83.161.120.155/maven-metadata.xml.md5" ) ); - + assertFalse( repoRequest.isSupportFile( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) ); assertFalse( repoRequest.isSupportFile( "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) ); assertFalse( repoRequest.isSupportFile( "org/apache/archiva/archiva-api/1.0/archiva-api-1.0.xml.zip" ) ); @@ -239,12 +239,12 @@ assertFalse( repoRequest.isSupportFile( "org/apache/derby/derby/83.161.120.155/maven-metadata.xml" ) ); assertFalse( repoRequest.isSupportFile( "org/apache/derby/derby/maven-metadata.xml" ) ); } - + public void testIsMetadata() { assertTrue( repoRequest.isMetadata( "org/apache/derby/derby/83.161.120.155/maven-metadata.xml" )); assertTrue( repoRequest.isMetadata( "org/apache/derby/derby/maven-metadata.xml" )); - + assertFalse( repoRequest.isMetadata( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) ); assertFalse( repoRequest.isMetadata( "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) ); assertFalse( repoRequest.isMetadata( "org/apache/archiva/archiva-api/1.0/archiva-api-1.0.xml.zip" ) ); @@ -252,49 +252,49 @@ assertFalse( repoRequest.isMetadata( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz.pgp" ) ); assertFalse( repoRequest.isMetadata( "org/apache/derby/derby/83.161.120.155/maven-metadata.xml.sha1" ) ); } - + public void testIsDefault() { assertFalse( repoRequest.isDefault( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) ); assertFalse( repoRequest.isDefault( "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom" ) ); assertFalse( repoRequest.isDefault( "commons-lang/jars/commons-lang-2.1-javadoc.jar" ) ); - + assertTrue( repoRequest.isDefault( "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) ); assertTrue( repoRequest.isDefault( "org/apache/archiva/archiva-api/1.0/archiva-api-1.0.xml.zip" ) ); assertTrue( repoRequest.isDefault( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz" ) ); assertTrue( repoRequest.isDefault( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz.pgp" ) ); assertTrue( repoRequest.isDefault( "org/apache/derby/derby/83.161.120.155/maven-metadata.xml.sha1" ) ); - + assertFalse( repoRequest.isDefault( null ) ); assertFalse( repoRequest.isDefault( "" ) ); assertFalse( repoRequest.isDefault( "foo" ) ); assertFalse( repoRequest.isDefault( "some.short/path" ) ); } - + public void testIsLegacy() { assertTrue( repoRequest.isLegacy( "test.maven-arch/poms/test-arch-2.0.3-SNAPSHOT.pom" ) ); assertTrue( repoRequest.isLegacy( "directory-clients/poms/ldap-clients-0.9.1-SNAPSHOT.pom" ) ); assertTrue( repoRequest.isLegacy( "commons-lang/jars/commons-lang-2.1-javadoc.jar" ) ); - + assertFalse( repoRequest.isLegacy( "test/maven-arch/test-arch/2.0.3-SNAPSHOT/test-arch-2.0.3-SNAPSHOT.jar" ) ); assertFalse( repoRequest.isLegacy( "org/apache/archiva/archiva-api/1.0/archiva-api-1.0.xml.zip" ) ); assertFalse( repoRequest.isLegacy( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz" ) ); assertFalse( repoRequest.isLegacy( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155-bin.tar.gz.pgp" ) ); assertFalse( repoRequest.isLegacy( "org/apache/derby/derby/83.161.120.155/maven-metadata.xml.sha1" ) ); - + assertFalse( repoRequest.isLegacy( null ) ); assertFalse( repoRequest.isLegacy( "" ) ); assertFalse( repoRequest.isLegacy( "some.short/path" ) ); } - + private ManagedRepositoryContent createManagedRepo( String layout ) throws Exception { File repoRoot = getTestFile( "target/test-repo" ); return createManagedRepositoryContent( "test-internal", "Internal Test Repo", repoRoot, layout ); } - + /** * [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error */ @@ -307,7 +307,7 @@ assertEquals( "org/project/example-presentation/3.2/example-presentation-3.2.xml.zip", repoRequest .toNativePath( "org/project/example-presentation/3.2/example-presentation-3.2.xml.zip", repository ) ); } - + /** * [MRM-481] Artifact requests with a .xml.zip extension fail with a 404 Error */ @@ -321,7 +321,7 @@ assertEquals( "org/project/example-presentation/3.2.xml/example-presentation-3.2.xml.zip", repoRequest .toNativePath( "org.project/zips/example-presentation-3.2.xml.zip", repository ) ); } - + public void testToNativePathMetadataDefaultToDefault() throws Exception { @@ -337,7 +337,7 @@ { ManagedRepositoryContent repository = createManagedRepo( "default" ); - // Test (pom) legacy to default + // Test (pom) legacy to default assertEquals( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155.pom", repoRequest .toNativePath( "org.apache.derby/poms/derby-83.161.120.155.pom", repository ) ); } @@ -368,7 +368,7 @@ // expected path. } } - + public void testNativePathBadRequestBlank() throws Exception { @@ -385,7 +385,7 @@ // expected path. } } - + public void testNativePathBadRequestNull() throws Exception { @@ -402,7 +402,7 @@ // expected path. } } - + public void testNativePathBadRequestUnknownType() throws Exception { @@ -419,14 +419,14 @@ // expected path. } } - + public void testToNativePathLegacyMetadataDefaultToLegacy() throws Exception { ManagedRepositoryContent repository = createManagedRepo( "legacy" ); // Test (metadata) default to legacy - + // Special Case: This direction is not supported, should throw a LayoutException. try { @@ -438,7 +438,7 @@ // expected path. } } - + public void testNativePathPomDefaultToLegacy() throws Exception { @@ -448,13 +448,13 @@ assertEquals( "org.apache.derby/poms/derby-83.161.120.155.pom", repoRequest .toNativePath( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155.pom", repository ) ); } - + public void testNativePathSupportFileDefaultToLegacy() throws Exception { ManagedRepositoryContent repository = createManagedRepo( "legacy" ); - // Test (supportfile) default to legacy + // Test (supportfile) default to legacy assertEquals( "org.apache.derby/jars/derby-83.161.120.155.jar.sha1", repoRequest .toNativePath( "org/apache/derby/derby/83.161.120.155/derby-83.161.120.155.jar.sha1", repository ) ); } From archiva-commits-returnwurobert@example.net Thu Dec 13 14:37:32 2007 Return-Path: <archiva-commits-returnwurobert@example.net> Delivered-To: wurobert@example.net Received: (qmail 66333 invoked from network); 13 Dec 2007 14:37:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 13 Dec 2007 14:37:32 -0000 Received: (qmail 3075 invoked by uid 500); 13 Dec 2007 14:37:21 -0000 Delivered-To: wurobert@example.net Received: (qmail 3017 invoked by uid 500); 13 Dec 2007 14:37:21 -0000 Mailing-List: contact wurobert@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:wurobert@example.net> List-Unsubscribe: <mailto:wurobert@example.net> List-Post: <mailto:wurobert@example.net> List-Id: <archiva-commits.maven.apache.org> Reply-To: wurobert@example.net Delivered-To: mailing list wurobert@example.net Delivered-To: moderator for wurobert@example.net Received: (qmail 61260 invoked by uid 99); 13 Dec 2007 11:36:46 -0000 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r603891 - in /maven/archiva/trunk/archiva-web/archiva-webapp/src/main: java/org/apache/maven/archiva/web/action/admin/legacy/ resources/ webapp/WEB-INF/jsp/admin/ webapp/WEB-INF/jsp/decorators/ Date: Thu, 13 Dec 2007 11:36:21 -0000 To: wurobert@example.net From: wurobert@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <wurobert@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: nicolas Date: Thu Dec 13 03:36:18 2007 New Revision: 603891 URL: http://svn.apache.org/viewvc?rev=603891&view=rev Log: MRM-594 support for custom legacy-path-2-artifact-reference resolution Web UI to register new exceptions to the artifact resolution algorithm. Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/legacyArtifactPath.jsp Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java?rev=603891&view=auto ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java (added) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java Thu Dec 13 03:36:18 2007 @@ -0,0 +1,111 @@ +package org.apache.maven.archiva.web.action.admin.legacy; + +/* + * 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 org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.IndeterminateConfigurationException; +import org.apache.maven.archiva.configuration.LegacyArtifactPath; +import org.apache.maven.archiva.repository.ManagedRepositoryContent; +import org.codehaus.plexus.registry.RegistryException; +import org.codehaus.plexus.xwork.action.PlexusActionSupport; + +import com.opensymphony.xwork.Preparable; + +/** + * Add a LegacyArtifactPath to archiva configuration + * + * + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="addLegacyArtifactPathAction" + */ +public class AddLegacyArtifactPathAction + extends PlexusActionSupport + implements Preparable +{ + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; + + /** + * @plexus.requirement role-hint="legacy" + */ + private ManagedRepositoryContent repositoryContent; + + + private LegacyArtifactPath legacyArtifactPath; + + + public void prepare() + { + this.legacyArtifactPath = new LegacyArtifactPath(); + } + + public String input() + { + return INPUT; + } + + public String commit() + { + ArtifactReference artifact = this.legacyArtifactPath.getArtifactReference(); + String path = repositoryContent.toPath( artifact ); + if ( ! path.equals( this.legacyArtifactPath.getPath() ) ) + { + addActionError( "artifact reference does not match the initial path : " + path ); + return ERROR; + } + + Configuration configuration = archivaConfiguration.getConfiguration(); + configuration.addLegacyArtifactPath( legacyArtifactPath ); + return saveConfiguration( configuration ); + } + + public LegacyArtifactPath getLegacyArtifactPath() + { + return legacyArtifactPath; + } + + public void setLegacyArtifactPath( LegacyArtifactPath legacyArtifactPath ) + { + this.legacyArtifactPath = legacyArtifactPath; + } + + protected String saveConfiguration( Configuration configuration ) + { + try + { + archivaConfiguration.save( configuration ); + addActionMessage( "Successfully saved configuration" ); + } + catch ( IndeterminateConfigurationException e ) + { + addActionError( e.getMessage() ); + return INPUT; + } + catch ( RegistryException e ) + { + addActionError( "Configuration Registry Exception: " + e.getMessage() ); + return INPUT; + } + + return SUCCESS; + } +} Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java?rev=603891&view=auto ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java (added) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java Thu Dec 13 03:36:18 2007 @@ -0,0 +1,92 @@ +package org.apache.maven.archiva.web.action.admin.legacy; + +/* + * 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.util.Iterator; + +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.IndeterminateConfigurationException; +import org.apache.maven.archiva.configuration.LegacyArtifactPath; +import org.codehaus.plexus.registry.RegistryException; +import org.codehaus.plexus.xwork.action.PlexusActionSupport; + +/** + * Delete a LegacyArtifactPath to archiva configuration + * + * + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="deleteLegacyArtifactPathAction" + */ +public class DeleteLegacyArtifactPathAction + extends PlexusActionSupport +{ + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; + + private String path; + + public String delete() + { + getLogger().info( "remove [" + path + "] from legacy artifact path resolution" ); + Configuration configuration = archivaConfiguration.getConfiguration(); + for ( Iterator iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); ) + { + LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next(); + if (legacyArtifactPath.match( path )) + { + iterator.remove(); + } + } + return saveConfiguration( configuration ); + } + + protected String saveConfiguration( Configuration configuration ) + { + try + { + archivaConfiguration.save( configuration ); + addActionMessage( "Successfully saved configuration" ); + } + catch ( IndeterminateConfigurationException e ) + { + addActionError( e.getMessage() ); + return INPUT; + } + catch ( RegistryException e ) + { + addActionError( "Configuration Registry Exception: " + e.getMessage() ); + return INPUT; + } + + return SUCCESS; + } + + public String getPath() + { + return path; + } + + public void setPath( String path ) + { + this.path = path; + } +} Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java?rev=603891&view=auto ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java (added) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/LegacyArtifactPathAction.java Thu Dec 13 03:36:18 2007 @@ -0,0 +1,96 @@ +package org.apache.maven.archiva.web.action.admin.legacy; + +/* + * 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.util.ArrayList; +import java.util.List; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.Configuration; +import org.apache.maven.archiva.configuration.LegacyArtifactPath; +import org.apache.maven.archiva.security.ArchivaRoleConstants; +import org.apache.maven.archiva.web.util.ContextUtils; +import org.codehaus.plexus.redback.rbac.Resource; +import org.codehaus.plexus.redback.xwork.interceptor.SecureAction; +import org.codehaus.plexus.redback.xwork.interceptor.SecureActionBundle; +import org.codehaus.plexus.redback.xwork.interceptor.SecureActionException; +import org.codehaus.plexus.xwork.action.PlexusActionSupport; + +import com.opensymphony.webwork.interceptor.ServletRequestAware; +import com.opensymphony.xwork.Preparable; + +/** + * Shows the LegacyArtifactPath Tab for the administrator. + * + * @plexus.component role="com.opensymphony.xwork.Action" role-hint="legacyArtifactPathAction" + */ +public class LegacyArtifactPathAction + extends PlexusActionSupport + implements SecureAction, ServletRequestAware, Preparable +{ + /** + * @plexus.requirement + */ + private ArchivaConfiguration archivaConfiguration; + + private List<LegacyArtifactPath> legacyArtifactPaths; + + /** + * Used to construct the repository WebDAV URL in the repository action. + */ + private String baseUrl; + + public void setServletRequest( HttpServletRequest request ) + { + // TODO: is there a better way to do this? + this.baseUrl = ContextUtils.getBaseURL( request, "repository" ); + } + + public SecureActionBundle getSecureActionBundle() + throws SecureActionException + { + SecureActionBundle bundle = new SecureActionBundle(); + + bundle.setRequiresAuthentication( true ); + bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, + Resource.GLOBAL ); + + return bundle; + } + + public void prepare() + { + Configuration config = archivaConfiguration.getConfiguration(); + + legacyArtifactPaths = new ArrayList<LegacyArtifactPath>( config.getLegacyArtifactPaths() ); + } + + public List<LegacyArtifactPath> getLegacyArtifactPaths() + { + return legacyArtifactPaths; + } + + public String getBaseUrl() + { + return baseUrl; + } +} Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml?rev=603891&r1=603890&r2=603891&view=diff ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml (original) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/resources/xwork.xml Thu Dec 13 03:36:18 2007 @@ -82,7 +82,7 @@ <global-results> <!-- The following security-* result names arrive from the plexus-security package --> - + <result name="security-login-success" type="redirect-action">index</result> <result name="security-login-cancel" type="redirect-action">index</result> <result name="security-login-locked" type="redirect-action"> @@ -303,13 +303,13 @@ <result name="success" type="redirect-action">proxyConnectors</result> <interceptor-ref name="configuredPrepareParamsStack"/> </action> - + <action name="sortDownProxyConnector" class="sortProxyConnectorsAction" method="sortDown"> <result name="input">/WEB-INF/jsp/admin/editProxyConnector.jsp</result> <result name="success" type="redirect-action">proxyConnectors</result> <interceptor-ref name="configuredPrepareParamsStack"/> </action> - + <action name="deleteProxyConnector" class="deleteProxyConnectorAction" method="confirm"> <result name="input">/WEB-INF/jsp/admin/deleteProxyConnector.jsp</result> <result name="success" type="redirect-action">proxyConnectors</result> @@ -399,6 +399,30 @@ <param name="namespace">/admin</param> </result> </action> + + <!-- .\ LEGACY SUPPORT \.__________________________________________ --> + + <action name="legacyArtifactPath" class="legacyArtifactPathAction" method="input"> + <result name="input">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result> + <result name="success" type="redirect-action"> + <param name="actionName">legacyArtifactPath</param> + </result> + </action> + + <action name="addLegacyArtifactPath" class="addLegacyArtifactPathAction" method="input"> + <result name="input">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result> + <result name="error">/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp</result> + <result name="success" type="redirect-action">legacyArtifactPath</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + + <action name="deleteLegacyArtifactPath" class="deleteLegacyArtifactPathAction" method="delete"> + <result name="input">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result> + <result name="error">/WEB-INF/jsp/admin/legacyArtifactPath.jsp</result> + <result name="success" type="redirect-action">legacyArtifactPath</result> + <interceptor-ref name="configuredPrepareParamsStack"/> + </action> + </package> <package name="report" namespace="/report" extends="base"> Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp?rev=603891&view=auto ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp (added) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/addLegacyArtifactPath.jsp Thu Dec 13 03:36:18 2007 @@ -0,0 +1,110 @@ +<%-- + ~ 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. + --%> + +<%@ taglib prefix="ww" uri="/webwork" %> + +<html> +<head> + <title>Admin: Add Legacy artifact path</title> + <ww:head/> +</head> + +<body> + +<h1>Admin: Add Legacy artifact path</h1> + +<div id="contentArea"> + + <script type="text/javascript"> + function parse( path ) + { + var group = path.indexOf( "/" ); + if ( group > 0 ) + { + document.getElementById( "addLegacyArtifactPath_groupId" ).value + = path.substring( 0, group ); + group += 1; + var type = path.indexOf( "/", group ); + if ( type > 0 ) + { + document.getElementById( "addLegacyArtifactPath_type" ).value + = path.substring( group, type - 1 ); + } + type += 1; + var version = path.indexOf( "-", type ); + var ext = path.lastIndexOf( "." ); + if ( version > 0 ) + { + document.getElementById( "addLegacyArtifactPath_artifactId" ).value + = path.substring( type, version ); + document.getElementById( "addLegacyArtifactPath_version" ).value + = path.substring( version + 1, ext ); + } + + } + } + function computeArtifactReference() + { + document.getElementById("addLegacyArtifactPath_legacyArtifactPath_artifact").value + = document.getElementById("addLegacyArtifactPath_groupId").value + + ":" + + document.getElementById("addLegacyArtifactPath_artifactId").value + + ":" + + document.getElementById("addLegacyArtifactPath_version").value + + ":" + + document.getElementById("addLegacyArtifactPath_classifier").value + + ":" + + document.getElementById("addLegacyArtifactPath_type").value; + } + </script> + + <ww:actionmessage/> + <ww:actionerror/> + <ww:form method="post" action="addLegacyArtifactPath!commit" namespace="/admin" validate="true" onsubmit="computeArtifactReference()"> + <ww:textfield name="legacyArtifactPath.path" label="Path" size="50" required="true" onchange="parse( this.value )"/> + <ww:textfield name="groupId" label="GroupId" size="20" required="true" disabled="true"/> + <ww:textfield name="artifactId" label="ArtifactId" size="20" required="true"/> + <ww:textfield name="version" label="Version" size="20" required="true"/> + <ww:textfield name="classifier" label="Classifier" size="20" required="false"/> + <ww:textfield name="type" label="Type" size="20" required="true" disabled="true"/> + <ww:hidden name="legacyArtifactPath.artifact"/> + <ww:submit value="Add Legacy Artifact Path"/> + </ww:form> + + <script type="text/javascript"> + var ref = document.getElementById("addLegacyArtifactPath_legacyArtifactPath_artifact").value; + var i = ref.indexOf( ":" ); + document.getElementById("addLegacyArtifactPath_groupId").value = ref.substring( 0, i ); + var j = i + 1; + var i = ref.indexOf( ":", j ); + document.getElementById("addLegacyArtifactPath_artifactId").value = ref.substring( j, i ); + var j = i + 1; + var i = ref.indexOf( ":", j ); + document.getElementById("addLegacyArtifactPath_version").value = ref.substring( j, i ); + var j = i + 1; + var i = ref.indexOf( ":", j ); + document.getElementById("addLegacyArtifactPath_classifier").value = ref.substring( j, i ); + + document.getElementById("addLegacyArtifactPath_legacyArtifactPath_path").focus(); + </script> + +</div> + +</body> +</html> Added: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/legacyArtifactPath.jsp URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/legacyArtifactPath.jsp?rev=603891&view=auto ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/legacyArtifactPath.jsp (added) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/admin/legacyArtifactPath.jsp Thu Dec 13 03:36:18 2007 @@ -0,0 +1,117 @@ +<%-- + ~ 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. + --%> + +<%@ taglib prefix="ww" uri="/webwork" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="redback" uri="http://plexus.codehaus.org/redback/taglib-1.0" %> +<%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %> + +<html> +<head> + <title>Administration - Legacy support</title> + <ww:head/> +</head> + +<body> + +<h1>Administration - Legacy artifacts path resolution</h1> + +<div id="contentArea"> + +<ww:actionerror/> +<ww:actionmessage/> + +<div class="admin"> +<div class="controls"> + <redback:ifAuthorized permission="archiva-manage-configuration"> + <ww:url id="addLegacyArtifactPathUrl" action="addLegacyArtifactPath"/> + <ww:a href="%{addLegacyArtifactPathUrl}"> + <img src="<c:url value="/images/icons/create.png" />" alt="" width="16" height="16"/> + Add + </ww:a> + </redback:ifAuthorized> +</div> +<h2>Legacy artifacts path resolution</h2> + +<c:choose> +<c:when test="${empty(legacyArtifactPaths)}"> + <%-- No Managed Repositories. --%> + <strong>There are no legacy artifact path configured yet.</strong> +</c:when> +<c:otherwise> +<%-- Display the repositories. --%> + +<c:forEach items="${legacyArtifactPaths}" var="legacyArtifactPath" varStatus="i"> +<c:choose> + <c:when test='${(i.index)%2 eq 0}'> + <c:set var="rowColor" value="dark" scope="page"/> + </c:when> + <c:otherwise> + <c:set var="rowColor" value="lite" scope="page"/> + </c:otherwise> +</c:choose> + +<div class="legacyArtifactPath ${rowColor}"> + +<div class="controls"> + <%-- TODO: make some icons --%> + <redback:ifAnyAuthorized permissions="archiva-manage-configuration"> + <ww:url id="deleteLegacyArtifactPath" action="deleteLegacyArtifactPath"> + <ww:param name="path" value="%{'${legacyArtifactPath.path}'}"/> + </ww:url> + <ww:a href="%{deleteLegacyArtifactPath}"> + <img src="<c:url value="/images/icons/delete.gif" />" alt="" width="16" height="16"/> + Delete + </ww:a> + </redback:ifAnyAuthorized> +</div> + +<div style="float: left"> + <img src="<c:url value="/images/archiva-splat-32.gif"/>" alt="" width="32" height="32"/> +</div> + +<table class="infoTable"> +<tr> + <th>Path</th> + <td> + <code>${legacyArtifactPath.path}</code> + </td> +</tr> +<tr> + <th>Artifact</th> + <td> + <code>${legacyArtifactPath.artifact}</code> + </td> +</tr> +</table> + +</div> +</c:forEach> + +</c:otherwise> +</c:choose> + + + +</div> + +</div> + +</body> +</html> Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp?rev=603891&r1=603890&r2=603891&view=diff ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp (original) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/jsp/decorators/default.jsp Thu Dec 13 03:36:18 2007 @@ -137,6 +137,9 @@ <my:currentWWUrl action="proxyConnectors" namespace="/admin">Proxy Connectors</my:currentWWUrl> </li> <li class="none"> + <my:currentWWUrl action="legacyArtifactPath" namespace="/admin">Legacy support</my:currentWWUrl> + </li> + <li class="none"> <my:currentWWUrl action="networkProxies" namespace="/admin">Network Proxies</my:currentWWUrl> </li> <li class="none"> From archiva-commits-returnwurobert@example.net Thu Dec 13 14:37:39 2007 Return-Path: <archiva-commits-returnwurobert@example.net> Delivered-To: wurobert@example.net Received: (qmail 66409 invoked from network); 13 Dec 2007 14:37:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 13 Dec 2007 14:37:39 -0000 Received: (qmail 3152 invoked by uid 500); 13 Dec 2007 14:37:28 -0000 Delivered-To: wurobert@example.net Received: (qmail 3101 invoked by uid 500); 13 Dec 2007 14:37:28 -0000 Mailing-List: contact wurobert@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:wurobert@example.net> List-Unsubscribe: <mailto:wurobert@example.net> List-Post: <mailto:wurobert@example.net> List-Id: <archiva-commits.maven.apache.org> Reply-To: wurobert@example.net Delivered-To: mailing list wurobert@example.net Delivered-To: moderator for wurobert@example.net Received: (qmail 71983 invoked by uid 99); 13 Dec 2007 11:43:16 -0000 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r603895 - /maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java Date: Thu, 13 Dec 2007 11:43:06 -0000 To: wurobert@example.net From: wurobert@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <wurobert@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: nicolas Date: Thu Dec 13 03:43:05 2007 New Revision: 603895 URL: http://svn.apache.org/viewvc?rev=603895&view=rev Log: MRM-594 fix missing java import Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java Modified: maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java URL: http://svn.apache.org/viewvc/maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java?rev=603895&r1=603894&r2=603895&view=diff ============================================================================== --- maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java (original) +++ maven/archiva/trunk/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/AddLegacyArtifactPathAction.java Thu Dec 13 03:43:05 2007 @@ -23,10 +23,12 @@ import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.IndeterminateConfigurationException; import org.apache.maven.archiva.configuration.LegacyArtifactPath; +import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.repository.ManagedRepositoryContent; import org.codehaus.plexus.registry.RegistryException; import org.codehaus.plexus.xwork.action.PlexusActionSupport; +import com.opensymphony.webwork.components.ActionError; import com.opensymphony.xwork.Preparable; /** From archiva-commits-returnwurobert@example.net Thu Dec 13 14:37:46 2007 Return-Path: <archiva-commits-returnwurobert@example.net> Delivered-To: wurobert@example.net Received: (qmail 66479 invoked from network); 13 Dec 2007 14:37:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (83.161.120.155) by minotaur.apache.org with SMTP; 13 Dec 2007 14:37:45 -0000 Received: (qmail 3204 invoked by uid 500); 13 Dec 2007 14:37:34 -0000 Delivered-To: wurobert@example.net Received: (qmail 3178 invoked by uid 500); 13 Dec 2007 14:37:34 -0000 Mailing-List: contact wurobert@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:wurobert@example.net> List-Unsubscribe: <mailto:wurobert@example.net> List-Post: <mailto:wurobert@example.net> List-Id: <archiva-commits.maven.apache.org> Reply-To: wurobert@example.net Delivered-To: mailing list wurobert@example.net Delivered-To: moderator for wurobert@example.net Received: (qmail 85342 invoked by uid 99); 13 Dec 2007 11:56:01 -0000 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r603897 - in /maven/archiva/trunk/archiva-docs/src/site/apt/adminguide: configuration.apt legacy.apt Date: Thu, 13 Dec 2007 11:55:48 -0000 To:
{'source': 'Apache Software Foundation Public Mail Archives'}