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;
18  
19  import com.sun.syndication.feed.WireFeed;
20  import com.sun.syndication.io.FeedException;
21  import org.jdom.Document;
22  
23  /***
24   * Generates an XML document (JDOM) out of a feed for a specific real feed type.
25   * <p>
26   * WireFeedGenerator instances must thread safe.
27   * <p>
28   * TODO: explain how developers can plugin their own implementations.
29   * <p>
30   * @author Alejandro Abdelnur
31   *
32   */
33  public interface WireFeedGenerator {
34  
35      /***
36       * Returns the type of feed the generator creates.
37       * <p>
38       * @see WireFeed for details on the format of this string.
39       * <p>
40       * @return the type of feed the generator creates.
41       *
42       */
43      public String getType();
44  
45      /***
46       * Creates an XML document (JDOM) for the given feed bean.
47       * <p>
48       * @param feed the feed bean to generate the XML document from.
49       * @return the generated XML document (JDOM).
50       * @throws IllegalArgumentException thrown if the type of the given feed bean does not
51       *         match with the type of the WireFeedGenerator.
52       * @throws FeedException thrown if the XML Document could not be created.
53       *
54       */
55      public Document generate(WireFeed feed) throws IllegalArgumentException,FeedException;
56  
57  }