You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by th...@apache.org on 2008/06/06 13:40:37 UTC
svn commit: r663903 - in
/labs/droids/trunk/src/core/java/org/apache/droids/handle: Save.java
Solr.java Sysout.java WriterHandler.java
Author: thorsten
Date: Fri Jun 6 04:40:37 2008
New Revision: 663903
URL: http://svn.apache.org/viewvc?rev=663903&view=rev
Log:
white noise - formating changes
Modified:
labs/droids/trunk/src/core/java/org/apache/droids/handle/Save.java
labs/droids/trunk/src/core/java/org/apache/droids/handle/Solr.java
labs/droids/trunk/src/core/java/org/apache/droids/handle/Sysout.java
labs/droids/trunk/src/core/java/org/apache/droids/handle/WriterHandler.java
Modified: labs/droids/trunk/src/core/java/org/apache/droids/handle/Save.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/handle/Save.java?rev=663903&r1=663902&r2=663903&view=diff
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/handle/Save.java (original)
+++ labs/droids/trunk/src/core/java/org/apache/droids/handle/Save.java Fri Jun 6 04:40:37 2008
@@ -32,24 +32,30 @@
/**
* Handler which is writing the stream to the file system.
* <p>
- * Before using make sure you have set the export directory {@link setOutputDir(String outputDir)}
- * and whether you want to use the host as prefix {@link setIncludeHost(boolean includeHost)}.
+ * Before using make sure you have set the export directory
+ * {@link setOutputDir(String outputDir)} and whether you want to use the host
+ * as prefix {@link setIncludeHost(boolean includeHost)}.
+ *
* @author thorsten
* @version 1.0
- *
+ *
*/
public class Save extends WriterHandler implements Handler {
- private String outputDir=null;
+ private String outputDir = null;
- private URL url=null;
-
- private boolean includeHost=false;
+ private URL url = null;
- /* (non-Javadoc)
- * @see org.apache.droids.api.Handler#handle(java.io.InputStream, java.net.URL, org.apache.droids.api.Parse)
+ private boolean includeHost = false;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.droids.api.Handler#handle(java.io.InputStream,
+ * java.net.URL, org.apache.droids.api.Parse)
*/
- public void handle(InputStream stream, URL urlToHandle, Parse parse) throws Exception {
+ public void handle(InputStream stream, URL urlToHandle, Parse parse)
+ throws Exception {
this.url = urlToHandle;
writeOutput(stream);
}
@@ -58,9 +64,9 @@
if (!url.getFile().endsWith("/")) {
Reader reader = new InputStreamReader(stream);
String file = outputDir;
- if(includeHost){
+ if (includeHost) {
file += url.getHost() + url.getFile();
- }else{
+ } else {
file += url.getFile().substring(1);
}
log.info("Trying to save " + url + " to " + file);
@@ -87,6 +93,7 @@
/**
* Get the directory where we want to save the stream.
+ *
* @return directory where we want to save the stream.
*/
public String getOutputDir() {
@@ -95,15 +102,17 @@
/**
* Set the directory where we want to save the stream.
- * @param outputDir the directory where we want to save the stream.
+ *
+ * @param outputDir
+ * the directory where we want to save the stream.
*/
public void setOutputDir(String outputDir) {
this.outputDir = outputDir;
}
/**
- * Do we want to prefix the export dir with the
- * host name.
+ * Do we want to prefix the export dir with the host name.
+ *
* @return true if we want to use the prefix; false otherwise
*/
public boolean isIncludeHost() {
@@ -111,9 +120,10 @@
}
/**
- * Do we want to prefix the export dir with the
- * host name.
- * @param includeHost true if we want to use the prefix; false otherwise
+ * Do we want to prefix the export dir with the host name.
+ *
+ * @param includeHost
+ * true if we want to use the prefix; false otherwise
*/
public void setIncludeHost(boolean includeHost) {
this.includeHost = includeHost;
Modified: labs/droids/trunk/src/core/java/org/apache/droids/handle/Solr.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/handle/Solr.java?rev=663903&r1=663902&r2=663903&view=diff
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/handle/Solr.java (original)
+++ labs/droids/trunk/src/core/java/org/apache/droids/handle/Solr.java Fri Jun 6 04:40:37 2008
@@ -32,38 +32,47 @@
import org.apache.http.PostFile;
/**
- * Handler specialized for the communication with Apache Solr.
- * Offers methods to generate the different commands for solr
- * as e.g. {@link createUpdateDocument(URL url, Parse parse)}}
+ * Handler specialized for the communication with Apache Solr. Offers methods to
+ * generate the different commands for solr as e.g.
+ * {@link createUpdateDocument(URL url, Parse parse)}}
* <p>
- * Make sure you have set the update url of your local solr server
- * instance you want to use as destination.
+ * Make sure you have set the update url of your local solr server instance you
+ * want to use as destination.
+ *
* @author thorsten
* @version 1.0
- *
+ *
*/
public class Solr implements Handler {
-
- private String updateUrl=null;
- private XMLStreamWriter writer=null;
+ private String updateUrl = null;
- /* (non-Javadoc)
- * @see org.apache.droids.api.Handler#handle(java.io.InputStream, java.net.URL, org.apache.droids.api.Parse)
+ private XMLStreamWriter writer = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.droids.api.Handler#handle(java.io.InputStream,
+ * java.net.URL, org.apache.droids.api.Parse)
*/
public void handle(InputStream openStream, URL url, Parse parse)
throws Exception {
ByteArrayOutputStream out = createUpdateDocument(url, parse);
- BufferedInputStream stream = new BufferedInputStream(new ByteArrayInputStream(out.toByteArray()));
- new PostFile(updateUrl,stream);
+ BufferedInputStream stream = new BufferedInputStream(
+ new ByteArrayInputStream(out.toByteArray()));
+ new PostFile(updateUrl, stream);
}
/**
- * Creates an add command (and returns it as OutputStream) out of the parse result.
- * The content field will be filled with the {@link Parse.getText()}}
- * @param url the identifier for the document in Apache Solr
- * @param parse the object that contains the textual representation of the document
- * @return stream of the add command
+ * Creates an add command (and returns it as OutputStream) out of the parse
+ * result. The content field will be filled with the {@link Parse.getText()}}
+ *
+ * @param url
+ * the identifier for the document in Apache Solr
+ * @param parse
+ * the object that contains the textual representation of the
+ * document
+ * @return stream of the add command
* @throws XMLStreamException
*/
public ByteArrayOutputStream createUpdateDocument(URL url, Parse parse)
@@ -92,6 +101,7 @@
/**
* Creates a commit command.
+ *
* @return commit command as stream
* @throws XMLStreamException
*/
@@ -110,6 +120,7 @@
/**
* Creates a optimize command.
+ *
* @return optimize command as stream
* @throws XMLStreamException
*/
@@ -129,6 +140,7 @@
/**
* Get the update url of the Apache Solr server in use
+ *
* @return the update url of the Apache Solr server in use
*/
public String getUpdateUrl() {
@@ -137,7 +149,9 @@
/**
* Set the update url of the Apache Solr server in use
- * @param updateUrl the update url of the Apache Solr server in use
+ *
+ * @param updateUrl
+ * the update url of the Apache Solr server in use
*/
public void setUpdateUrl(String updateUrl) {
this.updateUrl = updateUrl;
Modified: labs/droids/trunk/src/core/java/org/apache/droids/handle/Sysout.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/handle/Sysout.java?rev=663903&r1=663902&r2=663903&view=diff
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/handle/Sysout.java (original)
+++ labs/droids/trunk/src/core/java/org/apache/droids/handle/Sysout.java Fri Jun 6 04:40:37 2008
@@ -28,11 +28,12 @@
import org.apache.droids.api.Parse;
/**
- * Handler that write the stream to the sysout.
- * Mostly added for debugging reasons.
+ * Handler that write the stream to the sysout. Mostly added for debugging
+ * reasons.
+ *
* @author thorsten
* @version 1.0
- *
+ *
*/
public class Sysout extends WriterHandler implements Handler {
@@ -42,8 +43,11 @@
pipe(reader, output);
}
- /* (non-Javadoc)
- * @see org.apache.droids.api.Handler#handle(java.io.InputStream, java.net.URL, org.apache.droids.api.Parse)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.droids.api.Handler#handle(java.io.InputStream,
+ * java.net.URL, org.apache.droids.api.Parse)
*/
public void handle(InputStream stream, URL url, Parse parse) throws Exception {
writeOutput(stream);
Modified: labs/droids/trunk/src/core/java/org/apache/droids/handle/WriterHandler.java
URL: http://svn.apache.org/viewvc/labs/droids/trunk/src/core/java/org/apache/droids/handle/WriterHandler.java?rev=663903&r1=663902&r2=663903&view=diff
==============================================================================
--- labs/droids/trunk/src/core/java/org/apache/droids/handle/WriterHandler.java (original)
+++ labs/droids/trunk/src/core/java/org/apache/droids/handle/WriterHandler.java Fri Jun 6 04:40:37 2008
@@ -24,11 +24,12 @@
import org.apache.commons.logging.LogFactory;
/**
- * Wrapper that allows you to pipe a stream
- * from a reader to a writer via a buffer
+ * Wrapper that allows you to pipe a stream from a reader to a writer via a
+ * buffer
+ *
* @author thorsten
* @version 1.0
- *
+ *
*/
public class WriterHandler {
@@ -38,8 +39,11 @@
/**
* Pipes everything from the reader to the writer via a buffer
- * @param reader the underlying read to read from
- * @param writer the destination writer
+ *
+ * @param reader
+ * the underlying read to read from
+ * @param writer
+ * the destination writer
* @throws IOException
*/
protected static void pipe(Reader reader, Writer writer) throws IOException {
@@ -51,5 +55,4 @@
writer.flush();
}
-
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org