/*******************************************************************************
 * Copyright 2016 Kaito Ii
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/
package org.sbml.layoutconverter;

import java.io.File;
import java.io.IOException;

import javax.xml.bind.JAXBException;
import javax.xml.stream.XMLStreamException;

import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;

// TODO: Auto-generated Javadoc
/**
 * The Class Application.
 *
 * @author Kaito Ii
 *         Date Created: Jul 7, 2016
 */
public class Application {

  /** The converter. */
  private LayoutConverter converter;


  /**
   * Instantiates a new application.
   *
   * @param args
   *        the args
   */
  public Application(String[] args) {
    ApplicationOption option = new ApplicationOption();
    CmdLineParser parser = new CmdLineParser(option);
    try {
      parser.parseArgument(args);
    } catch (CmdLineException e1) {
      System.out.println(e1.getMessage());
      parser.printUsage(System.err);
      System.exit(1);
    }
    if (option.isHelp()) {
      parser.printUsage(System.err);
      System.exit(1);
    }
    String filepath = option.getInput();
    String outputpath = option.getOutput();
    System.out.println("input " + filepath);
    System.out.println("output " + outputpath);
    try {
      converter = new LayoutConverter(new File(filepath), option);
    } catch (JAXBException e) {
      System.err.println("Error unmarshaling XML");
      System.err.println(e.getLocalizedMessage());
      return;
    } catch (XMLStreamException | IOException e) {
      System.err.println("Error reading SBML model");
      System.err.println(e.getLocalizedMessage());
      return;
    }
    converter.convert();
    converter.save();
    converter.print();
    converter.validate();
  }


  /**
   * The main method.
   *
   * @param args
   *        the arguments
   */
  public static void main(String[] args) {
    new Application(args);
  }
}

@@ -803,32 +803,97 @@
 .io.IOException;
+%0Aimport java.text.MessageFormat;%0Aimport java.util.logging.Logger;
 %0A%0Aimport javax.x
@@ -1198,16 +1198,155 @@
 cation %7B
+%0A  %0A  /**%0A   * A %7B@link Logger%7D for this class.%0A   */%0A  private static final Logger logger = Logger.getLogger(Application.class.getName());
 %0A%0A  /** 
@@ -1401,17 +1401,16 @@
 erter;%0A%0A
-%0A
   /**%0A  
@@ -1461,36 +1461,24 @@
  @param args
-%0A   *       
  the args%0A  
@@ -1625,24 +1625,25 @@
 er(option);%0A
+%0A
     try %7B%0A  
@@ -1716,34 +1716,29 @@
 %7B%0A      
-System.out.println
+logger.severe
 (e1.getM
@@ -1809,24 +1809,25 @@
 t(1);%0A    %7D%0A
+%0A
     if (opti
@@ -1902,24 +1902,25 @@
 t(1);%0A    %7D%0A
+%0A
     String f
@@ -1988,24 +1988,25 @@
 etOutput();%0A
+%0A
     System.o
@@ -2020,19 +2020,8 @@
 tln(
-%22input %22 + 
 file
@@ -2054,30 +2054,62 @@
 tln(
-%22
 output
- %22 + outputpath
+path);%0A    long time = System.currentTimeMillis(
 );%0A 
@@ -2509,16 +2509,17 @@
 ;%0A    %7D%0A
+%0A
     conv
@@ -2543,30 +2543,221 @@
     
-converter.save();%0A    
+logger.info(MessageFormat.format(%0A      %22Time lapsed for conversion: %7B0,number%7D s%22,%0A      (System.currentTimeMillis() - time)/1e3d));%0A    converter.save();%0A    // This causes problems for very large models:%0A    //
 conv
@@ -2802,17 +2802,16 @@
 );%0A  %7D%0A%0A
-%0A
   /**%0A  
@@ -2958,10 +2958,13 @@
 s);%0A  %7D%0A
+  %0A
 %7D%0A

Update Application.java