yacy_search_server/source/de/anomic/yacy/seedUpload/yacySeedUploadFtp.java

49 lines
2.1 KiB
Java
Raw Normal View History

Multiple updates regarding the yacy seedUpload facility, optional content parsers, thread pool configuration ... Please help me testing if everything works correct. *) Migration of yacy seedUpload functionality See: http://www.yacy-forum.de/viewtopic.php?t=256 - new uploaders can now be easily introduced because of a new modulare uploader system - default uploaders are: none, file, ftp - adding optional uploader for scp - each uploader provides its own configuration file that will be included into the settings page using the new template include feature - Each uploader can define its libx dependencies. If not all needed libs are available, the uploader is deactivated automatically. *) Migration of optional parsers See: http://www.yacy-forum.de/viewtopic.php?t=198 - Parsers can now also define there libx dependencies - adding parser for bzip compressed content - adding parser for gzip compressed content - adding parser for zip files - adding parser for tar files - adding parser to detect the mime-type of a file this is needed by the bzip/gzip Parser.java - adding parser for rtf files - removing extra configuration file yacy.parser the list of enabled parsers is now stored in the main config file *) Adding configuration option in the performance dialog to configure See: http://www.yacy-forum.de/viewtopic.php?t=267 - maxActive / maxIdle / minIdle values for httpd-session-threadpool - maxActive / maxIdle / minIdle values for crawler-threadpool *) Changing Crawling Filter behaviour See: http://www.yacy-forum.de/viewtopic.php?p=2631 *) Replacing some hardcoded strings with the proper constants of the httpHeader class *) Adding new libs to libx directory. This libs are - needed by new content parsers - needed by new optional seed uploader - needed by SOAP API (which will be committed later) git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@126 6c8d7289-2bf4-0310-a012-ef5d649a1542
2005-05-17 10:25:04 +02:00
package de.anomic.yacy.seedUpload;
import java.io.File;
import de.anomic.net.ftpc;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacySeedUploader;
public class yacySeedUploadFtp implements yacySeedUploader {
public static final String CONFIG_FTP_SERVER = "seedFTPServer";
public static final String CONFIG_FTP_ACCOUNT = "seedFTPAccount";
public static final String CONFIG_FTP_PASSWORD = "seedFTPPassword";
public static final String CONFIG_FTP_PATH = "seedFTPPath";
public String uploadSeedFile (serverSwitch sb, yacySeedDB seedDB, File seedFile) {
try {
if (sb == null) throw new NullPointerException("Reference to serverSwitch nut not be null.");
if (seedDB == null) throw new NullPointerException("Reference to seedDB must not be null.");
if ((seedFile == null)||(!seedFile.exists())) throw new Exception("Seed file does not exist.");
String seedFTPServer = sb.getConfig(CONFIG_FTP_SERVER,null);
String seedFTPAccount = sb.getConfig(CONFIG_FTP_ACCOUNT,null);
String seedFTPPassword = sb.getConfig(CONFIG_FTP_PASSWORD,null);
File seedFTPPath = new File(sb.getConfig(CONFIG_FTP_PATH,null));
if ((seedFTPServer != null) && (seedFTPAccount != null) && (seedFTPPassword != null) && (seedFTPPath != null)) {
String log = ftpc.put(seedFTPServer, seedFile, seedFTPPath.getParent(), seedFTPPath.getName(), seedFTPAccount, seedFTPPassword);
return log;
}
return "Seed upload settings not configured properly. password-len=" +
seedFTPPassword.length() + ", filePath=" +
seedFTPPath;
} catch (Exception e) {
return "Error: " + e.getMessage();
}
}
public String[] getConfigurationOptions() {
return new String[] {CONFIG_FTP_SERVER,CONFIG_FTP_ACCOUNT,CONFIG_FTP_PASSWORD,CONFIG_FTP_PATH};
}
public String[] getLibxDependences() {
return new String[]{};
}
}