public class testkinetikit { private SPDBManager dbm; private EntityManager em; private static Logger log=Logger.getLogger(testkinetikit.class); public testkinetikit() { try { dbm = new SPDBManager(); em = dbm.getEntityManager(); } catch (SigPathDatabaseException e) { e.printStackTrace(); } } private static void initConsoleLogging() { String slash = File.separator; String loggingConfigFileName = new String ("config" + slash + "logging_console_file.cfg"); PropertyConfigurator.configure (loggingConfigFileName); } public static void main(String[] args) { testkinetikit tester = new testkinetikit(); Category root = Category.getRoot(); //root.setPriority(Priority.INFO); initConsoleLogging(); String model_spid = CLI.getOption(args, "-spid", null); String filename=CLI.getOption(args,"-o", model_spid + "-export"); if (model_spid == null) { System.err.println("usage: testkinetikit -spid -o "); System.exit(1); } try { tester.export(model_spid, filename); } catch (SigPathDatabaseException e) { e.printStackTrace(); } System.out.println("done."); } /** * Export a model in SBML format. Just print the model on stdout. */ public void export(String model_spid, String filename) throws SigPathDatabaseException { FileOutputStream out; PrintStream p; String outTxt; TExportModel texport = new TExportModelKK(model_spid); texport.setHideDate(true); XDebug xdebug = new XDebug(); xdebug.startTimer(); texport.execute(xdebug); outTxt = ((TExportModel) texport).getOutFile(); try { out = new FileOutputStream(filename); out.write(outTxt.getBytes()); out.flush(); out.close(); } catch (Exception e) { System.err.println("Error writing to file"); e.printStackTrace(); System.exit(10); } } }