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 org.jdom.*;
20  
21  /***
22   * <p>
23   * Interface for generic feeds that support feed directory structures.  These
24   * are feed such as OPML and OCS that support nested feeds.  This can be used
25   * within two systems to exchange feed lists.
26   *
27   * <p>
28   * This interface needs to be compatible with:
29   * 
30   * <p>
31   *
32   * <dl>
33   *     <dt>FDML</dt>
34   *     <dd>http://www.intertwingly.net/wiki/fdml/</dd>
35   * 
36   *     <dt>OPML (Outline Processor Markup Language)</dt>
37   *     <dt>OCS (Open Content Syndication)</dt>
38   * 
39   *     <dt>XFN (XHTML Friends Network)</dt>
40   * 
41   * </dl>
42   * 
43   * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
44   * @version $Id: FeedDirectoryParserListener.java 159212 2005-03-27 23:31:07Z burton $
45   */
46  public interface FeedDirectoryParserListener extends FeedParserListener {
47  
48      /***
49       * Called when an directory item is found.  This is compatible with the
50       * FeedParserListener so that existing implementations work.  This provides
51       * a mechanism to index FDML, OPML, OCS, etc with existing feed parsers.
52       *
53       * @param weblog The HTML URL to the root of the weblog.  Example:
54       * http://www.peerfear.org
55       *
56       * @param title The title of the feed or weblog.  Maybe be null when not
57       * specified.
58       * 
59       * @param feed The XML URL to the RSS/Atom feed for this weblog.  This may
60       * be null in some situations when we don't have a feed URL
61       * 
62       * @see FeedParserListener#onItem
63       * 
64       */
65      public void onItem( FeedParserState state,
66                          String title,
67                          String weblog,
68                          String description,
69                          String feed ) throws FeedParserException;
70  
71      public void onItemEnd() throws FeedParserException;
72  
73      /***
74       * Called when we've found a relation for a given item.  This way you can
75       * specify the relationship you have with a given entry in your directory.
76       * This is mostly for compatibility purposes with XFN so that the values can
77       * be 'met', 'date', 'sweetheart', 'friend'.
78       *
79       * For XFN we would call onItem() methods and then onRelation() methods with
80       * each of the relations passed.
81       * 
82       * 
83       */
84      public void onRelation( FeedParserState state,
85                              String value );
86  
87      public void onRelationEnd();
88  
89      /***
90       * Called when a new Folder is found.  If feeds are in the default root
91       * folder this method is not called.  This is mostly for OPML support but
92       * could be used within other feed formats.  When this method isn't called
93       * one could assume that items are in the 'root' folder or no folder.
94       *
95       * 
96       */
97      public void onFolder( FeedParserState state,
98                            String name ) throws FeedParserException;
99  
100     public void onFolderEnd() throws FeedParserException;
101 
102 }
103