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.Date;
20  import java.util.Locale;
21  
22  import org.jdom.Element;
23  
24  /**
25   * Default implemmentation of a FeedParserListener with noop methods.  This can
26   * be used as a base class for new implementations which do not need most of the
27   * functionality of a FeedParserListener.
28   * 
29   * Its recommended (but not required) that implementors extend this interface to
30   * that when new methods are added to the FeedParserListener that upgrades to
31   * this library do not break your application.
32   * 
33   * @see FeedParserListener 
34   * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a>
35   * @version $Id: DefaultFeedParserListener.java 373614 2006-01-30 22:31:21Z mvdb $
36   */
37  public abstract class DefaultFeedParserListener implements FeedParserListener,
38                                                             MetaFeedParserListener,
39                                                             ModContentFeedParserListener,
40                                                             XHTMLFeedParserListener,
41                                                             ContentFeedParserListener {
42  
43      private Object context = null;
44  
45      public void onFeedVersion( FeedVersion version ) throws FeedParserException {}
46      public void init() throws FeedParserException {}
47  
48      public void setContext( Object context ) throws FeedParserException {
49          this.context = context;
50      }
51  
52      public Object getContext() throws FeedParserException {
53          return this.context;
54      }
55  
56      public void onChannel( FeedParserState state,
57                             String title,
58                             String link,
59                             String description ) throws FeedParserException {}
60  
61      public void onChannelEnd() throws FeedParserException { }
62  
63      public void onImage( FeedParserState state,
64                           String title,
65                           String link,
66                           String url ) throws FeedParserException {}
67  
68      public void onImageEnd() throws FeedParserException {}
69      
70      public void onItem( FeedParserState state,
71                          String title,
72                          String link,
73                          String description,
74                          String permalink ) throws FeedParserException { }
75  
76      public void onItemEnd() throws FeedParserException {}
77      public void finished() throws FeedParserException {}
78  
79      // **** MetaFeedParserListener **********************************************
80  
81      public void onCopyright( FeedParserState state, String content ) throws FeedParserException {}
82      public void onCopyrightEnd() throws FeedParserException {}
83  
84      /**
85       * http://www.mnot.net/drafts/draft-nottingham-atom-format-00.html#rfc.section.3.2.8
86       *
87       * 
88       */
89      public void onCreated( FeedParserState state, Date date ) throws FeedParserException{}
90      public void onCreatedEnd() throws FeedParserException {}
91  
92      public void onSubject( FeedParserState state, String content ) throws FeedParserException {}
93      public void onSubjectEnd() throws FeedParserException {}
94  
95      /**
96       * http://www.mnot.net/drafts/draft-nottingham-atom-format-00.html#rfc.section.3.2.7
97       *
98       * 
99       */
100     public void onIssued( FeedParserState state, String content ) throws FeedParserException {} 
101     public void onIssuedEnd() throws FeedParserException {}
102 
103     public void onLocale( FeedParserState state, Locale locale ) throws FeedParserException {}
104 
105     public void onLocaleEnd() throws FeedParserException {}
106 
107     public void onGUID( FeedParserState state,
108                         String value,
109                         boolean isPermalink ) throws FeedParserException {}
110 
111     public void onGUIDEnd() throws FeedParserException{}
112 
113     public void onGenerator( FeedParserState state, String content ) throws FeedParserException {}
114     public void onGeneratorEnd() throws FeedParserException {}
115 
116     public void onAuthor( FeedParserState state,
117                           String name,
118                           String email,
119                           String resource ) throws FeedParserException {}
120 
121     public void onAuthorEnd() throws FeedParserException {}
122 
123     public void onComments( FeedParserState state,
124                             String resource ) throws FeedParserException {}
125 
126     public void onCommentsEnd() throws FeedParserException {}
127 
128     public void onCommentsFeed( FeedParserState state,
129                                 String resource ) throws FeedParserException {}
130 
131     public void onCommentsFeedEnd() throws FeedParserException {}
132 
133     // **** ModContentFeedParserListener ****************************************
134 
135     public void onContentEncoded( FeedParserState state,
136                                   String value ) throws FeedParserException {}
137 
138     public void onContentEncodedEnd() throws FeedParserException {}
139 
140     public void onContentItem( FeedParserState state,
141                                String format,
142                                String encoding,
143                                Element value ) throws FeedParserException {}
144 
145     public void onContentItemEnd() throws FeedParserException {}
146 
147     // **** XHTMLFeedParserListener *********************************************
148 
149     public void onXHTMLBody( FeedParserState state, Element value ) throws FeedParserException {}
150 
151     public void onXHTMLBodyEnd() throws FeedParserException {}
152 
153     // **** ContentFeedParserListener *******************************************
154 
155     public void onContent( FeedParserState state,
156                            String type,
157                            String format,
158                            String encoding,
159                            String mode,
160                            String value,
161                            boolean isSummary ) throws FeedParserException {}
162 
163     public void onContentEnd() throws FeedParserException {}
164 
165 }