当前位置: 首页>>代码示例>>Java>>正文


Java Model类代码示例

本文整理汇总了Java中org.eclipse.m2m.atl.emftvm.Model的典型用法代码示例。如果您正苦于以下问题:Java Model类的具体用法?Java Model怎么用?Java Model使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Model类属于org.eclipse.m2m.atl.emftvm包,在下文中一共展示了Model类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import org.eclipse.m2m.atl.emftvm.Model; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * Loads and registers the input model with the {@link ExecEnv}s.
 */
@Override
public void read() throws IOException {
	super.read();

	final Model model = EmftvmFactory.eINSTANCE.createModel();
	model.setResource(resource);

	queryExecEnv.registerInputModel("IN", model);
	transformExecEnv.registerInOutModel("IN", model);
}
 
开发者ID:FTSRG,项目名称:trainbenchmark-ttc,代码行数:16,代码来源:ATLBenchmarkCase.java

示例2: runCAML2TOSCATypes

import org.eclipse.m2m.atl.emftvm.Model; //导入依赖的package包/类
public void runCAML2TOSCATypes(URI camlProfile, String toscaModelPath) throws IOException {
		ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
		
		ResourceSet rs = new ResourceSetImpl();		
		rs.getPackageRegistry().put(ToscaPackage.eINSTANCE.getNsURI(), ToscaPackage.eINSTANCE);
		rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new XMIResourceFactoryImpl());
		rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("genmodel", new XMIResourceFactoryImpl());
		rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xsd", new XMLResourceFactoryImpl());
		
		rs.getPackageRegistry().put(UMLPackage.eINSTANCE.getNsURI(),
				UMLPackage.eINSTANCE);
		rs.getResourceFactoryRegistry().getExtensionToFactoryMap()
				.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);	
		
		ToscaUtil.init(rs, "model/");
		
		// TODO: Maybe there is a better solution for 'resetting' the extended metadata
		// We changed the annotation already in the tosca.ecore
	    EClassifierExtendedMetaData.Holder holder = (EClassifierExtendedMetaData.Holder)ToscaPackage.eINSTANCE.getDefinitionsType();
	    EClassifierExtendedMetaData result = holder.getExtendedMetaData();
	    result.setName("Definitions");
		
		// Load metamodels
		Metamodel umlMM = EmftvmFactory.eINSTANCE.createMetamodel();
		umlMM.setResource(rs.getResource(URI.createURI("http://www.eclipse.org/uml2/4.0.0/UML"), true));
		env.registerMetaModel("UMLMM", umlMM);
		
		Metamodel toscaMM = EmftvmFactory.eINSTANCE.createMetamodel();
		toscaMM.setResource(rs.getResource(URI.createURI("http://docs.oasis-open.org/tosca/ns/2011/12"), true));
		env.registerMetaModel("TOSCA", toscaMM);

		//  ##### INPUT Models #####
		
		// the CAML library
		Model cL = EmftvmFactory.eINSTANCE.createModel();
		URI libraryURI = URI.createPlatformPluginURI("eu.artist.migration.caml", true);
		libraryURI = libraryURI.appendSegments(new String[]{"umllibraries", "CAMLLibrary.uml"});
		cL.setResource(rs.getResource(libraryURI, true));
		env.registerInputModel("CL", cL);
		
		// the CAML profile 
		Model cP = EmftvmFactory.eINSTANCE.createModel();		
		cP.setResource(rs.getResource(camlProfile, true));
		env.registerInputModel("CP", cP);
		
//		Model cCP = EmftvmFactory.eINSTANCE.createModel();
//		profileURI = URI.createPlatformPluginURI("eu.artist.migration.caml", true);
//		profileURI = profileURI.appendSegments(new String[]{"umlprofiles", "CommonCloudProfile.profile.uml"});
//		cCP.setResource(rs.getResource(profileURI, true));
//		env.registerInputModel("CCP", cCP);
		
		// ##### OUTPUT Modles ##### 
		
		// the TOSCA deployment model
		Model toscaM = EmftvmFactory.eINSTANCE.createModel();
		toscaM.setResource(rs.createResource(URI.createFileURI(new File(toscaModelPath).getAbsolutePath())));
		env.registerOutputModel("TM", toscaM);

		// Load and run module
		DefaultModuleResolver mr = new DefaultModuleResolver(moduleLocation, new ResourceSetImpl());
		TimingData td = new TimingData();
		env.loadModule(mr, typesTrafo);
		td.finishLoading();
		env.run(td);
		td.finish();
		

		toscaM.getResource().save(Collections.emptyMap());
	}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:70,代码来源:CAML2TOSCALauncher.java

