summaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/npanday-support
diff options
context:
space:
mode:
authorBrett Porter <brett@apache.org>2010-03-11 04:43:23 +0000
committerBrett Porter <brett@apache.org>2010-03-11 04:43:23 +0000
commita7238c5eb0702b96424f1ea46ea6c72766d1855f (patch)
tree5f948c1c6dd8454490ac9c082789c8fae958edcb /archiva-modules/plugins/npanday-support
parent5761f19b589673fb882bbe358555e176f646d820 (diff)
downloadarchiva-a7238c5eb0702b96424f1ea46ea6c72766d1855f.tar.gz
archiva-a7238c5eb0702b96424f1ea46ea6c72766d1855f.zip
[MRM-1361] add support for NPanday artifact types. Currently requires some hard coding into webapp and tests, but removing the plugin from the webapp would safely disable the functionality.
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@921687 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/npanday-support')
-rw-r--r--archiva-modules/plugins/npanday-support/pom.xml37
-rw-r--r--archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java74
2 files changed, 111 insertions, 0 deletions
diff --git a/archiva-modules/plugins/npanday-support/pom.xml b/archiva-modules/plugins/npanday-support/pom.xml
new file mode 100644
index 000000000..878ad4d58
--- /dev/null
+++ b/archiva-modules/plugins/npanday-support/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>plugins</artifactId>
+ <groupId>org.apache.archiva</groupId>
+ <version>1.4-SNAPSHOT</version>
+ </parent>
+ <artifactId>npanday-support</artifactId>
+ <name>NPanday Support for Archiva</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>maven2-repository</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java b/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java
new file mode 100644
index 000000000..800ec7c59
--- /dev/null
+++ b/archiva-modules/plugins/npanday-support/src/main/java/org/apache/archiva/plugins/npanday/NPandayArtifactMappingProvider.java
@@ -0,0 +1,74 @@
+package org.apache.archiva.plugins.npanday;
+
+/*
+ * 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.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @plexus.component role="org.apache.archiva.metadata.repository.storage.maven2.ArtifactMappingProvider" role-hint="npanday"
+ */
+public class NPandayArtifactMappingProvider
+ implements ArtifactMappingProvider
+{
+ private final Map<String, String> classifierAndExtensionToTypeMap;
+
+ private final Map<String, String> typeToExtensionMap;
+
+ public NPandayArtifactMappingProvider()
+ {
+ classifierAndExtensionToTypeMap = new HashMap<String, String>();
+
+ // TODO: this could be one of many - we need to look up the artifact metadata from the POM instead
+ // should do this anyway so that plugins don't compete for providing an extension
+ classifierAndExtensionToTypeMap.put( "dll", "library" );
+
+ classifierAndExtensionToTypeMap.put( "netmodule", "module" );
+ classifierAndExtensionToTypeMap.put( "exe", "winexe" );
+ classifierAndExtensionToTypeMap.put( "tests:jar", "test-jar" );
+
+ typeToExtensionMap = new HashMap<String, String>();
+ typeToExtensionMap.put( "library", "dll" );
+ typeToExtensionMap.put( "asp", "dll" );
+ typeToExtensionMap.put( "gac", "dll" );
+ typeToExtensionMap.put( "gac_generic", "dll" );
+ typeToExtensionMap.put( "gac_msil", "dll" );
+ typeToExtensionMap.put( "gac_32", "dll" );
+ typeToExtensionMap.put( "netplugin", "dll" );
+ typeToExtensionMap.put( "visual-studio-addin", "dll" );
+ typeToExtensionMap.put( "module", "netmodule" );
+ typeToExtensionMap.put( "exe.config", "exe.config" );
+ typeToExtensionMap.put( "winexe", "exe" );
+ typeToExtensionMap.put( "nar", "nar" );
+ }
+
+ public String mapClassifierAndExtensionToType( String classifier, String ext )
+ {
+ // we don't need classifier
+ return classifierAndExtensionToTypeMap.get( ext );
+ }
+
+ public String mapTypeToExtension( String type )
+ {
+ return typeToExtensionMap.get( type );
+ }
+}