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 import java.util.Date; 020 import java.util.Locale; 021 022 import org.jdom.Element; 023 024 /** 025 * Default implemmentation of a FeedParserListener with noop methods. This can 026 * be used as a base class for new implementations which do not need most of the 027 * functionality of a FeedParserListener. 028 * 029 * Its recommended (but not required) that implementors extend this interface to 030 * that when new methods are added to the FeedParserListener that upgrades to 031 * this library do not break your application. 032 * 033 * @see FeedParserListener 034 * @author <a href="mailto:burton@apache.org">Kevin A. Burton (burtonator)</a> 035 * @version $Id: DefaultFeedParserListener.java 373614 2006-01-30 22:31:21Z mvdb $ 036 */ 037 public abstract class DefaultFeedParserListener implements FeedParserListener, 038 MetaFeedParserListener, 039 ModContentFeedParserListener, 040 XHTMLFeedParserListener, 041 ContentFeedParserListener { 042 043 private Object context = null; 044 045 public void onFeedVersion( FeedVersion version ) throws FeedParserException {} 046 public void init() throws FeedParserException {} 047 048 public void setContext( Object context ) throws FeedParserException { 049 this.context = context; 050 } 051 052 public Object getContext() throws FeedParserException { 053 return this.context; 054 } 055 056 public void onChannel( FeedParserState state, 057 String title, 058 String link, 059 String description ) throws FeedParserException {} 060 061 public void onChannelEnd() throws FeedParserException { } 062 063 public void onImage( FeedParserState state, 064 String title, 065 String link, 066 String url ) throws FeedParserException {} 067 068 public void onImageEnd() throws FeedParserException {} 069 070 public void onItem( FeedParserState state, 071 String title, 072 String link, 073 String description, 074 String permalink ) throws FeedParserException { } 075 076 public void onItemEnd() throws FeedParserException {} 077 public void finished() throws FeedParserException {} 078 079 // **** MetaFeedParserListener ********************************************** 080 081 public void onCopyright( FeedParserState state, String content ) throws FeedParserException {} 082 public void onCopyrightEnd() throws FeedParserException {} 083 084 /** 085 * http://www.mnot.net/drafts/draft-nottingham-atom-format-00.html#rfc.section.3.2.8 086 * 087 * 088 */ 089 public void onCreated( FeedParserState state, Date date ) throws FeedParserException{} 090 public void onCreatedEnd() throws FeedParserException {} 091 092 public void onSubject( FeedParserState state, String content ) throws FeedParserException {} 093 public void onSubjectEnd() throws FeedParserException {} 094 095 /** 096 * http://www.mnot.net/drafts/draft-nottingham-atom-format-00.html#rfc.section.3.2.7 097 * 098 * 099 */ 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 }