package basic;

import uk.ac.ic.doc.automed.*;
import uk.ac.ic.doc.automed.modelmanagement.modeldef.*;
import uk.ac.ic.doc.automed.util.Debugger;
import uk.ac.ic.doc.automed.util.LogOutputHandler;
import uk.ac.ic.doc.automed.util.Logger;

/*
 * An application to setup models (i.e. modelling
 * languages such as ER, Relational, etc) that have no data source.
 * Data source based models are created automatically when a data source
 * is wrapped
 */
public class DefineModels {

    public static void main(String[] args) throws AutoMedException {
        System.out.println("AutoMed Repository: Define Models");

        String cfgFile = System.getProperty("-c");
        String debug = System.getProperty("-d");
        System.out.println("AutoMed Repository Reinitialisation");

        if (debug != null) {
            Debugger.setSectionDebugLevel(new String[]{"-d", debug});
        } else {
            Debugger.setSectionDebugLevel(args);
        }

        Logger.setOutputHandler(new LogOutputHandler(LogOutputHandler.CONSOLE));

        if (cfgFile != null) {
            DSRConfiguration.setDefaultConfigFileName(cfgFile);
        } else {
            DSRConfiguration.setDefaultConfigFileName(args);
        }
        // Create UML model
        System.out.println("Intialising UML model...");
        UMLModelDef uml = new UMLModelDef();
        uml.createModel();
        // Create ER model
        System.out.println("Intialising ER model...");
        ERModelDef er = new ERModelDef();
        er.createModel();
        // Create EER model
        System.out.println("Intialising EER model...");
        EERModelDef eer = new EERModelDef();
        eer.createModel();
        // Create Relational model
        System.out.println("Intialising Relational model...");
        RelModelDef rel = new RelModelDef();
        rel.createModel();

        DSR.shutdown();

        System.exit(0);

    }
}