示例3: runCAML2TOSCATemplates

import org.eclipse.m2m.atl.emftvm.Model; //导入依赖的package包/类
public void runCAML2TOSCATemplates(String camlModelPath, String toscaModelPath) throws IOException {
		ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
		
		ResourceSet rs = new ResourceSetImpl();
		rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new XMIResourceFactoryImpl());
		rs.getPackageRegistry().put(ToscaPackage.eINSTANCE.getNsURI(), ToscaPackage.eINSTANCE);
		rs.getPackageRegistry().put(UMLPackage.eINSTANCE.getNsURI(),
				UMLPackage.eINSTANCE);
		rs.getResourceFactoryRegistry().getExtensionToFactoryMap()
				.put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);	
		ToscaUtil.init(rs, "model/");
		
		// TODO: Maybe there is a better solution for 'resetting' the extended metadata
		// We changed the annotation already in the tosca.ecore
	    EClassifierExtendedMetaData.Holder holder = (EClassifierExtendedMetaData.Holder)ToscaPackage.eINSTANCE.getDefinitionsType();
	    EClassifierExtendedMetaData result = holder.getExtendedMetaData();
	    result.setName("Definitions");
		
		// Load metamodels
		Metamodel umlMM = EmftvmFactory.eINSTANCE.createMetamodel();
		umlMM.setResource(rs.getResource(URI.createURI("http://www.eclipse.org/uml2/4.0.0/UML"), true));
		env.registerMetaModel("UMLMM", umlMM);
		
		Metamodel toscaMM = EmftvmFactory.eINSTANCE.createMetamodel();
		toscaMM.setResource(rs.getResource(URI.createURI("http://docs.oasis-open.org/tosca/ns/2011/12"), true));
		env.registerMetaModel("TOSCA", toscaMM);

		//  ##### INPUT Models #####
		
		// the CAML deployment model
		Model umlM = EmftvmFactory.eINSTANCE.createModel();
		// umlM.setResource(rs.getResource(URI.createURI(camlModelPath, true), true));
		umlM.setResource(rs.getResource(URI.createFileURI(new File(camlModelPath).getAbsolutePath()), true));
		env.registerInputModel("UMLM", umlM);
		
		// the CAML library
		Model cL = EmftvmFactory.eINSTANCE.createModel();
		URI libraryURI = URI.createPlatformPluginURI("eu.artist.migration.caml", true);
		libraryURI = libraryURI.appendSegments(new String[]{"umllibraries", "CAMLLibrary.uml"});
		cL.setResource(rs.getResource(libraryURI, true));
		env.registerInputModel("CL", cL);
		
		// the CAML platfrom library
