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    
020    /**
021     * <p>
022     * Interface for generic feeds that support feed directory structures.  These
023     * are feed such as OPML and OCS that support nested feeds.  This can be used
024     * within two systems to exchange feed lists.
025     *
026     * <p>
027     * This interface needs to be compatible with:
028     * 
029     * <p>
030     *
031     * <dl>
032     *     <dt>FDML</dt>
033     *     <dd>http://www.intertwingly.net/wiki/fdml/</dd>
034     * 
035     *     <dt>OPML (Outline Processor Markup Language)</dt>
036     *     <dt>OCS (Open Content Syndication)</dt>
037     * 
038     *     <dt>XFN (XHTML Friends Network)</dt>
039     * 
040     * </dl>
041     * 
042     * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
043     * @version $Id: FeedDirectoryParserListener.java 373614 2006-01-30 22:31:21Z mvdb $
044     */
045    public interface FeedDirectoryParserListener extends FeedParserListener {
046    
047        /**
048         * Called when an directory item is found.  This is compatible with the
049         * FeedParserListener so that existing implementations work.  This provides
050         * a mechanism to index FDML, OPML, OCS, etc with existing feed parsers.
051         *
052         * @param weblog The HTML URL to the root of the weblog.  Example:
053         * http://www.peerfear.org
054         *
055         * @param title The title of the feed or weblog.  Maybe be null when not
056         * specified.
057         * 
058         * @param feed The XML URL to the RSS/Atom feed for this weblog.  This may
059         * be null in some situations when we don't have a feed URL
060         * 
061         * @see FeedParserListener#onItem
062         * 
063         */
064        public void onItem( FeedParserState state,
065                            String title,
066                            String weblog,
067                            String description,
068                            String feed ) throws FeedParserException;
069    
070        public void onItemEnd() throws FeedParserException;
071    
072        /**
073         * Called when we've found a relation for a given item.  This way you can
074         * specify the relationship you have with a given entry in your directory.
075         * This is mostly for compatibility purposes with XFN so that the values can
076         * be 'met', 'date', 'sweetheart', 'friend'.
077         *
078         * For XFN we would call onItem() methods and then onRelation() methods with
079         * each of the relations passed.
080         * 
081         * 
082         */
083        public void onRelation( FeedParserState state,
084                                String value );
085    
086        public void onRelationEnd();
087    
088        /**
089         * Called when a new Folder is found.  If feeds are in the default root
090         * folder this method is not called.  This is mostly for OPML support but
091         * could be used within other feed formats.  When this method isn't called
092         * one could assume that items are in the 'root' folder or no folder.
093         *
094         * 
095         */
096        public void onFolder( FeedParserState state,
097                              String name ) throws FeedParserException;
098    
099        public void onFolderEnd() throws FeedParserException;
100    
101    }
102