org.apache.jetspeed.rewriter
Class JetspeedRewriterController

java.lang.Object
  extended by org.apache.jetspeed.rewriter.JetspeedRewriterController
All Implemented Interfaces:
RewriterController
Direct Known Subclasses:
JetspeedClasspathRewriterController

public class JetspeedRewriterController
extends Object
implements RewriterController

RewriterServiceImpl

Version:
$Id: JetspeedRewriterController.java,v 1.2 2004/03/08 00:44:40 jford Exp $
Author:
David Sean Taylor

Field Summary
protected  Class adaptorHtmlClass
          Adaptors
protected  Class adaptorXmlClass
           
protected  Class basicRewriterClass
          configured basic rewriter class
(package private) static String CONFIG_ADAPTOR_HTML
           
(package private) static String CONFIG_ADAPTOR_XML
           
(package private) static String CONFIG_BASIC_REWRITER
           
(package private) static String CONFIG_MAPPING_FILE
           
(package private) static String CONFIG_RULESET_REWRITER
           
protected static org.apache.commons.logging.Log log
           
protected  org.exolab.castor.mapping.Mapping mapper
          the Castor mapping file name
protected  String mappingFile
           
protected  Class rulesetRewriterClass
          configured ruleset rewriter class
protected  Map rulesets
          Collection of rulesets in the system
 
Fields inherited from interface org.apache.jetspeed.rewriter.RewriterController
SERVICE_NAME
 
Constructor Summary
JetspeedRewriterController(String mappingFile)
           
JetspeedRewriterController(String mappingFile, List rewriterClasses, List adaptorClasses)
           
JetspeedRewriterController(String mappingFile, String basicRewriterClassName, String rulesetRewriterClassName, String adaptorHtmlClassName, String adaptorXmlClassName)
           
 
Method Summary
 ParserAdaptor createParserAdaptor(String mimeType)
          Creates a Parser Adaptor for the given mime type The Parser Adaptor implementation is configured in the service configuration.
 Rewriter createRewriter()
          Creates a basic rewriter that does not support rulesets configurations.
 RulesetRewriter createRewriter(Ruleset ruleset)
          Creates a rewriter that supports rulesets configurations.
protected  Reader getReader(String resource)
           
protected  void loadMapping()
          Load the mapping file for ruleset configuration
 Ruleset loadRuleset(Reader reader)
          Loads a XML-based Rewriter Ruleset given a stream to the XML configuration.
 Ruleset lookupRuleset(String id)
          Lookup a Ruleset given a ruleset identifier.
protected static List toClassList(String classNameA, String classNameB)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.apache.commons.logging.Log log

CONFIG_MAPPING_FILE

static final String CONFIG_MAPPING_FILE
See Also:
Constant Field Values

CONFIG_BASIC_REWRITER

static final String CONFIG_BASIC_REWRITER
See Also:
Constant Field Values

CONFIG_RULESET_REWRITER

static final String CONFIG_RULESET_REWRITER
See Also:
Constant Field Values

CONFIG_ADAPTOR_HTML

static final String CONFIG_ADAPTOR_HTML
See Also:
Constant Field Values

CONFIG_ADAPTOR_XML

static final String CONFIG_ADAPTOR_XML
See Also:
Constant Field Values

mappingFile

protected String mappingFile

mapper

protected org.exolab.castor.mapping.Mapping mapper
the Castor mapping file name


rulesets

protected Map rulesets
Collection of rulesets in the system


basicRewriterClass

protected Class basicRewriterClass
configured basic rewriter class


rulesetRewriterClass

protected Class rulesetRewriterClass
configured ruleset rewriter class


adaptorHtmlClass

protected Class adaptorHtmlClass
Adaptors


adaptorXmlClass

protected Class adaptorXmlClass
Constructor Detail

JetspeedRewriterController

public JetspeedRewriterController(String mappingFile)
                           throws RewriterException
Throws:
RewriterException

JetspeedRewriterController

public JetspeedRewriterController(String mappingFile,
                                  List rewriterClasses,
                                  List adaptorClasses)
                           throws RewriterException
Throws:
RewriterException

JetspeedRewriterController

public JetspeedRewriterController(String mappingFile,
                                  String basicRewriterClassName,
                                  String rulesetRewriterClassName,
                                  String adaptorHtmlClassName,
                                  String adaptorXmlClassName)
                           throws RewriterException
Throws:
RewriterException
Method Detail

toClassList

protected static List toClassList(String classNameA,
                                  String classNameB)

createRewriter

public Rewriter createRewriter()
                        throws InstantiationException,
                               IllegalAccessException
Description copied from interface: RewriterController
Creates a basic rewriter that does not support rulesets configurations. The Rewriter implementation is configured in the service configuration.

Specified by:
createRewriter in interface RewriterController
Returns:
A new rewriter that does not support rulesets.
Throws:
InstantiationException
IllegalAccessException

createRewriter

public RulesetRewriter createRewriter(Ruleset ruleset)
                               throws RewriterException
Description copied from interface: RewriterController
Creates a rewriter that supports rulesets configurations. The rewriter uses the rulesets configuration to control rewriting. The Rewriter implementation is configured in the service configuration.

Specified by:
createRewriter in interface RewriterController
Parameters:
ruleset - The ruleset configuration to control the rewriter.
Returns:
A new rewriter that supports rulesets.
Throws:
RewriterException

createParserAdaptor

public ParserAdaptor createParserAdaptor(String mimeType)
                                  throws RewriterException
Description copied from interface: RewriterController
Creates a Parser Adaptor for the given mime type The Parser Adaptor implementation is configured in the service configuration. Only MimeTypes of "text/html" and "text/xml" are currently supported.

Specified by:
createParserAdaptor in interface RewriterController
Parameters:
mimeType - The mimetype to create a parser adaptor for.
Returns:
A new parser adaptor
Throws:
RewriterException

loadMapping

protected void loadMapping()
                    throws RewriterException
Load the mapping file for ruleset configuration

Throws:
RewriterException

getReader

protected Reader getReader(String resource)
                    throws RewriterException
Throws:
RewriterException

lookupRuleset

public Ruleset lookupRuleset(String id)
Description copied from interface: RewriterController
Lookup a Ruleset given a ruleset identifier.

Specified by:
lookupRuleset in interface RewriterController
Parameters:
id - The identifier for the Ruleset.
Returns:
A Ruleset configuration tree.

loadRuleset

public Ruleset loadRuleset(Reader reader)
Description copied from interface: RewriterController
Loads a XML-based Rewriter Ruleset given a stream to the XML configuration.

Specified by:
loadRuleset in interface RewriterController
Parameters:
reader - The stream to the XML configuration.
Returns:
A Ruleset configuration tree.


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.