Author: thorsten
Date: Tue Mar 27 14:17:04 2007
New Revision: 523081

URL: http://svn.apache.org/viewvc?view=rev&rev=523081
Log:
making code cocoon-2.1.x compatible, to use this plugin as well in 
cocoon-2.1.x. Feedback and proposed changes came from [EMAIL PROTECTED] on the 
solr user list. Thanks mirko.

Modified:
    
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrQueryTransformer.java
    
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrSearchGenerator.java

Modified: 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrQueryTransformer.java
URL: 
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrQueryTransformer.java?view=diff&rev=523081&r1=523080&r2=523081
==============================================================================
--- 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrQueryTransformer.java
 (original)
+++ 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrQueryTransformer.java
 Tue Mar 27 14:17:04 2007
@@ -17,6 +17,7 @@
 package org.apache.forrest.solr.client;
 
 import java.io.IOException;
+import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
@@ -43,14 +44,12 @@
             rows=Integer.parseInt(userRows);
         else
             rows=10;
-        Map map =
-            request.getParameters();
         LinkedHashSet set = new LinkedHashSet();
-        Iterator keys = map.keySet().iterator();
-        while (keys.hasNext()) {
-            String element = (String) keys.next();
+        Enumeration keys = request.getParameterNames();
+        while (keys.hasMoreElements()) {
+            String element = (String) keys.nextElement();
             if(!"start".equals(element)){
-                String value = (String) map.get(element);
+                String value = (String) request.getParameter(element);
                 set.add(element+"="+value);
             }
         }

Modified: 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrSearchGenerator.java
URL: 
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrSearchGenerator.java?view=diff&rev=523081&r1=523080&r2=523081
==============================================================================
--- 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrSearchGenerator.java
 (original)
+++ 
forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrSearchGenerator.java
 Tue Mar 27 14:17:04 2007
@@ -1,6 +1,8 @@
 package org.apache.forrest.solr.client;
 
 import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Map;
@@ -46,13 +48,19 @@
     public void setup(SourceResolver resolver, Map objectModel, String src,
             Parameters par) throws ProcessingException, SAXException, 
IOException {
         super.setup(resolver, objectModel, src, par);
+        map= new HashMap();
         this.request = ObjectModelHelper.getRequest(objectModel);
         destination = par.getParameter(DESTINATION_URL, SOLR_UPDATE_URL);
         query = request.getParameter(QUERY_PARAM);
         if (null== query){
             query = "DEFAULT_QUERY_STRING";
         }
-        map = request.getParameters();
+        // cocoon-2.1.x compatible
+        for (Enumeration iter = request.getParameterNames(); 
iter.hasMoreElements();) {
+            String name = (String) iter.nextElement();
+            System.out.println("xxx "+name);
+            map.put(name, request.getParameter(name));
+        }
     }
 
     public void generate() throws IOException, SAXException, 
ProcessingException {