package android.security.execute.transformations;


import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;

import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EPackage.Registry;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.impl.EPackageRegistryImpl;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.gmt.modisco.java.ThisExpression;
import org.eclipse.m2m.atl.core.ATLCoreException;
import org.eclipse.m2m.atl.core.IExtractor;
import org.eclipse.m2m.atl.core.IInjector;
import org.eclipse.m2m.atl.core.IModel;
import org.eclipse.m2m.atl.core.IReferenceModel;
import org.eclipse.m2m.atl.core.ModelFactory;
import org.eclipse.m2m.atl.core.emf.EMFExtractor;
import org.eclipse.m2m.atl.core.emf.EMFInjector;
import org.eclipse.m2m.atl.core.emf.EMFModel;
import org.eclipse.m2m.atl.core.emf.EMFModelFactory;
import org.eclipse.m2m.atl.core.emf.EMFReferenceModel;
import org.eclipse.m2m.atl.core.launch.ILauncher;
import org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher;
import org.eclipse.ui.internal.handlers.WizardHandler.New;
import org.omg.CORBA.ORB;
import android.security.extractor.Utility;

public class ICCModelExtractorForAbundleOFOneToSixtyApps {
	
	public static void runATL(String inputURI1, String inputURI2, String inputURI3, String inputURI4 ,String inputURI5, String inputURI6, String inputURI7, String inputURI8, String inputURI9, String inputURI10, String inputURI11, String inputURI12, String inputURI13, String inputURI14 ,String inputURI15, String inputURI16, String inputURI17, String inputURI18, String inputURI19, String inputURI20, String inputURI21, String inputURI22, String inputURI23, String inputURI24 ,String inputURI25, String inputURI26, String inputURI27, String inputURI28, String inputURI29, String inputURI30, String inputURI31, String inputURI32, String inputURI33, String inputURI34 ,String inputURI35, String inputURI36, String inputURI37, String inputURI38, String inputURI39, String inputURI40, String inputURI41, String inputURI42, String inputURI43, String inputURI44 ,String inputURI45, String inputURI46, String inputURI47, String inputURI48, String inputURI49, String inputURI50, String inputURI51, String inputURI52, String inputURI53, String inputURI54 ,String inputURI55, String inputURI56, String inputURI57, String inputURI58, String inputURI59, String inputURI60, String outputURI) {
        try {
        	System.out.println("ATLinitial:\n");
            ILauncher transformationLauncher = new EMFVMLauncher();
            ModelFactory modelFactory = new EMFModelFactory();
            IInjector injector = new EMFInjector();
            IExtractor extractor = new EMFExtractor();
            
             
            System.out.println("recievemodels:\n");
            IReferenceModel androidMetaModel = modelFactory.newReferenceModel();
            injector.inject(androidMetaModel, Utility.ANDROID_SECURITY_METAMODEL_PATH);
            
            IReferenceModel ICCMetamodel = modelFactory.newReferenceModel();
    		injector.inject(ICCMetamodel, Utility.ICC_METAMODEL_PATH);
            

            IModel inModel1 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel1, inputURI1);
            
            IModel inModel2 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel2, inputURI2);
            
