01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
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: public String SERVICE_NAME = "rewriter";
31:
32: /**
33: * Creates a basic rewriter that does not support rulesets configurations.
34: * The Rewriter implementation is configured in the service configuration.
35: *
36: * @return A new rewriter that does not support rulesets.
37: * @throws InstantiationException
38: * @throws
39: * @throws IllegalAccessException
40: */
41: Rewriter createRewriter() throws IllegalAccessException,
42: InstantiationException;
43:
44: /**
45: * Creates a rewriter that supports rulesets configurations.
46: * The rewriter uses the rulesets configuration to control rewriting.
47: * The Rewriter implementation is configured in the service configuration.
48: *
49: * @param ruleset The ruleset configuration to control the rewriter.
50: * @return A new rewriter that supports rulesets.
51: */
52: RulesetRewriter createRewriter(Ruleset ruleset)
53: throws RewriterException;
54:
55: /**
56: * Creates a Parser Adaptor for the given mime type
57: * The Parser Adaptor implementation is configured in the service configuration.
58: * Only MimeTypes of "text/html" and "text/xml" are currently supported.
59: *
60: * @param mimeType The mimetype to create a parser adaptor for.
61: * @return A new parser adaptor
62: */
63: ParserAdaptor createParserAdaptor(String mimeType)
64: throws RewriterException;
65:
66: /**
67: * Loads a XML-based Rewriter Ruleset given a stream to the XML configuration.
68: *
69: * @param reader The stream to the XML configuration.
70: * @return A Ruleset configuration tree.
71: */
72: Ruleset loadRuleset(Reader reader);
73:
74: /**
75: * Lookup a Ruleset given a ruleset identifier.
76: *
77: * @param id The identifier for the Ruleset.
78: * @return A Ruleset configuration tree.
79: */
80: Ruleset lookupRuleset(String id);
81:
82: }
|