Generator Main Class

Listing 4. This is the main class of the code generator application that contains three command-line parameters: input file, an alias for the importer implementation, and an alias for the exporter implementation.

package com.ftp.codegenerator;

import java.util.*;

public class Generator {

  public static void main(String args[]) throws 
    Exception {

    if (args.length!=3) {
      System.out.println
        ("Sintax: Generator <input-file> <importer> 
        <exporter>");
      System.exit(1);
    }

    Importer importer = null;
    if (args[1].equals("XML"))
      importer = new XMLImporter(args[0]);
    else {
      System.out.println("Importer " + args[1] + 
        " non found!");
      System.exit(1);
    }

    Exporter exporter = null;
    if (args[2].equals("Java"))
      exporter = new JavaExporter();
    else {
      System.out.println("Exporter " + args[1] + 
        " non found!");
      System.exit(1);
    }

    importer.start();
    exporter.start();

  }

}