View Javadoc

1   /*
2    * Copyright 2004 Sun Microsystems, Inc.
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 com.sun.syndication.io.impl;
18  
19  import com.sun.syndication.io.WireFeedGenerator;
20  
21  import java.util.List;
22  
23  /***
24   * Generates an XML document (JDOM Document) out of a Feed.
25   * <p>
26   * It can generate all flavors of RSS (0.90, 0.91, 0.92, 0.93, 0.94, 1.0 and 2.0) and
27   * Atom 0.3 feed.
28   * <p>
29   * WireFeedGenerator instances are thread safe.
30   * <p>
31   * Generators for a specific type must extend this class and register in the generator list.
32   * (Right now registration is hardcoded in the WireFeedGenerator constructor).
33   * <p>
34   * @author Alejandro Abdelnur
35   *
36   */
37  public class FeedGenerators extends PluginManager {
38  
39      /***
40       * WireFeedGenerator.classes=  [className] ...
41       *
42       */
43      public static final String FEED_GENERATORS_KEY = "WireFeedGenerator.classes";
44  
45  
46      public FeedGenerators() {
47          super(FEED_GENERATORS_KEY);
48      }
49  
50      public WireFeedGenerator getGenerator(String feedType) {
51          return (WireFeedGenerator) getPlugin(feedType);
52      }
53  
54      protected String getKey(Object obj) {
55          return ((WireFeedGenerator)obj).getType();
56      }
57  
58      public List getSupportedFeedTypes() {
59          return getKeys();
60      }
61  
62  }