Author: tobr
Date: Tue Feb 12 16:34:16 2013
New Revision: 1445246
URL: http://svn.apache.org/r1445246
Log:
updated walker module to support the new ParserData API
Modified:
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileFetcher.java
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileTask.java
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/SimpleWalkingDroid.java
Modified:
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileFetcher.java
URL:
http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileFetcher.java?rev=1445246&r1=1445245&r2=1445246&view=diff
==============================================================================
---
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileFetcher.java
(original)
+++
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileFetcher.java
Tue Feb 12 16:34:16 2013
@@ -23,9 +23,7 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.net.URI;
-import org.apache.droids.core.ContentEntity;
import org.apache.droids.core.Fetcher;
-import org.apache.droids.walker.FileTask;
/**
* Fetcher implementation for system-independent
@@ -45,7 +43,7 @@ public class FileFetcher implements Fetc
public void fetch(FileTask task) throws IOException {
File file = new File(extractLocation(task.getURI()));
task.getContentEntity().setContent(new
FileInputStream(task.getFile()));
- task.getContentEntity().put(ContentEntity.CONTENT_LENGTH,
file.length());
+ task.getContentEntity().setContentLength(file.length());
}
/**
Modified:
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileTask.java
URL:
http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileTask.java?rev=1445246&r1=1445245&r2=1445246&view=diff
==============================================================================
---
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileTask.java
(original)
+++
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/FileTask.java
Tue Feb 12 16:34:16 2013
@@ -21,22 +21,21 @@ import java.net.URI;
import java.util.Date;
import org.apache.droids.core.ContentEntity;
+import org.apache.droids.core.ParserData;
import org.apache.droids.core.Task;
public class FileTask implements Task {
private static final long serialVersionUID = 122177113684842951L;
private ContentEntity contentEntity;
+ private ParserData parserData;
private final Date started;
private final int depth;
private final File file;
private boolean aborted = false;
public FileTask(File file) {
- this.file = file;
- this.depth = 0;
- this.started = new Date();
- this.contentEntity = new ContentEntity();
+ this(file, 0);
}
public FileTask(File file, int depth) {
@@ -44,6 +43,7 @@ public class FileTask implements Task {
this.depth = depth;
this.started = new Date();
this.contentEntity = new ContentEntity();
+ this.parserData = new ParserData();
}
@Override
@@ -52,6 +52,11 @@ public class FileTask implements Task {
}
@Override
+ public ParserData getParserData() {
+ return this.parserData;
+ }
+
+ @Override
public URI getURI() {
return file.toURI();
}
Modified:
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/SimpleWalkingDroid.java
URL:
http://svn.apache.org/viewvc/incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/SimpleWalkingDroid.java?rev=1445246&r1=1445245&r2=1445246&view=diff
==============================================================================
---
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/SimpleWalkingDroid.java
(original)
+++
incubator/droids/branches/0.2.x-cleanup/droids-walker/src/main/java/org/apache/droids/walker/SimpleWalkingDroid.java
Tue Feb 12 16:34:16 2013
@@ -36,9 +36,9 @@ public class SimpleWalkingDroid extends
@Override
public void start() {
Preconditions.checkState(initialFiles != null,
- "FileSystemWalker requires at least one starting file");
+ "FileWalker requires at least one starting file");
Preconditions.checkState(!initialFiles.isEmpty(),
- "FileSystemWalker requires at least one starting file");
+ "FileWalker requires at least one starting file");
for (File file : initialFiles) {
queue.add(new FileTask(file, 0));
}