View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    * 
9    *      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  {
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  }