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.module.Module;
20  import com.sun.syndication.feed.WireFeed;
21  import org.jdom.Element;
22  
23  import java.util.Set;
24  
25  /**
26   * Injects module metadata into a XML node (JDOM element).
27   * <p>
28   * ModuleGenerator instances must thread safe.
29   * <p>
30   * TODO: explain how developers can plugin their own implementations.
31   * <p>
32   * @author Alejandro Abdelnur
33   *
34   */
35  public interface ModuleGenerator {
36  
37      /**
38       * Returns the namespace URI this generator handles.
39       * <p>
40       * @return the namespace URI.
41       *
42       */
43      public String getNamespaceUri();
44  
45      /**
46       * Returns a set with all the URIs (JDOM Namespace elements) this module generator uses.
47       * <p/>
48       * It is used by the the feed generators to add their namespace definition in
49       * the root element of the generated document (forward-missing of Java 5.0 Generics).
50       * <p/>
51       *
52       * @return a set with all the URIs (JDOM Namespace elements) this module generator uses.
53       */
54      public Set getNamespaces();
55  
56      /**
57       * Generates and injects module metadata into an XML node (JDOM element).
58       * <p>
59       * @param module the module to inject into the XML node (JDOM element).
60       * @param element the XML node into which module meta-data will be injected.
61       */
62      public void generate(Module module,Element element);
63  }