1 18 package net.sf.drftpd.remotefile; 19 20 import java.io.FileNotFoundException ; 21 import java.io.FileReader ; 22 import java.io.IOException ; 23 import java.util.List ; 24 25 import net.sf.drftpd.master.ConnectionManager; 26 import net.sf.drftpd.master.SlaveManagerImpl; 27 import net.sf.drftpd.util.SafeFileWriter; 28 29 import org.apache.log4j.BasicConfigurator; 30 31 36 public class FileListConverter { 37 public static void main(String [] args) throws IOException { 38 BasicConfigurator.configure(); 39 if(args.length != 0) { 40 System.out.println("Converts from files.xml to files.mlst"); 41 return; 42 } 43 System.out.println("Converting files.xml to files.mlst"); 44 System.out.println("This might take a while for large filelists and/or slow servers, have patience..."); 45 LinkedRemoteFileInterface root = FileListConverter.loadJDOMFileDatabase(SlaveManagerImpl.loadRSlaves(), null); 46 MLSTSerialize.serialize(root, new SafeFileWriter("files.mlst")); 47 System.out.println("Completed, have a nice day"); 48 } 49 50 public static LinkedRemoteFileInterface loadJDOMFileDatabase( 51 List rslaves, 52 ConnectionManager cm) 53 throws FileNotFoundException { 54 return JDOMSerialize.unserialize( 55 cm, 56 new FileReader ("files.xml"), 57 rslaves); 58 } 59 } 60 | Popular Tags |