cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject cvs commit: cocoon-2.1 gump.xml
Date Wed, 26 May 2004 11:23:47 GMT
unico       2004/05/26 04:23:47

  Modified:    src/blocks/linkrewriter/java/org/apache/cocoon/transformation
                        LinkRewriterTransformer.java
                        VariableRewriterTransformer.java
               .        gump.xml
  Log:
  - remove dependency of linkrewriter block on XSP
  - add namespace configuration option to LRT
  
  Revision  Changes    Path
  1.13      +17 -10    cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/LinkRewriterTransformer.java
  
  Index: LinkRewriterTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/LinkRewriterTransformer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LinkRewriterTransformer.java	22 Apr 2004 12:15:48 -0000	1.12
  +++ LinkRewriterTransformer.java	26 May 2004 11:23:47 -0000	1.13
  @@ -29,7 +29,7 @@
   import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.components.language.markup.xsp.XSPModuleHelper;
  +import org.apache.cocoon.components.modules.input.InputModuleHelper;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.transformation.helpers.VariableConfiguration;
   import org.apache.regexp.RE;
  @@ -171,6 +171,10 @@
    *   <dt>bad-link-str</dt>
    *   <dd>String to use for links with a correct InputModule prefix, but no value
    *   therein.  Defaults to the original URI.</dd>
  + *   
  + *   <dt>namespace-uri</dt>
  + *   <dd>The namespace uri of elements whose attributes are considered for 
  + *   transformation. Defaults to the empty namespace ("").</dd>
    * </dl>
    *
    * <p>
  @@ -211,13 +215,11 @@
    * both 'link-attrs' and 'link-attr' configuration.
    *
    * <p>
  - * <b>NOTE:</b> Currently, only links in the default ("") namespace are converted.
    *
    * @version CVS $Id$
    */
  -public class LinkRewriterTransformer
  -    extends AbstractSAXTransformer
  -    implements Initializable, Disposable {
  +public class LinkRewriterTransformer extends AbstractSAXTransformer
  +implements Initializable, Disposable {
   
       private final static String NAMESPACE = "";
   
  @@ -237,6 +239,7 @@
       private String origBadLinkStr;
       private String origInSchemes;
       private String origOutSchemes;
  +    private String origNamespaceURI;
   
       /**
        * A map where keys are those attributes which are considered 'links'.
  @@ -278,7 +281,7 @@
        */
       private Map linkAttrs;
   
  -    private XSPModuleHelper modHelper;
  +    private InputModuleHelper modHelper;
   
   
       /**
  @@ -293,6 +296,8 @@
           this.origInSchemes = conf.getChild("schemes").getValue("");
           this.origOutSchemes = conf.getChild("exclude-schemes").getValue("http https ftp
news mailto");
   
  +        this.origNamespaceURI = conf.getChild("namespace-uri").getValue(NAMESPACE);
  +
           /*
            * Setup origLinkAttrs map from the original Configuration:
            * 1. Parse link-attrs Configuration
  @@ -337,8 +342,7 @@
        * Initiate resources prior to this component becoming active.
        */
       public void initialize() throws Exception {
  -        this.namespaceURI = NAMESPACE;
  -        this.modHelper = new XSPModuleHelper();
  +        this.modHelper = new InputModuleHelper();
           this.modHelper.setup(this.manager);
       }
   
  @@ -355,9 +359,11 @@
           this.badLinkStr = parameters.getParameter("bad-link-str",       // per-request
config
                                                     this.origBadLinkStr); // else fall back
to per-instance config
   
  +        this.namespaceURI = parameters.getParameter("namespace-uri", this.origNamespaceURI);
  +        
           this.inSchemes = split(parameters.getParameter("schemes", this.origInSchemes),
" ");
           this.outSchemes = split(parameters.getParameter("exclude-schemes", this.origOutSchemes),
" ");
  -
  +        
           this.linkAttrs = this.origLinkAttrs;
           if (parameters.isParameter("link-attrs")) {
               try {
  @@ -372,6 +378,7 @@
               getLogger().debug("link-attrs = " + linkAttrs);
               getLogger().debug("schemes = " + inSchemes);
               getLogger().debug("exclude-schemes = " + outSchemes);
  +            getLogger().debug("namespace-uri = " + namespaceURI);
           }
   
           // Generate conf
  
  
  
  1.8       +4 -4      cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/VariableRewriterTransformer.java
  
  Index: VariableRewriterTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/linkrewriter/java/org/apache/cocoon/transformation/VariableRewriterTransformer.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- VariableRewriterTransformer.java	5 Mar 2004 13:01:59 -0000	1.7
  +++ VariableRewriterTransformer.java	26 May 2004 11:23:47 -0000	1.8
  @@ -28,7 +28,7 @@
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
  -import org.apache.cocoon.components.language.markup.xsp.XSPModuleHelper;
  +import org.apache.cocoon.components.modules.input.InputModuleHelper;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.transformation.helpers.VariableConfiguration;
   import org.xml.sax.Attributes;
  @@ -156,7 +156,7 @@
        * Recreated once per invocation. */
       private Configuration conf; 
   
  -    private XSPModuleHelper modHelper;
  +    private InputModuleHelper modHelper;
   
       private String badLinkStr;
   
  @@ -175,7 +175,7 @@
        */
       public void initialize() throws Exception {
           this.namespaceURI = NAMESPACE;
  -        this.modHelper = new XSPModuleHelper();
  +        this.modHelper = new InputModuleHelper();
           modHelper.setup(this.manager);
       }
   
  
  
  
  1.157     +1 -2      cocoon-2.1/gump.xml
  
  Index: gump.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/gump.xml,v
  retrieving revision 1.156
  retrieving revision 1.157
  diff -u -r1.156 -r1.157
  --- gump.xml	25 May 2004 14:07:15 -0000	1.156
  +++ gump.xml	26 May 2004 11:23:47 -0000	1.157
  @@ -561,7 +561,6 @@
       </ant>
   
       <depend project="cocoon" inherit="all"/>
  -    <depend project="cocoon-block-xsp"/>
   
       <work nested="tools/anttasks"/>
       <home nested="build/cocoon-@@DATE@@"/>
  
  
  

Mime
View raw message