]> source.dussan.org Git - archiva.git/blob
25139b9b48047254e0fc5a1f27ba0c0164831929
[archiva.git] /
1 package org.apache.maven.archiva.reporting.group;
2
3 /*
4  * Copyright 2005-2006 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 import org.apache.maven.artifact.Artifact;
20 import org.apache.maven.artifact.repository.ArtifactRepository;
21 import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
22 import org.apache.maven.model.Model;
23 import org.apache.maven.archiva.reporting.group.ReportGroup;
24 import org.apache.maven.archiva.reporting.database.ReportingDatabase;
25 import org.apache.maven.archiva.reporting.processor.ArtifactReportProcessor;
26 import org.apache.maven.archiva.reporting.processor.MetadataReportProcessor;
27
28 import java.util.Iterator;
29 import java.util.Map;
30
31 /**
32  * Basic functionality for all report groups.
33  */
34 public abstract class AbstractReportGroup
35     implements ReportGroup
36 {
37     /**
38      * @plexus.requirement role="org.apache.maven.archiva.reporting.processor.ArtifactReportProcessor"
39      */
40     private Map artifactReports;
41
42     /**
43      * @plexus.requirement role="org.apache.maven.archiva.reporting.processor.MetadataReportProcessor"
44      */
45     private Map metadataReports;
46
47     public void processArtifact( Artifact artifact, Model model, ReportingDatabase reportingDatabase )
48     {
49         for ( Iterator i = artifactReports.entrySet().iterator(); i.hasNext(); )
50         {
51             Map.Entry entry = (Map.Entry) i.next();
52
53             if ( includeReport( (String) entry.getKey() ) )
54             {
55                 ArtifactReportProcessor report = (ArtifactReportProcessor) entry.getValue();
56
57                 report.processArtifact( artifact, model, reportingDatabase );
58             }
59         }
60     }
61
62     public void processMetadata( RepositoryMetadata repositoryMetadata, ArtifactRepository repository,
63                                  ReportingDatabase reportingDatabase )
64     {
65         for ( Iterator i = metadataReports.entrySet().iterator(); i.hasNext(); )
66         {
67             Map.Entry entry = (Map.Entry) i.next();
68
69             if ( includeReport( (String) entry.getKey() ) )
70             {
71                 MetadataReportProcessor report = (MetadataReportProcessor) entry.getValue();
72
73                 report.processMetadata( repositoryMetadata, repository, reportingDatabase );
74             }
75         }
76     }
77
78     public String toString()
79     {
80         return getName();
81     }
82 }