You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2007/01/08 03:22:24 UTC
svn commit: r493909 [2/2] - in /forrest/trunk/whiteboard/plugins: ./
org.apache.forrest.plugin.output.solr/
org.apache.forrest.plugin.output.solr/conf/
org.apache.forrest.plugin.output.solr/lib/
org.apache.forrest.plugin.output.solr/resources/ org.apac...
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/index.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/index.xml?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/index.xml (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/index.xml Sun Jan 7 18:22:22 2007
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+ <header>
+ <title>Welcome to the org.apache.forrest.plugin.output.solr Plugin</title>
+ </header>
+ <body>
+ <section id="overview">
+ <title>Apache Forrest - org.apache.forrest.plugin.output.solr Plugin</title>
+ <p>Generates
+ <a href="ext:solr">solr</a> documents from xdos. Further when run with the
+ dispatcher it provides a GUI to manage your project in solr and a search interface to
+ search your solr server. </p>
+ </section>
+
+ <section id="samples">
+ <title>Samples</title>
+ <p>This section includes links to a number of samples using this plugin. The plugin is
+ intended to be self documenting through these samples. If you require further help
+ please ask on the user mailing list.</p>
+
+ <ul>
+ <li>
+ <a href="index.solr">index.solr</a> - the xdocs-to-solrDoc.xsl
+ transforms xdocs to solr docs.</li>
+ <li>
+ <a href="index.solr.add">index.solr.add</a> - surround the solr docs with an
+ add statement.</li>
+ <li>
+ <a href="index.solr.add">index.solr.del</a> - surround the solr docs with a
+ delete statement.</li>
+ <li>
+ <a href="solr.commit">solr.commit</a> - commit statement for solr.
+ </li>
+ <li>
+ <a href="solr.optimize">solr.optimize</a> - optimize statement for solr.
+ </li>
+ <li>
+ <a href="index-creation.solr.add">index-creation.solr.add</a> - is
+ generating and adding an "add" statement for solr with the whole site as solr docs as
+ input. This will index your whole project if you add ".do.html" to the url.</li>
+ </ul>
+ <p>Aboves pages suffixed with
+ <code>.do.html</code> will trigger the underlying statment on the solr server. We
+ do not link them in this document since the links would be broken on the official
+ document server. This is as well the reason why the gui is deactivated. You can
+ activate it by using following snippet.</p>
+ <source><![CDATA[ <forrest:contract name="branding-css-links">
+ <forrest:property name="branding-css-links-input">
+ <css url="solr.css" media="screen" theme="Pelt"/>
+ </forrest:property>
+ </forrest:contract>
+ <forrest:hook name="solr">
+ <forrest:hook class="solrSearch">
+ <forrest:contract name="solr-search">
+ <forrest:property name="contextPath">#{$contextPath}</forrest:property>
+ <forrest:property name="hidden">
+ <input name="hl" type="hidden" value="true"/>
+ <input name="hl.fl" type="hidden" value="content"/>
+ <input name="fl" type="hidden" value="id,title"/>
+ <input name="indent" type="hidden" value="on"/>
+ <input name="rows" type="hidden" value="10"/>
+ <input name="start" type="hidden" value="0"/>
+ </forrest:property>
+ </forrest:contract>
+ </forrest:hook>
+ <forrest:hook class="solrActionbar">
+ <forrest:contract name="solr-actionbar">
+ <forrest:property name="request">#{$getRequest}</forrest:property>
+ <forrest:property name="contextPath">#{$contextPath}</forrest:property>
+ </forrest:contract>
+ </forrest:hook>
+ </forrest:hook>]]> </source>
+ <p>The host server urls can be configured by adding the following properties to your
+ project forrest.properties.xml in case you do not use the default values.</p>
+ <source><![CDATA[<property name="solr.select.url" value="http://localhost:8983/solr/select"/>
+<property name="solr.update.url" value="http://localhost:8983/solr/update"/>]]></source>
+ <p>In your solr server add the following field definitions to the schema.xml. We assume
+ "id" is already set as "uniqueKey" and you changed the "defaultSearchField" to
+ "content" otherwise you need to prefix your queries.</p>
+ <source><![CDATA[<field name="content" type="text" indexed="true" stored="true" />
+<field name="title" type="text" indexed="true" stored="true"/>
+<field name="subtitle" type="text" indexed="true" stored="true"/>
+<field name="abstract" type="text" indexed="true" stored="true"/>
+<field name="version" type="text" indexed="true" stored="true"/>
+<field name="author" type="text" indexed="true" stored="true" multiValued="true"/>]]> </source>
+ </section>
+ </body>
+</document>
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/index.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/screenshots.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/screenshots.xml?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/screenshots.xml (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/screenshots.xml Sun Jan 7 18:22:22 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+ <header>
+ <title>solr screenshots</title>
+ </header>
+ <body>
+ <section id="gui-actionbar">
+ <title>solr dispatcher gui - solr-actionbar contract</title>
+ <p><img src="/images/gui-actionbar.png" alt="gui"/> </p>
+ </section>
+ <section id="gui-search">
+ <title>solr dispatcher gui - solr-search contract</title>
+ <p><img src="/images/gui-search.png" alt="gui"/> </p>
+ </section>
+ <section id="search">
+ <title>solr search results</title>
+ <p><img src="/images/result.png" alt="gui"/> </p>
+ </section>
+ </body>
+</document>
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/screenshots.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/site.xml?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/site.xml (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/site.xml Sun Jan 7 18:22:22 2007
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+Forrest site.xml
+
+This file contains an outline of the site's information content. It is used to:
+- Generate the website menus (though these can be overridden - see docs)
+- Provide semantic, location-independent aliases for internal 'site:' URIs, eg
+<link href="site:changes"> links to changes.html (or ../changes.html if in
+ subdir).
+- Provide aliases for external URLs in the external-refs section. Eg, <link
+ href="ext:cocoon"> links to http://cocoon.apache.org/
+
+See http://forrest.apache.org/docs/linking.html for more info
+-->
+
+<site label="org.apache.forrest.plugin.output.solr" href="" xmlns="http://apache.org/forrest/linkmap/1.0" tab="">
+
+ <about label="About">
+ <index label="Index" href="index.html" description="Welcome to org.apache.forrest.plugin.output.solr"/>
+ <screenshots label="Screenshots" href="screenshots.html" description="screenshots of org.apache.forrest.plugin.output.solr"/>
+ <forrestPlugins label="Plugins Index" href="ext:forrest/plugins" description="Index of Forrest Plugins"/>
+ <changes label="Changes" href="changes.html" description="History of Changes" />
+ <todo label="Todo" href="todo.html" description="Todo List" />
+ </about>
+
+ <!--
+ The href must be wholesite.html/pdf You can change the labels and node names
+ <all label="All">
+ <whole_site_html label="Whole Site HTML" href="wholesite.html"/>
+ <whole_site_pdf label="Whole Site PDF" href="wholesite.pdf"/>
+ </all>
+ -->
+
+ <external-refs>
+ <forrest href="http://forrest.apache.org/">
+ <linking href="docs/linking.html"/>
+ <validation href="docs/validation.html"/>
+ <webapp href="docs/your-project.html#webapp"/>
+ <dtd-docs href="docs/dtd-docs.html"/>
+ <plugins href="docs/plugins"/>
+ </forrest>
+ <solr href="http://incubator.apache.org/solr/">
+ <solr-tutorial href="tutorial.html"/>
+ </solr>
+ </external-refs>
+
+</site>
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/tabs.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/tabs.xml?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/tabs.xml (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/tabs.xml Sun Jan 7 18:22:22 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE tabs PUBLIC "-//APACHE//DTD Cocoon Documentation Tab V1.1//EN" "http://forrest.apache.org/dtd/tab-cocoon-v11.dtd">
+
+<tabs software="MyProj"
+ title="MyProj"
+ copyright="Foo"
+ xmlns:xlink="http://www.w3.org/1999/xlink">
+
+ <!-- The rules for tabs are:
+ @dir will always have '/@indexfile' added.
+ @indexfile gets appended to @dir if the tab is selected. Defaults to 'index.html'
+ @href is not modified unless it is root-relative and obviously specifies a
+ directory (ends in '/'), in which case /index.html will be added
+ If @id's are present, site.xml entries with a matching @tab will be in that tab.
+
+ Tabs can be embedded to a depth of two. The second level of tabs will only
+ be displayed when their parent tab is selected.
+ -->
+
+ <tab id="plugins" label="Forrest Plugins" href="http://forrest.apache.org/pluginDocs" indexfile="index.html"/>
+ <tab id="" label="Plugin Home" dir="" indexfile="index.html"/>
+ <!-- Add new tabs here, eg:
+ <tab label="How-Tos" dir="community/howto/"/>
+ <tab label="XML Site" dir="xml-site/"/>
+ -->
+
+</tabs>
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/content/xdocs/tabs.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui-actionbar.png
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui-actionbar.png?view=auto&rev=493909
==============================================================================
Binary file - no diff available.
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui-actionbar.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui-search.png
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui-search.png?view=auto&rev=493909
==============================================================================
Binary file - no diff available.
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui-search.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui.png
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui.png?view=auto&rev=493909
==============================================================================
Binary file - no diff available.
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/gui.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/result.png
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/result.png?view=auto&rev=493909
==============================================================================
Binary file - no diff available.
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/images/result.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/structurer/url/pelt.fv
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/structurer/url/pelt.fv?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/structurer/url/pelt.fv (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/structurer/url/pelt.fv Sun Jan 7 18:22:22 2007
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<forrest:views xmlns:forrest="http://apache.org/forrest/templates/1.0"
+ xmlns:jx="http://apache.org/cocoon/templates/jx/1.0">
+
+ <!-- The following variables are used to contact data models and/or contracts. -->
+ <jx:set var="getRequest" value="#{$cocoon/parameters/getRequest}"/>
+ <jx:set var="getRequestExtension"
+ value="#{$cocoon/parameters/getRequestExtension}"/>
+ <jx:set var="contextPath" value="#{$cocoon/parameters/contextPath}"/>
+ <!-- CSS View of the request e.g. index.dispatcher.css -->
+ <forrest:view type="css" hooksXpath="/">
+ <jx:import uri="cocoon://prepare.tiles.pelt-css"/>
+ </forrest:view>
+ <!-- HTML View of the request (e.g. index.html)-->
+ <forrest:view type="html" hooksXpath="/html/body">
+ <forrest:contract name="branding-css-links">
+ <forrest:property name="branding-css-links-input">
+ <css url="solr.css" media="screen" theme="Pelt"/>
+ </forrest:property>
+ </forrest:contract>
+ <!--<forrest:hook name="solr">
+ <forrest:hook class="solrSearch">
+ <forrest:contract name="solr-search">
+ <forrest:property name="contextPath">#{$contextPath}</forrest:property>
+ <forrest:property name="hidden">
+ <input name="hl" type="hidden" value="true"/>
+ <input name="hl.fl" type="hidden" value="content"/>
+ <input name="fl" type="hidden" value="id,title"/>
+ <input name="indent" type="hidden" value="on"/>
+ <input name="rows" type="hidden" value="10"/>
+ <input name="start" type="hidden" value="0"/>
+ </forrest:property>
+ </forrest:contract>
+ </forrest:hook>
+ <forrest:hook class="solrActionbar">
+ <forrest:contract name="solr-actionbar">
+ <forrest:property name="request">#{$getRequest}</forrest:property>
+ <forrest:property name="contextPath">#{$contextPath}</forrest:property>
+ </forrest:contract>
+ </forrest:hook>
+ </forrest:hook>-->
+ <jx:import uri="cocoon://prepare.tiles.pelt-html"/>
+ </forrest:view>
+</forrest:views>
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/resources/structurer/url/pelt.fv
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/skinconf.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/skinconf.xml?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/skinconf.xml (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/skinconf.xml Sun Jan 7 18:22:22 2007
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!DOCTYPE skinconfig PUBLIC "-//APACHE//DTD Skin Configuration V0.7-1//EN" "http://forrest.apache.org/dtd/skinconfig-v07-1.dtd"
+[
+ <!ENTITY skinconf-common PUBLIC "-//Apache Forrest//ENTITIES Skin Configuration common plugins V0.7-1//EN" "">
+]>
+
+<skinconfig>
+ &skinconf-common;
+
+ <project-name>Plugin: org.apache.forrest.plugin.output.solr</project-name>
+ <project-description>org.apache.forrest.plugin.output.solr plugin for Apache Forrest</project-description>
+
+</skinconfig>
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/documentation/skinconf.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/PostFile.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/PostFile.java?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/PostFile.java (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/PostFile.java Sun Jan 7 18:22:22 2007
@@ -0,0 +1,76 @@
+package org.apache.forrest.http.client;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+public class PostFile {
+ /**
+ * The AGENT name
+ */
+ public static final String AGENT = "forrest[" + PostFile.class.getName() + "]";
+
+ private String destinationUrl, srcUrl;
+
+ private HttpClient client;
+
+ private PostMethod filePost;
+
+ private int statusCode;
+
+ /**
+ * @param destinationUrl - the url of the server listener (e.g. servlet)
+ * @param srcUrl - the src url of the file to post
+ * @throws MalformedURLException
+ * @throws IOException
+ */
+ public PostFile(String destinationUrl, String srcUrl) throws MalformedURLException,
+ IOException {
+ this.destinationUrl = destinationUrl;
+ this.srcUrl = srcUrl;
+ client = new HttpClient();
+ filePost = prepareFilePost(destinationUrl, srcUrl);
+ statusCode = client.executeMethod(filePost);
+ }
+
+ public void post(String destinationUrl, String srcUrl) throws MalformedURLException, IOException{
+ this.destinationUrl = destinationUrl;
+ this.srcUrl = srcUrl;
+ client = new HttpClient();
+ filePost = prepareFilePost(destinationUrl, srcUrl);
+ statusCode = client.executeMethod(filePost);
+ }
+ public int statusCode(){
+ return statusCode;
+ }
+ public String getResponseCharSet(){
+ return filePost.getResponseCharSet();
+ }
+ public String getResponseBodyAsString(){
+ return filePost.getResponseBodyAsString();
+ }
+ public InputStream getResponseBodyAsStream()
+ throws MalformedURLException, IOException {
+ return filePost.getResponseBodyAsStream();
+ }
+
+ private PostMethod prepareFilePost(String solrBase, String src)
+ throws IOException, MalformedURLException {
+ PostMethod filePost = new PostMethod(solrBase);
+ filePost.addRequestHeader("Content-type", "text/xml; charset=utf-8");
+ filePost.addRequestHeader("User-Agent", AGENT);
+ filePost.setRequestBody(new URL(src).openStream());
+ return filePost;
+ }
+ public String getsolrBase() {
+ return destinationUrl;
+ }
+ public String getSrc() {
+ return srcUrl;
+ }
+
+}
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/PostFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/TestPostFile.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/TestPostFile.java?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/TestPostFile.java (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/TestPostFile.java Sun Jan 7 18:22:22 2007
@@ -0,0 +1,14 @@
+package org.apache.forrest.http.client;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+public class TestPostFile {
+ public TestPostFile(String destinationUrl, String srcUrl) throws MalformedURLException, IOException{
+ PostFile post = new PostFile(destinationUrl, srcUrl);
+ System.out.println("body: "+post.getResponseBodyAsString());
+ }
+ public static void main (String[] args) throws MalformedURLException, IOException{
+ TestPostFile test = new TestPostFile(args[0],args[1]);
+ }
+}
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/http/client/TestPostFile.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: 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=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrQueryTransformer.java (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrQueryTransformer.java Sun Jan 7 18:22:22 2007
@@ -0,0 +1,88 @@
+package org.apache.forrest.solr.client;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.transformation.AbstractSAXTransformer;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+public class SolrQueryTransformer extends AbstractSAXTransformer {
+
+ private AttributesImpl attributes;
+ private int rows=10,found = 0,start = 0;
+ private String queryString;
+
+ public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par) throws ProcessingException, SAXException, IOException {
+ super.setup(resolver, objectModel, src, par);
+ this.attributes = new AttributesImpl();
+ String userRows =request.getParameter("rows");
+ if (null!=userRows)
+ 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();
+ if(!"start".equals(element)){
+ String value = (String) map.get(element);
+ set.add(element+"="+value);
+ }
+ }
+ StringBuffer buffer = new StringBuffer();
+ for (Iterator iter = set.iterator(); iter.hasNext();) {
+ String element = (String) iter.next();
+ buffer.append(element);
+ buffer.append("&");
+ }
+ queryString = buffer.toString();
+ }
+
+ public void startElement(String uri, String name, String raw, Attributes attr) throws SAXException {
+ super.startElement(uri, name, raw, attr);
+ if("result".equals(name)){
+ for (int i = 0; i < attr.getLength(); i++) {
+ String attribute = attr.getLocalName(i);
+ if ("numFound".equals(attribute)){
+ found = Integer.parseInt(attr.getValue(i));
+ }else if ("start".equals(attribute)){
+ start= Integer.parseInt(attr.getValue(i));
+ }
+ }
+ int pages = (int) Math.ceil((float)found / (float)rows);
+ attributes.clear();
+ attributes.addAttribute("", "found", "found",
+ "CDATA", String.valueOf(found));
+ attributes.addAttribute("", "start", "start",
+ "CDATA", String.valueOf(start));
+ attributes.addAttribute("", "rows", "rows",
+ "CDATA", String.valueOf(rows));
+ attributes.addAttribute("", "pages", "pages",
+ "CDATA", String.valueOf(pages));
+ contentHandler.startElement("", "paginator", "paginator", attributes);
+ for (int i = 0; i < pages; i++) {
+ attributes.clear();
+ attributes.addAttribute("", "id", "id",
+ "CDATA", String.valueOf(i+1));
+ attributes.addAttribute("", "queryString", "queryString",
+ "CDATA", queryString+"start="+(i*rows));
+ if ((rows*i<=start&start<rows*(i+1)))
+ attributes.addAttribute("", "current", "current",
+ "CDATA", "true");
+ contentHandler.startElement("", "page", "page", attributes);
+ contentHandler.endElement("", "page", "page");
+ }
+ contentHandler.endElement("", "paginator", "paginator");
+ }
+ }
+
+}
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrQueryTransformer.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrUpdateGenerator.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrUpdateGenerator.java?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrUpdateGenerator.java (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrUpdateGenerator.java Sun Jan 7 18:22:22 2007
@@ -0,0 +1,58 @@
+package org.apache.forrest.solr.client;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.environment.Context;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.cocoon.generation.ServiceableGenerator;
+import org.apache.excalibur.xml.sax.SAXParser;
+import org.apache.forrest.http.client.PostFile;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class SolrUpdateGenerator extends ServiceableGenerator {
+ private static final String SRC_ID = "srcId";
+
+ private static final String SRC_URL_BASE = "srcUrlBase";
+
+ private static final String SERVER = "http://localhost:8888/";
+
+ private static final String DESTINATION_URL = "destinationUrl";
+
+ private static final String SOLR_UPDATE_URL = "http://localhost:8983/solr/update";
+
+ private PostFile post;
+
+ private SAXParser parser;
+
+ public void setup(SourceResolver resolver, Map objectModel, String src,
+ Parameters par) throws ProcessingException, SAXException, IOException {
+ super.setup(resolver, objectModel, src, par);
+ try {
+ init(par);
+ } catch (ServiceException e) {
+ throw new ProcessingException (e);
+ }
+ }
+
+ private void init(Parameters par) throws MalformedURLException, IOException,
+ SAXException, ServiceException {
+ String destination = par.getParameter(DESTINATION_URL, SOLR_UPDATE_URL);
+ String base = par.getParameter(SRC_URL_BASE, SERVER);
+ String srcId = par.getParameter(SRC_ID, null);
+ String srcUrl = base + srcId;
+ post = new PostFile(destination, srcUrl);
+ // Set up to read the input file
+ parser = (SAXParser) manager.lookup(SAXParser.ROLE);
+ }
+
+ public void generate() throws IOException, SAXException, ProcessingException {
+ parser.parse(new InputSource(post.getResponseBodyAsStream()),contentHandler);
+ }
+
+}
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/org/apache/forrest/solr/client/SolrUpdateGenerator.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/readme.txt
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/readme.txt?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/readme.txt (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/readme.txt Sun Jan 7 18:22:22 2007
@@ -0,0 +1 @@
+Place any java source code that your plugin requires in this directory.
\ No newline at end of file
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/src/java/readme.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/status.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/status.xml?view=auto&rev=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/status.xml (added)
+++ forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/status.xml Sun Jan 7 18:22:22 2007
@@ -0,0 +1,61 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<status>
+
+ <developers>
+ <!-- Add new developers here -->
+ <person name="Volunteer needed" email="dev@forrest.apache.org" id="open"/>
+ </developers>
+
+ <!-- Define here the Title of the Context you want to display in the Changes pages.
+ id = the context value of actions
+ title = Title of the Context
+ -->
+ <contexts>
+ <!-- Add new contexts here -->
+ <context id="code" title="Changes to the Code Base"/>
+ <context id="docs" title="Changes to Documentation"/>
+ <context id="admin" title="Changes to Project Administration"/>
+ <context id="design" title="Changes to Design"/>
+ <context id="build" title="Changes to Build"/>
+ </contexts>
+
+ <changes>
+ <!-- Add new releases here -->
+ <release version="0.1" date="not-released">
+ <action dev="RDG" type="add" context="admin">
+ Initial plugin code.
+ </action>
+ </release>
+ </changes>
+
+ <todo>
+ <actions priority="high">
+ <action context="docs" dev="open">
+ Customize this template plugin with your plugin's details. This
+ TODO list is generated from 'status.xml'.
+ </action>
+ <action context="docs" dev="open">
+ Create the documentation with lots of examples and samples.
+ XML content goes in
+ <code>src/documentation/content/xdocs</code>.
+ </action>
+ </actions>
+ </todo>
+
+</status>
Propchange: forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.output.solr/status.xml
------------------------------------------------------------------------------
svn:eol-style = native
Modified: forrest/trunk/whiteboard/plugins/whiteboard-plugins.xml
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/whiteboard-plugins.xml?view=diff&rev=493909&r1=493908&r2=493909
==============================================================================
--- forrest/trunk/whiteboard/plugins/whiteboard-plugins.xml (original)
+++ forrest/trunk/whiteboard/plugins/whiteboard-plugins.xml Sun Jan 7 18:22:22 2007
@@ -188,7 +188,17 @@
</description>
<forrestVersion>0.8</forrestVersion>
</plugin>
-
+ <plugin name="org.apache.forrest.plugin.output.solr"
+ type="output"
+ author="Apache Forrest Project"
+ website="http://forrest.apache.org/pluginDocs/plugins_0_80/org.apache.forrest.plugin.output.solr"
+ url="http://forrest.apache.org/plugins/"
+ version="0.1">
+ <description> Generates solr documents from xdos. Further when run with the dispatcher
+ it provides a GUI to manage your project in solr and a search interface to search your solr
+ server. </description>
+ <forrestVersion>0.8</forrestVersion>
+ </plugin>
<plugin name="org.apache.forrest.themes.core"
type="output"
author="Apache Forrest Project"