summaryrefslogtreecommitdiffstats
path: root/archiva-modules/plugins/generic-metadata-support
diff options
context:
space:
mode:
authorMaria Odea B. Ching <oching@apache.org>2010-06-04 02:11:25 +0000
committerMaria Odea B. Ching <oching@apache.org>2010-06-04 02:11:25 +0000
commit1794af3da52cbf29f2b88d50e3ad416f8ddecd52 (patch)
treead72049cd5a0ca2076bdae5311aa27496abd39b0 /archiva-modules/plugins/generic-metadata-support
parent2ee860c6a09c9145034f266061dabef4c654f337 (diff)
downloadarchiva-1794af3da52cbf29f2b88d50e3ad416f8ddecd52.tar.gz
archiva-1794af3da52cbf29f2b88d50e3ad416f8ddecd52.zip
[MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic metadata" plugin
o added new facet for generic properties o display correct metadata in Metadata tab o add new properties to metadata from UI git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@951239 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins/generic-metadata-support')
-rw-r--r--archiva-modules/plugins/generic-metadata-support/pom.xml25
-rw-r--r--archiva-modules/plugins/generic-metadata-support/src/main/java/org/apache/archiva/metadata/generic/GenericMetadataFacet.java83
-rw-r--r--archiva-modules/plugins/generic-metadata-support/src/main/java/org/apache/archiva/metadata/generic/GenericMetadataFacetFactory.java42
3 files changed, 150 insertions, 0 deletions
diff --git a/archiva-modules/plugins/generic-metadata-support/pom.xml b/archiva-modules/plugins/generic-metadata-support/pom.xml
new file mode 100644
index 000000000..c8b34ce81
--- /dev/null
+++ b/archiva-modules/plugins/generic-metadata-support/pom.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>generic-metadata-support</artifactId>
+ <name>Generic Metadata Support</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.archiva</groupId>
+ <artifactId>metadata-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/archiva-modules/plugins/generic-metadata-support/src/main/java/org/apache/archiva/metadata/generic/GenericMetadataFacet.java b/archiva-modules/plugins/generic-metadata-support/src/main/java/org/apache/archiva/metadata/generic/GenericMetadataFacet.java
new file mode 100644
index 000000000..8bbe94553
--- /dev/null
+++ b/archiva-modules/plugins/generic-metadata-support/src/main/java/org/apache/archiva/metadata/generic/GenericMetadataFacet.java
@@ -0,0 +1,83 @@
+package org.apache.archiva.metadata.generic;
+
+/*
+ * 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.HashMap;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.archiva.metadata.model.MetadataFacet;
+
+public class GenericMetadataFacet
+ implements MetadataFacet
+{
+ private Map<String, String> additionalProperties;
+
+ public static final String FACET_ID = "org.apache.archiva.metadata.generic";
+
+ public String getFacetId()
+ {
+ return FACET_ID;
+ }
+
+ public String getName()
+ {
+ return "";
+ }
+
+ public void fromProperties( Map<String, String> properties )
+ {
+ if( additionalProperties == null )
+ {
+ additionalProperties = new TreeMap<String, String>();
+ }
+
+ for( String key : properties.keySet() )
+ {
+ additionalProperties.put( key, properties.get( key ) );
+ }
+ }
+
+ public Map<String, String> toProperties()
+ {
+ Map<String, String> properties = new TreeMap<String, String>();
+
+ if( additionalProperties != null )
+ {
+ for( String key : additionalProperties.keySet() )
+ {
+ properties.put( key, additionalProperties.get( key ) );
+ }
+ }
+
+ return properties;
+ }
+
+ public Map<String, String> getAdditionalProperties()
+ {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties( Map<String, String> additionalProperties )
+ {
+ this.additionalProperties = additionalProperties;
+ }
+
+}
diff --git a/archiva-modules/plugins/generic-metadata-support/src/main/java/org/apache/archiva/metadata/generic/GenericMetadataFacetFactory.java b/archiva-modules/plugins/generic-metadata-support/src/main/java/org/apache/archiva/metadata/generic/GenericMetadataFacetFactory.java
new file mode 100644
index 000000000..e8e9a7d45
--- /dev/null
+++ b/archiva-modules/plugins/generic-metadata-support/src/main/java/org/apache/archiva/metadata/generic/GenericMetadataFacetFactory.java
@@ -0,0 +1,42 @@
+package org.apache.archiva.metadata.generic;
+
+/*
+ * 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.model.MetadataFacet;
+import org.apache.archiva.metadata.model.MetadataFacetFactory;
+
+/**
+ * @plexus.component role="org.apache.archiva.metadata.model.MetadataFacetFactory" role-hint="org.apache.archiva.metadata.generic"
+ */
+public class GenericMetadataFacetFactory
+ implements MetadataFacetFactory
+{
+
+ public MetadataFacet createMetadataFacet()
+ {
+ return new GenericMetadataFacet();
+ }
+
+ public MetadataFacet createMetadataFacet( String repositoryId, String name )
+ {
+ throw new UnsupportedOperationException( "There is no valid name for project version facets" );
+ }
+
+}