1package org.apache.archiva.repository.content.maven2;
23/*4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */2122import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider;
23import org.apache.archiva.metadata.repository.storage.maven2.DefaultArtifactMappingProvider;
2425/**26 * ArtifactExtensionMapping27 *28 *29 */30publicclassArtifactExtensionMapping31 {
32publicstaticfinal String MAVEN_ONE_PLUGIN = "maven-one-plugin";
3334// TODO: now only used in Maven 1, we should be using M1 specific mappings35privatestaticfinalArtifactMappingProvider mapping = newDefaultArtifactMappingProvider();
3637publicstatic String getExtension( String type )
38 {
39 String ext = mapping.mapTypeToExtension( type );
4041if ( ext == null )
42 {
43 ext = type;
44 }
4546return ext;
47 }
4849publicstatic String mapExtensionAndClassifierToType( String classifier, String extension )
50 {
51return mapExtensionAndClassifierToType( classifier, extension, extension );
52 }
5354publicstatic String mapExtensionAndClassifierToType( String classifier, String extension,
55 String defaultExtension )
56 {
57 String value = mapping.mapClassifierAndExtensionToType( classifier, extension );
58if ( value == null )
59 {
60// TODO: Maven 1 plugin61 String value1 = null;
62if ( "tar.gz".equals( extension ) )
63 {
64 value1 = "distribution-tgz";
65 }
66elseif ( "tar.bz2".equals( extension ) )
67 {
68 value1 = "distribution-bzip";
69 }
70elseif ( "zip".equals( extension ) )
71 {
72 value1 = "distribution-zip";
73 }
74 value = value1;
75 }
76return value != null ? value : defaultExtension;
77 }
78 }