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.
59 lines
2.2 KiB
59 lines
2.2 KiB
19 years ago
|
//yacySeedUploadFile.java
|
||
|
//-------------------------------------
|
||
|
//part of YACY
|
||
17 years ago
|
//(C) by Michael Peter Christen; mc@yacy.net
|
||
19 years ago
|
//first published on http://www.anomic.de
|
||
|
//Frankfurt, Germany, 2004
|
||
|
//
|
||
|
//This file ist contributed by Martin Thelian
|
||
|
//last major change: $LastChangedDate$ by $LastChangedBy$
|
||
|
//Revision: $LastChangedRevision$
|
||
|
//
|
||
|
//This program is free software; you can redistribute it and/or modify
|
||
|
//it under the terms of the GNU General Public License as published by
|
||
|
//the Free Software Foundation; either version 2 of the License, or
|
||
|
//(at your option) any later version.
|
||
|
//
|
||
|
//This program is distributed in the hope that it will be useful,
|
||
|
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
//GNU General Public License for more details.
|
||
|
//
|
||
|
//You should have received a copy of the GNU General Public License
|
||
|
//along with this program; if not, write to the Free Software
|
||
|
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
|
||
13 years ago
|
package net.yacy.peers.operation;
|
||
20 years ago
|
|
||
|
import java.io.File;
|
||
|
|
||
15 years ago
|
import net.yacy.kelondro.util.FileUtils;
|
||
|
|
||
20 years ago
|
import de.anomic.server.serverSwitch;
|
||
|
|
||
|
public class yacySeedUploadFile implements yacySeedUploader {
|
||
|
|
||
|
public static final String CONFIG_FILE_PATH = "seedFilePath";
|
||
|
|
||
14 years ago
|
public String uploadSeedFile(final serverSwitch sb, final File seedFile) throws Exception {
|
||
20 years ago
|
|
||
19 years ago
|
String seedFilePath = "";
|
||
20 years ago
|
try {
|
||
20 years ago
|
seedFilePath = sb.getConfig(CONFIG_FILE_PATH,"");
|
||
|
if (seedFilePath.length() == 0) throw new Exception("Path to seed file is not configured properly");
|
||
20 years ago
|
|
||
17 years ago
|
final File publicSeedFile = new File(seedFilePath);
|
||
16 years ago
|
FileUtils.copy(seedFile,publicSeedFile);
|
||
20 years ago
|
|
||
|
return "Seed-List file stored successfully";
|
||
17 years ago
|
} catch (final Exception e) {
|
||
20 years ago
|
throw new Exception("Unable to store the seed-list file into the filesystem using path '" + seedFilePath + "'. " + e.getMessage());
|
||
20 years ago
|
}
|
||
|
}
|
||
|
|
||
|
public String[] getConfigurationOptions() {
|
||
|
return new String[]{CONFIG_FILE_PATH};
|
||
|
}
|
||
|
|
||
|
}
|