1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.rewriter;
18
19 import java.io.Reader;
20
21 import org.apache.jetspeed.rewriter.rules.Ruleset;
22
23 /***
24 * RewriterService
25 *
26 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
27 * @version $Id: RewriterController.java 516448 2007-03-09 16:25:47Z ate $
28 */
29 public interface RewriterController
30 {
31 public String SERVICE_NAME = "rewriter";
32
33 /***
34 * Creates a basic rewriter that does not support rulesets configurations.
35 * The Rewriter implementation is configured in the service configuration.
36 *
37 * @return A new rewriter that does not support rulesets.
38 * @throws InstantiationException
39 * @throws
40 * @throws IllegalAccessException
41 */
42 Rewriter createRewriter()
43 throws IllegalAccessException, InstantiationException;
44
45 /***
46 * Creates a rewriter that supports rulesets configurations.
47 * The rewriter uses the rulesets configuration to control rewriting.
48 * The Rewriter implementation is configured in the service configuration.
49 *
50 * @param ruleset The ruleset configuration to control the rewriter.
51 * @return A new rewriter that supports rulesets.
52 */
53 RulesetRewriter createRewriter(Ruleset ruleset)
54 throws RewriterException;
55
56
57 /***
58 * Creates a Parser Adaptor for the given mime type
59 * The Parser Adaptor implementation is configured in the service configuration.
60 * Only MimeTypes of "text/html" and "text/xml" are currently supported.
61 *
62 * @param mimeType The mimetype to create a parser adaptor for.
63 * @return A new parser adaptor
64 */
65 ParserAdaptor createParserAdaptor(String mimeType)
66 throws RewriterException;
67
68 /***
69 * Loads a XML-based Rewriter Ruleset given a stream to the XML configuration.
70 *
71 * @param reader The stream to the XML configuration.
72 * @return A Ruleset configuration tree.
73 */
74 Ruleset loadRuleset(Reader reader);
75
76 /***
77 * Lookup a Ruleset given a ruleset identifier.
78 *
79 * @param id The identifier for the Ruleset.
80 * @return A Ruleset configuration tree.
81 */
82 Ruleset lookupRuleset(String id);
83
84 }