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