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