You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
yacy_search_server/source/de/anomic/yacy/seedUpload/yacySeedUploadFile.java

38 lines
1.3 KiB

package de.anomic.yacy.seedUpload;
import java.io.File;
import de.anomic.server.serverFileUtils;
import de.anomic.server.serverSwitch;
import de.anomic.yacy.yacySeedDB;
import de.anomic.yacy.yacySeedUploader;
public class yacySeedUploadFile implements yacySeedUploader {
public static final String CONFIG_FILE_PATH = "seedFilePath";
public String uploadSeedFile(serverSwitch sb, yacySeedDB seedDB, File seedFile) throws Exception {
String logt, seedFilePath = "";
try {
seedFilePath = sb.getConfig(CONFIG_FILE_PATH,"");
if (seedFilePath.length() == 0) throw new Exception("Path to seed file is not configured properly");
File publicSeedFile = new File(seedFilePath);
serverFileUtils.copy(seedFile,publicSeedFile);
return "Seed-List file stored successfully";
} catch (Exception e) {
throw new Exception("Unable to store the seed-list file into the filesystem using path '" + seedFilePath + "'. " + e.getMessage());
}
}
public String[] getConfigurationOptions() {
return new String[]{CONFIG_FILE_PATH};
}
public String[] getLibxDependences() {
return new String[]{};
}
}