1 package org.apache.archiva.rss.processor;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import java.util.ArrayList;
23 import java.util.Date;
24 import java.util.List;
27 import org.apache.archiva.rss.RssFeedEntry;
28 import org.apache.maven.archiva.model.ArchivaArtifact;
30 import com.sun.syndication.feed.synd.SyndFeed;
33 * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
36 public abstract class AbstractArtifactsRssFeedProcessor
37 implements RssFeedProcessor
39 public abstract SyndFeed process( Map<String, String> reqParams );
41 protected List<RssFeedEntry> processData( List<ArchivaArtifact> artifacts, boolean isRepoLevel )
44 RssFeedEntry entry = null;
45 List<RssFeedEntry> entries = new ArrayList<RssFeedEntry>();
46 String description = "";
48 for ( ArchivaArtifact artifact : artifacts )
50 long whenGathered = artifact.getModel().getWhenGathered().getTime();
52 if ( tmp != whenGathered )
56 entry.setDescription( description );
64 new RssFeedEntry( getTitle() + "\'" + artifact.getGroupId() + ":" + artifact.getArtifactId() +
65 "\'" + " as of " + new Date( whenGathered ) );
66 entry.setPublishedDate( artifact.getModel().getWhenGathered() );
67 description = getDescription() + "\'" + artifact.getGroupId() + ":" + artifact.getArtifactId() +
68 "\'" + ": \n" + artifact.toString() + " | ";
72 String repoId = artifact.getModel().getRepositoryId();
73 entry = new RssFeedEntry( getTitle() + "\'" + repoId + "\'" + " as of " + new Date( whenGathered ) );
74 entry.setPublishedDate( artifact.getModel().getWhenGathered() );
75 description = getDescription() + "\'" + repoId + "\'" + ": \n" + artifact.toString() + " | ";
80 description = description + artifact.toString() + " | ";
83 if ( idx == ( artifacts.size() - 1 ) )
85 entry.setDescription( description );
96 protected abstract String getTitle();
98 protected abstract String getDescription();