本文整理匯總了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;
}
示例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));
}
示例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);
}
}
示例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;
}
示例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();
}
}
示例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$
}