You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by th...@apache.org on 2007/12/05 12:36:47 UTC

svn commit: r601301 - in /cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src: changes/changes.xml main/java/org/apache/cocoon/transformation/pagination/Paginator.java

Author: thorsten
Date: Wed Dec  5 03:36:45 2007
New Revision: 601301

URL: http://svn.apache.org/viewvc?rev=601301&view=rev
Log:
Fixing paginator to make it useable with spring

Modified:
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/changes/changes.xml
    cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/pagination/Paginator.java

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/changes/changes.xml?rev=601301&r1=601300&r2=601301&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/changes/changes.xml (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/changes/changes.xml Wed Dec  5 03:36:45 2007
@@ -24,6 +24,12 @@
     +-->
 <document>
   <body>
+    <release version="1.0.0-RC3-SNAPSHOT" date="TBA" description="Unreleased">
+      <action dev="thorsten" type="fix">
+        The paginator when used with spring has thrown errors since the service()
+        method never got called. Adding workaround to use the paginator with spring.
+      </action>
+    </release>
     <release version="1.0.0-RC1-SNAPSHOT" date="TBA" description="Unreleased">
       <action dev="vgritsenko" type="add">
         Implement support of XMLizable exceptions in the ExceptionGenerator

Modified: cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/pagination/Paginator.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/pagination/Paginator.java?rev=601301&r1=601300&r2=601301&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/pagination/Paginator.java (original)
+++ cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/pagination/Paginator.java Wed Dec  5 03:36:45 2007
@@ -111,6 +111,18 @@
                       Parameters par)
                         throws ProcessingException, SAXException,
                                IOException {
+      
+      // FIXME: service is not called when in spring
+      // making parser null. 
+      if(null==this.parser){
+        getLogger().debug("Looking up "+SAXParser.ROLE);
+        try {
+          this.parser = (SAXParser) manager.lookup(SAXParser.ROLE);
+        } catch (ServiceException e) {
+            throw new ProcessingException("Could not lookup '" +
+                SAXParser.ROLE + "'");
+        }
+      }
 
         if (src == null) {
             throw new ProcessingException("I need the paginate instructions (pagesheet) to continue. Set the 'src' attribute.");



Re: svn commit: r601301 - in /cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src: changes/changes.xml main/java/org/apache/cocoon/transformation/pagination/Paginator.java

Posted by Vadim Gritsenko <va...@reverycodes.com>.
thorsten@apache.org wrote:
> Author: thorsten
> Date: Wed Dec  5 03:36:45 2007
> New Revision: 601301
> 
> URL: http://svn.apache.org/viewvc?rev=601301&view=rev
> Log:
> Fixing paginator to make it useable with spring

I don't think this is the right approach. And IMHO this incorrect approach 
nudges you towards ugly hacks like this.

IIUC, the correct spring way would be to inject parser and any other required 
components directly, without injecting and using ServiceManager. I think I 
already saw this in one of the other springified components.

PS Do you know how recycle() is going to be called for the springified component?

Vadim