/* * Xcm2Kg.java * * Copyright (C) 2003 Miika Nurminen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ import java.io.File; /** * Xcm2Kg * Wrapper for XCM -> GXL -> TouchGraph converter * @author Miika Nurminen * @version 0.1 / 2004-01-05 */ public class Xcm2kg { /** * @param args the command line arguments */ public static void main(String[] args) { try { FileArgumentScheme m = new FileArgumentScheme(args); if (m.helpWanted()) { } // String workDir = m.determineDir("-dir"); // String tempDir = m.determineDir("-temp"); String in = StringLib.removePostfix(m.determineFilename("-i"),".xml"); String out = in+".kg";//m.determineFilename("-o"); File infile = new File(in+".xml"); String workDir = StringLib.catOnce(infile.getParentFile().getCanonicalPath(), File.separator); // System.out.println(workDir); File t1 = File.createTempFile("temp",".xml"); t1.deleteOnExit(); File t2 = File.createTempFile("temp",".gxl"); t2.deleteOnExit(); String temp1 = t1.getCanonicalPath(); String temp2 = t2.getCanonicalPath(); /*String temp1 = tempDir+infile.getName()+".temp"; String temp2 = tempDir+infile.getName()+".gxl";*/ DisposeUtf.main(new String[]{"-i",in+".xml","-o",temp1}); Xcm2Gxl.main(new String[]{"-i",temp1,"-o",temp2,"-nowindow"}); Gxl2TouchGraph.main(new String[]{"-i",temp2,"-o",out,"-dir",workDir}); System.err.println("Conversion successful. \nOutputted file "+out); } catch (Exception e){ ErrorLib.errorReport(e); } } }