001 /*
002 * Copyright 1999,2004 The Apache Software Foundation.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017 package org.apache.commons.feedparser;
018
019 import java.util.LinkedList;
020 import java.util.List;
021
022 import org.apache.commons.feedparser.locate.FeedReference;
023
024 /**
025 * Contains a list of all feeds found the the AutoDiscovery system. Can also be
026 * used when needing to refer to a list of feeds and provides util methods for
027 * dealing with them
028 *
029 * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
030 * @version $Id: FeedList.java 373614 2006-01-30 22:31:21Z mvdb $
031 */
032 public class FeedList extends LinkedList implements List {
033
034 private FeedReference adAtomFeed = null;
035
036 private FeedReference adRSSFeed = null;
037
038 /**
039 *
040 * Get the RSS feed discovered via autodiscovery.
041 *
042 *
043 */
044 public FeedReference getAdRSSFeed() {
045
046 return this.adRSSFeed;
047
048 }
049
050 /**
051 *
052 * Set the value of <code>adRSSFeed</code>.
053 *
054 *
055 */
056 public void setAdRSSFeed( FeedReference adRSSFeed ) {
057
058 this.adRSSFeed = adRSSFeed;
059
060 }
061
062 /**
063 *
064 * Get the Atom feed discovered via autodiscovery.
065 *
066 *
067 */
068 public FeedReference getAdAtomFeed() {
069
070 return this.adAtomFeed;
071
072 }
073
074 /**
075 *
076 * Set the value of <code>adAtomFeed</code>.
077 *
078 *
079 */
080 public void setAdAtomFeed( FeedReference ref ) {
081
082 this.adAtomFeed = ref;
083
084 }
085
086 public void setFirstAdAtomFeed( FeedReference ref ) {
087
088 // > The order of the autodiscovery elements is significant.
089 // > The first element SHOULD point to the publisher's
090 // > preferred feed for the document.
091
092 if ( getAdAtomFeed() == null )
093 setAdAtomFeed( ref );
094
095 }
096
097 public void setFirstAdRSSFeed( FeedReference ref ) {
098
099 // > The order of the autodiscovery elements is significant.
100 // > The first element SHOULD point to the publisher's
101 // > preferred feed for the document.
102
103 if ( getAdRSSFeed() == null )
104 setAdRSSFeed( ref );
105
106 }
107
108 public void clear() {
109 super.clear();
110 this.adAtomFeed = null;
111 this.adRSSFeed = null;
112 }
113
114 }
115