Source code: com/sun/syndication/io/impl/BaseWireFeedParser.java
1 package com.sun.syndication.io.impl;
2
3 import com.sun.syndication.feed.WireFeed;
4 import com.sun.syndication.io.WireFeedParser;
5 import org.jdom.Element;
6
7 import java.util.List;
8
9 /**
10 * @author Alejandro Abdelnur
11 */
12 public abstract class BaseWireFeedParser implements WireFeedParser {
13
14 /**
15 * [TYPE].feed.ModuleParser.classes= [className] ...
16 *
17 */
18 private static final String FEED_MODULE_PARSERS_POSFIX_KEY = ".feed.ModuleParser.classes";
19
20 /**
21 * [TYPE].item.ModuleParser.classes= [className] ...
22 *
23 */
24 private static final String ITEM_MODULE_PARSERS_POSFIX_KEY = ".item.ModuleParser.classes";
25
26
27 private String _type;
28 private ModuleParsers _feedModuleParsers;
29 private ModuleParsers _itemModuleParsers;
30
31 protected BaseWireFeedParser(String type) {
32 _type = type;
33 _feedModuleParsers = new ModuleParsers(type+FEED_MODULE_PARSERS_POSFIX_KEY);
34 _itemModuleParsers = new ModuleParsers(type+ITEM_MODULE_PARSERS_POSFIX_KEY);
35 }
36
37 /**
38 * Returns the type of feed the parser handles.
39 * <p>
40 * @see WireFeed for details on the format of this string.
41 * <p>
42 * @return the type of feed the parser handles.
43 *
44 */
45 public String getType() {
46 return _type;
47 }
48
49 protected List parseFeedModules(Element feedElement) {
50 return _feedModuleParsers.parseModules(feedElement);
51 }
52
53 protected List parseItemModules(Element itemElement) {
54 return _itemModuleParsers.parseModules(itemElement);
55 }
56
57 }