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


Java AtlParser类代码示例

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


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

示例1: loadTransformationModel

import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入依赖的package包/类
/**
	 * It loads a transformation as a model.
	 * @param atlTransformationFile 
	 * @return transformation model
	 * @throws ATLCoreException
	 */
	private EMFModel loadTransformationModel (String atlTransformationFile) throws ATLCoreException {
		ModelFactory      modelFactory = new EMFModelFactory();
		EMFReferenceModel atlMetamodel = (EMFReferenceModel)modelFactory.getBuiltInResource("ATL.ecore");
		AtlParser         atlParser    = new AtlParser();		
		EMFModel          atlModel     = (EMFModel)modelFactory.newModel(atlMetamodel);
		atlParser.inject (atlModel, atlTransformationFile);	
		atlModel.setIsTarget(true);				
		
//		// Should we want to serialize the model.
//		String injectedFile = "file:/" + atlTransformationFile + ".xmi";
//		IExtractor extractor = new EMFExtractor();
//		extractor.extract(atlModel, injectedFile);
		
		return atlModel;
	}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:22,代码来源:Tester.java

示例2: typing

import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入依赖的package包/类
public void typing(String atlTransformationFile, Object[] metamodels, String[] names) throws Exception {
	this.atlTransformationFile = atlTransformationFile;

	long diffs = 0;

	AtlParser atlParser = new AtlParser();
	ModelFactory modelFactory = new EMFModelFactory();
	IReferenceModel atlMetamodel = modelFactory
			.getBuiltInResource("ATL.ecore");
	EMFModel atlModel = (EMFModel) modelFactory.newModel(atlMetamodel);

	atlParser.inject(atlModel, atlTransformationFile);

	this.mm = loadMetamodels(metamodels, names);
	this.atlTransformation = new ATLModel(atlModel.getResource(), atlTransformationFile);
	this.analyser = new Analyser(mm, atlTransformation);

	long initTime = System.currentTimeMillis();
	analyser.perform();
	analysisData = new AnalysisResult(analyser);
	
	long finishTime = System.currentTimeMillis();
	diffs += (finishTime - initTime);
	// }
	System.out.println("Time: " + (diffs / 1000.0));
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:27,代码来源:BaseTest.java

示例3: loadAtlTransformation

import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入依赖的package包/类
private Resource loadAtlTransformation() {
	ModelFactory modelFactory = new EMFModelFactory();

	IReferenceModel atlMetamodel;
	try {
		atlMetamodel = modelFactory.getBuiltInResource("ATL.ecore");
		EMFModel loadedAtlModel = (EMFModel) modelFactory
				.newModel(atlMetamodel);

		AtlParser atlParser = new AtlParser();

		String srcFile = original.getTemplate();
		String anURI   = filePathResolver.resolveTransformation(component, srcFile);
				
		
		atlParser.inject(loadedAtlModel, anURI); 
				//filePathResolver.resolve(srcFile));

		loadedAtlModel.setIsTarget(true);
		return loadedAtlModel.getResource();
	} catch ( ATLCoreException e ) {
		throw new RuntimeException(e);
	}
}
 
开发者ID:jesusc,项目名称:bento,代码行数:25,代码来源:AtlMemoryTemplate.java

示例4: load

import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入依赖的package包/类
public static Resource load(String fname) throws ATLCoreException {
	AtlParser atlParser = new AtlParser();
	ModelFactory modelFactory = new EMFModelFactory();
	IReferenceModel atlMetamodel = modelFactory.getBuiltInResource("ATL.ecore");
	EMFModel atlDynModel = (EMFModel) modelFactory.newModel(atlMetamodel);
	atlParser.inject(atlDynModel, fname);
	
	
	Resource originalTrafo = atlDynModel.getResource();
	return originalTrafo;
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:12,代码来源:AtlLoader.java

示例5: run

import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入依赖的package包/类
/**
 * @see IActionDelegate#run(IAction)
 */
public void run(IAction action) {
	IFile f = (IFile) ((IStructuredSelection) selection).getFirstElement();
	ModelFactory modelFactory = new EMFModelFactory();

	try {
		IReferenceModel atlMetamodel = modelFactory
				.getBuiltInResource("ATL.ecore"); //$NON-NLS-1$
		IModel atlModel = modelFactory.newModel(atlMetamodel);

		String srcXmiFile = "file:/" + f.getLocation().toPortableString();
		EMFInjector injector = new EMFInjector();
		injector.inject(atlModel, srcXmiFile);
		
		// String injectedFile = "file:/" + srcXmiFile + ".xmi";
		String extractedFile = srcXmiFile.replace(".xmi", "");
		if (!extractedFile.endsWith(".atl"))
			extractedFile = extractedFile + ".atl";

		// String extractedFile = outputPath + File.separator + file + ".atl";
		AtlParser atlParser = new AtlParser();
		atlParser.extract(atlModel, extractedFile);
	} catch (ATLCoreException e) {
		e.printStackTrace();
	} 

}
 
开发者ID:jesusc,项目名称:bento,代码行数:30,代码来源:ImportAtlXMI.java

示例6: run

import org.eclipse.m2m.atl.engine.parser.AtlParser; //导入依赖的package包/类
/**
 * @see IActionDelegate#run(IAction)
 */
public void run(IAction action) {	
	IFile f = (IFile) ((IStructuredSelection) selection).getFirstElement();
	//ResourceSet rs = new ResourceSetImpl();
	//Resource r = rs.getResource(URI.createPlatformResourceURI(f.getFullPath().toPortableString(), true), true);

	ModelFactory modelFactory = new EMFModelFactory();
	
	IReferenceModel atlMetamodel;
	try {
		atlMetamodel = modelFactory.getBuiltInResource("ATL.ecore");
		IModel atlModel = modelFactory.newModel(atlMetamodel);
		AtlParser atlParser = new AtlParser();
		
		String srcFile = f.getLocation().toPortableString();
		atlParser.inject(atlModel, srcFile);
		
		atlModel.setIsTarget(true);
		
		String injectedFile = "file:/" + srcFile + ".xmi";
		IExtractor extractor = new EMFExtractor();
		extractor.extract(atlModel, injectedFile);
	} catch (ATLCoreException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} //$NON-NLS-1$

	
}
 
开发者ID:jesusc,项目名称:bento,代码行数:32,代码来源:ExportAtlXMI.java


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