            IModel inModel3 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel3, inputURI3);
            
            IModel inModel4 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel4, inputURI4);
            
            IModel inModel5 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel5, inputURI5);
            
            IModel inModel6 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel6, inputURI6);
            
            IModel inModel7 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel7, inputURI7);
            
            IModel inModel8 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel8, inputURI8);
            
            IModel inModel9 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel9, inputURI9);
            
            IModel inModel10 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel10, inputURI10);
            
            
            IModel inModel11 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel11, inputURI11);
            
            IModel inModel12 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel12, inputURI12);
            
            IModel inModel13 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel13, inputURI13);
            
            IModel inModel14 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel14, inputURI14);
            
            IModel inModel15 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel15, inputURI15);
            
            IModel inModel16 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel16, inputURI16);
            
            IModel inModel17 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel17, inputURI17);
            
            IModel inModel18 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel18, inputURI18);
            
            IModel inModel19 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel19, inputURI19);
            
            IModel inModel20 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel20, inputURI20);
            
            IModel inModel21 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel21, inputURI21);
            
            IModel inModel22 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel22, inputURI22);
            
            IModel inModel23 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel23, inputURI23);
            
            IModel inModel24 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel24, inputURI24);
            
            IModel inModel25 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel25, inputURI25);
            
            IModel inModel26 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel26, inputURI26);
            
            IModel inModel27 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel27, inputURI27);
            
            IModel inModel28 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel28, inputURI28);
            
            IModel inModel29 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel29, inputURI29);
            
            IModel inModel30 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel30, inputURI30);
            
            
            IModel inModel31 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel31, inputURI31);
            
            
            IModel inModel32 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel32, inputURI32);
            
            IModel inModel33 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel33, inputURI33);
            
            IModel inModel34 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel34, inputURI34);
            
            IModel inModel35 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel35, inputURI35);
            
            IModel inModel36 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel36, inputURI37);
            
            IModel inModel37 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel37, inputURI37);
            
            IModel inModel38 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel38, inputURI38);
            
            IModel inModel39 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel39, inputURI39);
            
            IModel inModel40 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel40, inputURI40);
            
            IModel inModel41 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel41, inputURI41);
            
            IModel inModel42 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel42, inputURI42);
            
            IModel inModel43 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel43, inputURI43);
            
            IModel inModel44 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel44, inputURI44);
            
            IModel inModel45 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel45, inputURI45);
            
            IModel inModel46 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel46, inputURI46);
            
            IModel inModel47 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel47, inputURI47);
            
            IModel inModel48 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel48, inputURI48);
            
            IModel inModel49 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel49, inputURI49);
            
            IModel inModel50 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel50, inputURI50);
            
            
            IModel inModel51 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel51, inputURI51);
            
            IModel inModel52 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel52, inputURI52);
            
            IModel inModel53 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel53, inputURI53);
            
            IModel inModel54 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel54, inputURI54);
            
            IModel inModel55 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel55, inputURI55);
            
            IModel inModel56 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel56, inputURI56);
            
            IModel inModel57 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel57, inputURI57);
            
            IModel inModel58 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel58, inputURI58);
            
            IModel inModel59 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel59, inputURI59);
            
            IModel inModel60 = modelFactory.newModel(androidMetaModel);
            injector.inject(inModel60, inputURI60);
            
            
            
            
            

            IModel outModel = modelFactory.newModel(ICCMetamodel);
            transformationLauncher.initialize(new HashMap());
            transformationLauncher.addInModel(inModel1, "IN", "ASAMM");
            transformationLauncher.addInModel(inModel2, "IN1", "ASAMM");
            transformationLauncher.addInModel(inModel3, "IN2", "ASAMM");
            transformationLauncher.addInModel(inModel4, "IN3", "ASAMM");
            transformationLauncher.addInModel(inModel5, "IN4", "ASAMM");
            transformationLauncher.addInModel(inModel6, "IN5", "ASAMM");
            transformationLauncher.addInModel(inModel7, "IN6", "ASAMM");
            transformationLauncher.addInModel(inModel8, "IN7", "ASAMM");
            transformationLauncher.addInModel(inModel9, "IN8", "ASAMM");
            transformationLauncher.addInModel(inModel10, "IN9", "ASAMM");
            transformationLauncher.addInModel(inModel11, "IN10", "ASAMM");
            transformationLauncher.addInModel(inModel12, "IN11", "ASAMM");
            transformationLauncher.addInModel(inModel13, "IN12", "ASAMM");
            transformationLauncher.addInModel(inModel14, "IN13", "ASAMM");
            transformationLauncher.addInModel(inModel15, "IN14", "ASAMM");
            transformationLauncher.addInModel(inModel16, "IN15", "ASAMM");
            transformationLauncher.addInModel(inModel17, "IN16", "ASAMM");
            transformationLauncher.addInModel(inModel18, "IN17", "ASAMM");
            transformationLauncher.addInModel(inModel19, "IN18", "ASAMM");
            transformationLauncher.addInModel(inModel20, "IN19", "ASAMM");
            
            transformationLauncher.addInModel(inModel21, "IN20", "ASAMM");
            transformationLauncher.addInModel(inModel22, "IN21", "ASAMM");
            transformationLauncher.addInModel(inModel23, "IN22", "ASAMM");
            transformationLauncher.addInModel(inModel24, "IN23", "ASAMM");
            transformationLauncher.addInModel(inModel25, "IN24", "ASAMM");
            transformationLauncher.addInModel(inModel26, "IN25", "ASAMM");
            transformationLauncher.addInModel(inModel27, "IN26", "ASAMM");
            transformationLauncher.addInModel(inModel28, "IN27", "ASAMM");
            transformationLauncher.addInModel(inModel29, "IN28", "ASAMM");
            transformationLauncher.addInModel(inModel30, "IN29", "ASAMM");
            
            transformationLauncher.addInModel(inModel2, "IN30", "ASAMM");
            transformationLauncher.addInModel(inModel3, "IN31", "ASAMM");
            transformationLauncher.addInModel(inModel4, "IN32", "ASAMM");
            transformationLauncher.addInModel(inModel5, "IN33", "ASAMM");
            transformationLauncher.addInModel(inModel6, "IN34", "ASAMM");
            transformationLauncher.addInModel(inModel7, "IN35", "ASAMM");
            transformationLauncher.addInModel(inModel8, "IN36", "ASAMM");
            transformationLauncher.addInModel(inModel9, "IN37", "ASAMM");
            transformationLauncher.addInModel(inModel10, "IN38", "ASAMM");
            transformationLauncher.addInModel(inModel11, "IN39", "ASAMM");
            
            transformationLauncher.addInModel(inModel2, "IN40", "ASAMM");
            transformationLauncher.addInModel(inModel3, "IN41", "ASAMM");
            transformationLauncher.addInModel(inModel4, "IN42", "ASAMM");
            transformationLauncher.addInModel(inModel5, "IN43", "ASAMM");
            transformationLauncher.addInModel(inModel6, "IN44", "ASAMM");
            transformationLauncher.addInModel(inModel7, "IN45", "ASAMM");
            transformationLauncher.addInModel(inModel8, "IN46", "ASAMM");
            transformationLauncher.addInModel(inModel9, "IN47", "ASAMM");
            transformationLauncher.addInModel(inModel10, "IN48", "ASAMM");
            transformationLauncher.addInModel(inModel11, "IN49", "ASAMM");
            
            transformationLauncher.addInModel(inModel2, "IN50", "ASAMM");
            transformationLauncher.addInModel(inModel3, "IN51", "ASAMM");
            transformationLauncher.addInModel(inModel4, "IN52", "ASAMM");
            transformationLauncher.addInModel(inModel5, "IN53", "ASAMM");
            transformationLauncher.addInModel(inModel6, "IN54", "ASAMM");
            transformationLauncher.addInModel(inModel7, "IN55", "ASAMM");
            transformationLauncher.addInModel(inModel8, "IN56", "ASAMM");
            transformationLauncher.addInModel(inModel9, "IN57", "ASAMM");
            transformationLauncher.addInModel(inModel10, "IN58", "ASAMM");
            transformationLauncher.addInModel(inModel10, "IN59", "ASAMM");
           
          
            
            transformationLauncher.addOutModel(outModel, "OUT", "ICCMM");
            transformationLauncher.launch(ILauncher.RUN_MODE, new NullProgressMonitor(), new HashMap(),
                    new FileInputStream(Utility.ICC_MODEL_EXTRACTOR_For_A_Bundle_With_One_To_Sixty_Path));
            System.out.println("executeATL:\n");
            extractor.extract(outModel,  outputURI);
            System.out.println("savemodel:\n");
           
            EMFModelFactory emfModelFactory = (EMFModelFactory) modelFactory;
            emfModelFactory.unload((EMFModel) inModel1);
            emfModelFactory.unload((EMFModel) inModel2);
            emfModelFactory.unload((EMFModel) inModel3);
            emfModelFactory.unload((EMFModel) inModel4);
            emfModelFactory.unload((EMFModel) inModel5);
            emfModelFactory.unload((EMFModel) inModel6);
            emfModelFactory.unload((EMFModel) inModel7);
            emfModelFactory.unload((EMFModel) inModel8);
            emfModelFactory.unload((EMFModel) inModel9);
            emfModelFactory.unload((EMFModel) inModel10);
            emfModelFactory.unload((EMFModel) inModel11);
            emfModelFactory.unload((EMFModel) inModel12);
            emfModelFactory.unload((EMFModel) inModel13);
            emfModelFactory.unload((EMFModel) inModel14);
            emfModelFactory.unload((EMFModel) inModel15);
            emfModelFactory.unload((EMFModel) inModel16);
            emfModelFactory.unload((EMFModel) inModel17);
            emfModelFactory.unload((EMFModel) inModel18);
            emfModelFactory.unload((EMFModel) inModel19);
            emfModelFactory.unload((EMFModel) inModel20);
            
            emfModelFactory.unload((EMFModel) inModel21);
            emfModelFactory.unload((EMFModel) inModel22);
            emfModelFactory.unload((EMFModel) inModel23);
            emfModelFactory.unload((EMFModel) inModel24);
            emfModelFactory.unload((EMFModel) inModel25);
            emfModelFactory.unload((EMFModel) inModel25);
            emfModelFactory.unload((EMFModel) inModel26);
            emfModelFactory.unload((EMFModel) inModel27);
            emfModelFactory.unload((EMFModel) inModel28);
            emfModelFactory.unload((EMFModel) inModel29);
            emfModelFactory.unload((EMFModel) inModel30);
            
            emfModelFactory.unload((EMFModel) inModel41);
            emfModelFactory.unload((EMFModel) inModel42);
            emfModelFactory.unload((EMFModel) inModel43);
            emfModelFactory.unload((EMFModel) inModel44);
            emfModelFactory.unload((EMFModel) inModel45);
            emfModelFactory.unload((EMFModel) inModel45);
            emfModelFactory.unload((EMFModel) inModel46);
            emfModelFactory.unload((EMFModel) inModel47);
            emfModelFactory.unload((EMFModel) inModel48);
            emfModelFactory.unload((EMFModel) inModel49);
            emfModelFactory.unload((EMFModel) inModel50);
            
            emfModelFactory.unload((EMFModel) inModel51);
            emfModelFactory.unload((EMFModel) inModel52);
            emfModelFactory.unload((EMFModel) inModel53);
            emfModelFactory.unload((EMFModel) inModel54);
            emfModelFactory.unload((EMFModel) inModel55);
            emfModelFactory.unload((EMFModel) inModel56);
            emfModelFactory.unload((EMFModel) inModel57);
            emfModelFactory.unload((EMFModel) inModel58);
            emfModelFactory.unload((EMFModel) inModel59);
            emfModelFactory.unload((EMFModel) inModel60);
            
            emfModelFactory.unload((EMFModel) outModel);
            emfModelFactory.unload((EMFReferenceModel) androidMetaModel);
            emfModelFactory.unload((EMFReferenceModel) ICCMetamodel);
        } catch (ATLCoreException e) {
            e.printStackTrace();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }

}

