View Javadoc

1   /*
2    * Copyright 1999,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.commons.feedparser;
18  
19  import java.util.LinkedList;
20  import java.util.List;
21  
22  import org.apache.commons.feedparser.locate.FeedReference;
23  
24  /**
25   * Contains a list of all feeds found the the AutoDiscovery system.  Can also be
26   * used when needing to refer to a list of feeds and provides util methods for
27   * dealing with them
28   * 
29   * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
30   * @version $Id: FeedList.java 373614 2006-01-30 22:31:21Z mvdb $
31   */
32  public class FeedList extends LinkedList implements List {
33      
34      private FeedReference adAtomFeed = null;
35      
36      private FeedReference adRSSFeed = null;
37  
38      /**
39       * 
40       * Get the RSS feed discovered via autodiscovery.
41       *
42       * 
43       */
44      public FeedReference getAdRSSFeed() { 
45          
46          return this.adRSSFeed;
47          
48      }
49  
50      /**
51       * 
52       * Set the value of <code>adRSSFeed</code>.
53       *
54       * 
55       */
56      public void setAdRSSFeed( FeedReference adRSSFeed ) { 
57          
58          this.adRSSFeed = adRSSFeed;
59          
60      }
61  
62      /**
63       * 
64       * Get the Atom feed discovered via autodiscovery.
65       *
66       * 
67       */
68      public FeedReference getAdAtomFeed() { 
69          
70          return this.adAtomFeed;
71          
72      }
73  
74      /**
75       * 
76       * Set the value of <code>adAtomFeed</code>.
77       *
78       * 
79       */
80      public void setAdAtomFeed( FeedReference ref ) { 
81          
82          this.adAtomFeed = ref;
83          
84      }
85  
86      public void setFirstAdAtomFeed( FeedReference ref ) {
87  
88          // > The order of the autodiscovery elements is significant.
89          // > The first element SHOULD point to the publisher's
90          // > preferred feed for the document.
91  
92          if ( getAdAtomFeed() == null )
93              setAdAtomFeed( ref );
94  
95      }
96  
97      public void setFirstAdRSSFeed( FeedReference ref ) {
98  
99          // > 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