001 package org.apache.archiva.plugins.npanday; 002 003 /* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022 import org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider; 023 import org.springframework.stereotype.Service; 024 025 import java.util.HashMap; 026 import java.util.Map; 027 028 /** 029 */ 030 @Service( "artifactMappingProvider#npanday" ) 031 public class NPandayArtifactMappingProvider 032 implements ArtifactMappingProvider 033 { 034 private final Map<String, String> extensionToTypeMap; 035 036 private final Map<String, String> typeToExtensionMap; 037 038 public NPandayArtifactMappingProvider() 039 { 040 extensionToTypeMap = new HashMap<String, String>(); 041 042 // TODO: this could be one of many - we need to look up the artifact metadata from the POM instead 043 // should do this anyway so that plugins don't compete for providing an extension 044 extensionToTypeMap.put( "dll", "dotnet-library" ); 045 046 extensionToTypeMap.put( "netmodule", "dotnet-module" ); 047 extensionToTypeMap.put( "exe", "dotnet-executable" ); 048 049 typeToExtensionMap = new HashMap<String, String>(); 050 typeToExtensionMap.put( "dotnet-library", "dll" ); 051 typeToExtensionMap.put( "dotnet-library-config", "dll.config" ); 052 typeToExtensionMap.put( "dotnet-executable", "exe" ); 053 typeToExtensionMap.put( "dotnet-executable-config", "exe.config" ); 054 typeToExtensionMap.put( "dotnet-module", "netmodule" ); 055 typeToExtensionMap.put( "dotnet-maven-plugin", "dll" ); 056 typeToExtensionMap.put( "asp", "dll" ); 057 typeToExtensionMap.put( "visual-studio-addin", "dll" ); 058 typeToExtensionMap.put( "sharp-develop-addin", "dll" ); 059 typeToExtensionMap.put( "nar", "nar" ); 060 typeToExtensionMap.put( "dotnet-symbols", "pdb" ); 061 typeToExtensionMap.put( "ole-type-library", "tlb" ); 062 typeToExtensionMap.put( "dotnet-vsdocs", "xml" ); 063 typeToExtensionMap.put( "dotnet-archive", "zip" ); 064 typeToExtensionMap.put( "dotnet-gac", "dll" ); 065 typeToExtensionMap.put( "gac", "dll" ); 066 typeToExtensionMap.put( "gac_msil", "dll" ); 067 typeToExtensionMap.put( "gac_msil4", "dll" ); 068 typeToExtensionMap.put( "gac_32", "dll" ); 069 typeToExtensionMap.put( "gac_32_4", "dll" ); 070 typeToExtensionMap.put( "gac_64", "dll" ); 071 typeToExtensionMap.put( "gac_64_4", "dll" ); 072 typeToExtensionMap.put( "com_reference", "dll" ); 073 074 // Legacy types 075 typeToExtensionMap.put( "library", "dll" ); 076 typeToExtensionMap.put( "gac_generic", "dll" ); 077 typeToExtensionMap.put( "netplugin", "dll" ); 078 typeToExtensionMap.put( "module", "netmodule" ); 079 typeToExtensionMap.put( "exe.config", "exe.config" ); 080 typeToExtensionMap.put( "winexe", "exe" ); 081 typeToExtensionMap.put( "exe", "exe" ); 082 } 083 084 public String mapClassifierAndExtensionToType( String classifier, String ext ) 085 { 086 // we don't need classifier 087 return extensionToTypeMap.get( ext ); 088 } 089 090 public String mapTypeToExtension( String type ) 091 { 092 return typeToExtensionMap.get( type ); 093 } 094 }