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 java.lang.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  java.lang.Class adaptorHtmlClass
          Adaptors
protected  java.lang.Class adaptorXmlClass
           
protected  java.lang.Class basicRewriterClass
          configured basic rewriter class
protected static org.apache.commons.logging.Log log
           
protected  org.exolab.castor.mapping.Mapping mapper
          the Castor mapping file name
protected  java.lang.String mappingFile
           
protected  java.lang.Class rulesetRewriterClass
          configured ruleset rewriter class
protected  java.util.Map rulesets
          Collection of rulesets in the system
 
Fields inherited from interface org.apache.jetspeed.rewriter.RewriterController
SERVICE_NAME
 
Constructor Summary
JetspeedRewriterController(java.lang.String mappingFile)
           
JetspeedRewriterController(java.lang.String mappingFile, java.util.List rewriterClasses, java.util.List adaptorClasses)
           
JetspeedRewriterController(java.lang.String mappingFile, java.lang.String basicRewriterClassName, java.lang.String rulesetRewriterClassName, java.lang.String adaptorHtmlClassName, java.lang.String adaptorXmlClassName)
           
 
Method Summary
 ParserAdaptor createParserAdaptor(java.lang.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  java.io.Reader getReader(java.lang.String resource)
           
protected  void loadMapping()
          Load the mapping file for ruleset configuration
 Ruleset loadRuleset(java.io.Reader reader)
          Loads a XML-based Rewriter Ruleset given a stream to the XML configuration.
 Ruleset lookupRuleset(java.lang.String id)
          Lookup a Ruleset given a ruleset identifier.
protected static java.util.List toClassList(java.lang.String classNameA, java.lang.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

mappingFile

protected java.lang.String mappingFile

mapper

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


rulesets

protected java.util.Map rulesets
Collection of rulesets in the system


basicRewriterClass

protected java.lang.Class basicRewriterClass
configured basic rewriter class


rulesetRewriterClass

protected java.lang.Class rulesetRewriterClass
configured ruleset rewriter class


adaptorHtmlClass

protected java.lang.Class adaptorHtmlClass
Adaptors


adaptorXmlClass

protected java.lang.Class adaptorXmlClass
Constructor Detail

JetspeedRewriterController

public JetspeedRewriterController(java.lang.String mappingFile)
                           throws RewriterException
Throws:
RewriterException

JetspeedRewriterController

public JetspeedRewriterController(java.lang.String mappingFile,
                                  java.util.List rewriterClasses,
                                  java.util.List adaptorClasses)
                           throws RewriterException
Throws:
RewriterException

JetspeedRewriterController

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

toClassList

protected static java.util.List toClassList(java.lang.String classNameA,
                                            java.lang.String classNameB)

createRewriter

public Rewriter createRewriter()
                        throws java.lang.InstantiationException,
                               java.lang.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:
java.lang.InstantiationException
java.lang.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(java.lang.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 java.io.Reader getReader(java.lang.String resource)
                            throws RewriterException
Throws:
RewriterException

lookupRuleset

public Ruleset lookupRuleset(java.lang.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(java.io.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-2009 Apache Software Foundation. All Rights Reserved.