//		Model cPL = EmftvmFactory.eINSTANCE.createModel();
//		libraryURI = URI.createPlatformPluginURI("eu.artist.migration.caml.operatingenvironments", true);
//		libraryURI = libraryURI.appendSegments(new String[]{"umllibraries", "webOperatingEnvironment.uml"});
//		cPL.setResource(rs.getResource(libraryURI, true));
//		env.registerInputModel("CPL", cPL);
		
		// the CAML profile 
		Model cP = EmftvmFactory.eINSTANCE.createModel();
		URI profileURI = URI.createPlatformPluginURI("eu.artist.migration.caml", true);
		// profileURI = profileURI.appendSegments(new String[]{"umlprofiles", "GoogleAppEngineProfile.profile.uml"});
		// profileURI = profileURI.appendSegments(new String[]{"umlprofiles", "AmazonAWSProfile.profile.uml"});
		profileURI = profileURI.appendSegments(new String[]{"umlprofiles", "OpenStackProfile.profile.uml"});
		cP.setResource(rs.getResource(profileURI, true));
		env.registerInputModel("CP", cP);
		
		Model cCP = EmftvmFactory.eINSTANCE.createModel();
		profileURI = URI.createPlatformPluginURI("eu.artist.migration.caml", true);
		profileURI = profileURI.appendSegments(new String[]{"umlprofiles", "CommonCloudProfile.profile.uml"});
		cCP.setResource(rs.getResource(profileURI, true));
		env.registerInputModel("CCP", cCP);
		
		// ##### OUTPUT Modles ##### 
		
		// the TOSCA deployment model
		Model toscaM = EmftvmFactory.eINSTANCE.createModel();
		toscaM.setResource(rs.createResource(URI.createFileURI(new File(toscaModelPath).getAbsolutePath())));
		env.registerOutputModel("TM", toscaM);

		// Load and run module
		DefaultModuleResolver mr = new DefaultModuleResolver(moduleLocation, new ResourceSetImpl());
		TimingData td = new TimingData();
		env.loadModule(mr, templatesTrafo);
		td.finishLoading();
		env.run(td);
		td.finish();
		
		toscaM.getResource().save(Collections.emptyMap());
	}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:82,代码来源:CAML2TOSCALauncher.java

示例4: launch

import org.eclipse.m2m.atl.emftvm.Model; //导入依赖的package包/类
public void launch(String inMetamodelPath, String inModelPath, String outMetamodelPath,
		String outModelPath, String transformationDir, String transformationModule){
	
	/* 
	 * Creates the execution environment where the transformation is going to be executed,
	 * you could use an execution pool if you want to run multiple transformations in parallel,
	 * but for the purpose of the example let's keep it simple.
	 */
	ExecEnv env = EmftvmFactory.eINSTANCE.createExecEnv();
	ResourceSet rs = new ResourceSetImpl();

	/*
	 * Load meta-models in the resource set we just created, the idea here is to make the meta-models
	 * available in the context of the execution environment, the ResourceSet is later passed to the
	 * ModuleResolver that is the actual class that will run the transformation.
	 * Notice that we use the nsUris to locate the metamodels in the package registry, we initialize them 
	 * from Ecore files that we registered lazily as shown below in e.g. registerInputMetamodel(...) 
	 */
	Metamodel inMetamodel = EmftvmFactory.eINSTANCE.createMetamodel();
	inMetamodel.setResource(rs.getResource(URI.createURI(inputMetamodelNsURI), true));
	env.registerMetaModel(IN_METAMODEL_NAME, inMetamodel);
	
	Metamodel outMetamodel = EmftvmFactory.eINSTANCE.createMetamodel();
	outMetamodel.setResource(rs.getResource(URI.createURI(outputMetamodelNsURI), true));
	env.registerMetaModel(OUT_METAMODEL_NAME, outMetamodel);
	
	/*
	 * Create and register resource factories to read/parse .xmi and .emftvm files,
	 * we need an .xmi parser because our in/output models are .xmi and our transformations are
	 * compiled using the ATL-EMFTV compiler that generates .emftvm files
	 */
	rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
	rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("emftvm", new EMFTVMResourceFactoryImpl());
	
	// Load models
	Model inModel = EmftvmFactory.eINSTANCE.createModel();
	inModel.setResource(rs.getResource(URI.createURI(inModelPath, true), true));
	env.registerInputModel("IN", inModel);
	
	Model outModel = EmftvmFactory.eINSTANCE.createModel();
	outModel.setResource(rs.createResource(URI.createURI(outModelPath)));
	env.registerOutputModel("OUT", outModel);
	
	/*
	 *  Load and run the transformation module
	 *  Point at the directory your transformations are stored, the ModuleResolver will 
	 *  look for the .emftvm file corresponding to the module you want to load and run
	 */
	ModuleResolver mr = new DefaultModuleResolver(transformationDir, rs);
	TimingData td = new TimingData();
	env.loadModule(mr, TRANSFORMATION_MODULE);
	td.finishLoading();
	env.run(td);
	td.finish();
		
	// Save models
	try {
		outModel.getResource().save(Collections.emptyMap());
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:guana,项目名称:ATLauncher,代码行数:63,代码来源:ATLLauncher.java


注:本文中的org.eclipse.m2m.atl.emftvm.Model类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。