Update of /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker
In directory sc8-pr-cvs1:/tmp/cvs-serv18862/scanner/src/com/babeldoc/scanner/worker
Modified Files:
DirectoryScanner.java FtpScanner.java NullScanner.java
SqlScanner.java
Log Message:
All scanner workers have a new general option: binary. This means that the document that they enqueue to the pipeline
could possibly be submitted as a binary file. Additionally I have changed the FtpScanner so that it sets the binary flag
for transfer depending on the state of this flag.
Index: DirectoryScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/DirectoryScanner.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** DirectoryScanner.java 5 Sep 2003 13:28:29 -0000 1.19
--- DirectoryScanner.java 12 Sep 2003 01:09:16 -0000 1.20
***************
*** 323,327 ****
/**
! * TODO: DOCUMENT ME!
*
* @author $author$
--- 323,327 ----
/**
! * The configuration information object for the directory scanner
*
* @author $author$
***************
*** 329,336 ****
*/
class DirectoryScannerInfo extends ScannerWorkerInfo {
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public String getDescription() {
--- 329,335 ----
*/
class DirectoryScannerInfo extends ScannerWorkerInfo {
+
/**
! * @return The description
*/
public String getDescription() {
***************
*** 339,345 ****
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public String getName() {
--- 338,342 ----
/**
! * @return The name
*/
public String getName() {
***************
*** 348,354 ****
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public Collection getTypeSpecificOptions() {
--- 345,349 ----
/**
! * @return The collection of type specific options
*/
public Collection getTypeSpecificOptions() {
Index: FtpScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/FtpScanner.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** FtpScanner.java 5 Sep 2003 13:28:29 -0000 1.20
--- FtpScanner.java 12 Sep 2003 01:09:17 -0000 1.21
***************
*** 87,90 ****
--- 87,91 ----
import com.babeldoc.core.option.ConfigOption;
import com.babeldoc.core.option.IConfigOptionType;
+ import com.babeldoc.core.option.ValueListConfigOptionType;
import com.babeldoc.core.pipeline.PipelineDocument;
import com.babeldoc.scanner.ScannerConfigurationException;
***************
*** 118,121 ****
--- 119,123 ----
private String ftpPassword = "";
private String ftpUsername = "";
+ private int ftpFileType = FTPClient.ASCII_FILE_TYPE;
private String localBackupFolder = "";
private boolean scanSubfolders = false;
***************
*** 177,181 ****
*/
public void initialize() throws ScannerConfigurationException {
-
ftpHost = this.getInfo().getStrValue(FTP_HOST);
ftpUsername = this.getInfo().getStrValue(FTP_USERNAME);
--- 179,182 ----
***************
*** 190,193 ****
--- 191,198 ----
}
+ if(isBinary()) {
+ ftpFileType = FTPClient.BINARY_FILE_TYPE;
+ }
+
//add filename filter
addFilter(FILTER_FILENAME);
***************
*** 229,235 ****
//check if connection was successfull
if (FTPReply.isPositiveCompletion(reply)) {
- //try to login
if (ftpClient.login(ftpUsername, ftpPassword)) {
! if (!ftpClient.changeWorkingDirectory(ftpFolder)) {
ftpClient.disconnect();
throw new ScannerException(
--- 234,247 ----
//check if connection was successfull
if (FTPReply.isPositiveCompletion(reply)) {
if (ftpClient.login(ftpUsername, ftpPassword)) {
! if (ftpClient.changeWorkingDirectory(ftpFolder)) {
! if(ftpClient.setFileType(ftpFileType)) {
! //
! } else {
! ftpClient.disconnect();
! throw new ScannerException(
! I18n.get("scanner.FtpScanner.error.filetype"));
! }
! } else {
ftpClient.disconnect();
throw new ScannerException(
***************
*** 511,515 ****
/**
! * TODO: DOCUMENT ME!
*
* @author $author$
--- 523,527 ----
/**
! * The information for the ftp scanner
*
* @author $author$
***************
*** 518,524 ****
class FtpScannerInfo extends ScannerWorkerInfo {
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public String getDescription() {
--- 530,534 ----
class FtpScannerInfo extends ScannerWorkerInfo {
/**
! * @return the description
*/
public String getDescription() {
***************
*** 527,533 ****
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public String getName() {
--- 537,541 ----
/**
! * @return the name
*/
public String getName() {
***************
*** 536,542 ****
/**
! * TODO: DOCUMENT ME!
! *
! * @return DOCUMENT ME!
*/
public Collection getTypeSpecificOptions() {
--- 544,548 ----
/**
! * @return the collection of type specific optins
*/
public Collection getTypeSpecificOptions() {
Index: NullScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/NullScanner.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NullScanner.java 5 Sep 2003 13:28:29 -0000 1.2
--- NullScanner.java 12 Sep 2003 01:09:17 -0000 1.3
***************
*** 19,25 ****
public class NullScanner extends ScannerWorker {
/**
! * Get the information object
! *
! * @return information object
*/
public NullScanner() {
--- 19,23 ----
public class NullScanner extends ScannerWorker {
/**
! * Constructor
*/
public NullScanner() {
Index: SqlScanner.java
===================================================================
RCS file: /cvsroot/babeldoc/babeldoc/modules/scanner/src/com/babeldoc/scanner/worker/SqlScanner.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** SqlScanner.java 5 Sep 2003 13:28:29 -0000 1.11
--- SqlScanner.java 12 Sep 2003 01:09:17 -0000 1.12
***************
*** 70,74 ****
import com.babeldoc.core.NameValuePair;
import com.babeldoc.core.option.ConfigOption;
- import com.babeldoc.core.option.IConfigInfo;
import com.babeldoc.core.option.IConfigOptionType;
import com.babeldoc.core.option.ValueListConfigOptionType;
--- 70,73 ----
***************
*** 154,160 ****
}
! this.enqueue(sb.toString().getBytes(), new NameValuePair[] {
! new NameValuePair(SCAN_MIMETYPE_KEY, "text/plain")
! });
}
}
--- 153,158 ----
}
! this.enqueue(sb.toString().getBytes(),
! new NameValuePair[] {new NameValuePair(SCAN_MIMETYPE_KEY, "text/plain")});
}
}
***************
*** 196,202 ****
// System.out.println(sb);
! enqueue(sb.toString().getBytes("UTF-8"), new NameValuePair[] {
! new NameValuePair(SCAN_MIMETYPE_KEY, "text/xml")
! });
}
}
--- 194,199 ----
// System.out.println(sb);
! enqueue(sb.toString().getBytes("UTF-8"),
! new NameValuePair[] {new NameValuePair(SCAN_MIMETYPE_KEY, "text/xml")});
}
}
|