• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java TransformationExecutor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: transform

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
@SuppressWarnings("restriction")
private IStatus transform(URI transformationURI, Collection<ModelExtent> transformationParameters,
        Optional<Trace> transformationTrace) throws IOException {

    ExecutionContextImpl context = new ExecutionContextImpl();
    if (transformationTrace.isPresent()) {
        context.getSessionData().setValue(QVTEvaluationOptions.INCREMENTAL_UPDATE_TRACE, transformationTrace.get());
    }
    context.setConfigProperty("keepModeling", true);
    context.setLog(new Slf4JLogger(LOGGER));

    TransformationExecutor executor = this.transformationContext.getQVTOTransformationExecutorProvider()
            .getTransformationExecutor(transformationURI);
    ExecutionDiagnostic result = executor.execute(context, transformationParameters.toArray(new ModelExtent[0]));

    if (result.getSeverity() != Diagnostic.OK) {
        IStatus status = BasicDiagnostic.toIStatus(result);
        Activator.getDefault().getLog().log(status);
    }

    return BasicDiagnostic.toIStatus(result);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:23,代码来源:DomainIndependentTransformationBase.java


示例2: getTransformationExecutor

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
@Override
public TransformationExecutor getTransformationExecutor(URI resourceURI) throws IOException {
    TransformationExecutor res;
    if ((res = executorCache.get(resourceURI.toString())) == null) {
        res = delegateProvider.getTransformationExecutor(resourceURI);
        executorCache.put(resourceURI.toString(), res);
    }
    return res;
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:10,代码来源:CachingTransformationExecutorProvider.java


示例3: runTransformation

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
protected void runTransformation(URI transformationURI, Iterable<ModelExtent> transformationParameters,
        Trace traceModel) {
    TransformationExecutor executor = new TransformationExecutor(transformationURI);
    ExecutionContextImpl ctx = new ExecutionContextImpl();
    ctx.setLog(new Slf4JLogger(LOGGER, Level.INFO));
    ctx.getSessionData().setValue(QVTEvaluationOptions.INCREMENTAL_UPDATE_TRACE, traceModel);
    ExecutionDiagnostic result = executor.execute(ctx,
            Iterables.toArray(transformationParameters, ModelExtent.class));
    assertEquals(result.getMessage(), ExecutionDiagnostic.OK, result.getSeverity());
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:11,代码来源:TransformationTestBase.java


示例4: execute

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
private QVTOTransformationResult execute() {
	TransformationExecutor executor = new TransformationExecutor(qvtoTransformationFile);
	ModelExtent[] inoutModelsExtent = createInoutModelsExtentWithInitialContent(inoutInitialModels);
	ExecutionContextImpl context = setupExecutionEnvironment();
	ExecutionDiagnostic result = executor.execute(context, inoutModelsExtent);
	List<EObject>[] inoutFinalModels = createInoutFinalModels(inoutModelsExtent);
	QVTOTransformationResult qvtResult = new QVTOTransformationResult(result, inoutFinalModels);
	return qvtResult;
}
 
开发者ID:aciancone,项目名称:klapersuite,代码行数:10,代码来源:QVTOTransformation.java


示例5: build

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
public void build() {

		Map<String, String> env = System.getenv();
		String changeSet = env.get("ChangeSet");
		String changePath = env.get("ChangePath");
		String runIndex = env.get("RunIndex");
		int sequenceLength = Integer.parseInt(env.get("Sequences"));
		
		long start = System.nanoTime();

		this.rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());

		this.rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
		
		EPackage.Registry.INSTANCE.put(CIM.CIMPackage.eINSTANCE.getNsURI(), CIM.CIMPackage.eINSTANCE);
		EPackage.Registry.INSTANCE.put(substationStandard.SubstationStandardPackage.eINSTANCE.getNsURI(), substationStandard.SubstationStandardPackage.eINSTANCE);
		EPackage.Registry.INSTANCE.put(COSEM.COSEMPackage.eINSTANCE.getNsURI(), COSEM.COSEMPackage.eINSTANCE);
		EPackage.Registry.INSTANCE.put(outageDetectionJointarget.OutageDetectionJointargetPackage.eINSTANCE.getNsURI(), outageDetectionJointarget.OutageDetectionJointargetPackage.eINSTANCE);
		EPackage.Registry.INSTANCE.put(outageDetectionMjtrace.OutageDetectionMjtracePackage.eINSTANCE.getNsURI(), outageDetectionMjtrace.OutageDetectionMjtracePackage.eINSTANCE);
		EPackage.Registry.INSTANCE.put(outagePreventionJointarget.OutagePreventionJointargetPackage.eINSTANCE.getNsURI(), outagePreventionJointarget.OutagePreventionJointargetPackage.eINSTANCE);
		EPackage.Registry.INSTANCE.put(outagePreventionMjtrace.OutagePreventionMjtracePackage.eINSTANCE.getNsURI(), outagePreventionMjtrace.OutagePreventionMjtracePackage.eINSTANCE);

		URI txURI = URI.createFileURI(new File("transformations/" + this.transformation + ".qvto").getAbsolutePath());
		TransformationExecutor executor = new TransformationExecutor(txURI);

		ExecutionContextImpl context = new ExecutionContextImpl();
		context.setConfigProperty("keepModeling", true);

		OutputStreamWriter outStream = new OutputStreamWriter(System.err);
		Log log = new WriterLog(outStream);
		context.setLog(log);
		long end = System.nanoTime();

		System.out.println("ModelJoin;" + this.transformation + ";" + changeSet + ";" + runIndex + ";;Loading;Time;" + Long.toString(end-start));

		this.runIteration(changePath + "/CIM_DCIM-out000.xmi",
						  changePath + "/COSEM-out000.xmi",
						  changePath + "/Substandard-out000.xmi",
						  0, changeSet, runIndex, "Initial", executor, context);
		
		for (int i = 1; i <= sequenceLength; i++) {
			this.runIteration(changePath + String.format("/CIM_DCIM-out%03d.xmi", i),
							  changePath + String.format("/COSEM-out%03d.xmi", i),
							  changePath + String.format("/Substandard-out%03d.xmi", i),
							  i, changeSet, runIndex, "Update", executor, context);
		}
	}
 
开发者ID:georghinkel,项目名称:ttc2017smartGrids,代码行数:48,代码来源:App.java


示例6: runIteration

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
private void runIteration(String cim, String cosem, String substation, int index, String changeSet, String runIndex, String phase, TransformationExecutor executor, ExecutionContextImpl context) {

		List<ModelExtent> modelExtents = new ArrayList<ModelExtent>();
		long loadModelsstart = System.nanoTime();
		modelExtents.add(this.createModelExtent(cim));
		if ("outagePrevention".equals(this.transformation)) {
			modelExtents.add(this.createModelExtent(substation));
		}
		modelExtents.add(this.createModelExtent(cosem));
		long loadModelsEnd = System.nanoTime();
		if (phase == "Initial") {
			System.out.println("ModelJoin;" + this.transformation + ";" + changeSet + ";" + runIndex + ";" + Integer.toString(index) + ";" + phase + ";Time;" + Long.toString(loadModelsEnd-loadModelsstart));
		}
		ModelExtent output = new BasicModelExtent();
		modelExtents.add(output);
		modelExtents.add(new BasicModelExtent());

		long start = System.nanoTime();
		ExecutionDiagnostic result = executor.execute(context,
				modelExtents.toArray(new ModelExtent[modelExtents.size()]));
		long end = System.nanoTime();

		if (result.getSeverity() == Diagnostic.OK) {
			// the output objects got captured in the output extent
			XMIResource outResource = (XMIResource) rs
					.createResource(URI.createFileURI(new File(this.transformation + ".xmi").getAbsolutePath()));
			outResource.getContents().addAll(output.getContents());
			try {
				outResource.save(null);
				System.out.println("ModelJoin;" + this.transformation + ";" + changeSet + ";" + runIndex + ";" + Integer.toString(index) + ";" + phase + ";Time;" + Long.toString(end-start));
				System.out.println("ModelJoin;" + this.transformation + ";" + changeSet + ";" + runIndex + ";" + Integer.toString(index) + ";" + phase + ";Elements;" + Integer.toString(outResource.getContents().size()));
			} catch (IOException e) {
				e.printStackTrace();
			}
		} else {
			IStatus status = BasicDiagnostic.toIStatus(result);
			StringBuilder s = new StringBuilder();
			s.append("Failed to execute ");
			s.append(this.transformation);
			s.append(": ");
			s.append(status.getMessage());
			for (IStatus child : status.getChildren()) {
				s.append("\n " + child.getMessage());
			}
			System.err.println(s);
		}
	}
 
开发者ID:georghinkel,项目名称:ttc2017smartGrids,代码行数:48,代码来源:App.java


示例7: build

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
public void build() {
      
this.rs.getResourceFactoryRegistry().
    getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());

this.rs.getResourceFactoryRegistry().
    getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());

EPackage.Registry.INSTANCE.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE); 
Resource.Factory.Registry.INSTANCE.
    getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE); 



List<ModelExtent> modelExtents = new ArrayList<ModelExtent>();

for(int i = 0; i < this.source.size(); i += 2) {
    modelExtents.add(this.processSourcePair(this.source.get(i),this.source.get(i+1)));
}

URI txURI = URI.createFileURI(new File(this.transformation).getAbsolutePath());
TransformationExecutor executor=new TransformationExecutor(txURI);

/* TODO: Does the CLI input match the QVTo transformation (xform) signature? 
   Use TransformationExecutor.loadTransformation() */ 

/* TODO: Put a scheme in place to support different file extensions and 
   use them to identify metamodels?! */




/* TODO: support multiple out parameters for xform */

ModelExtent output = new BasicModelExtent();
modelExtents.add(output);

ExecutionContextImpl context = new ExecutionContextImpl();
context.setConfigProperty("keepModeling", true);

OutputStreamWriter outStream = new OutputStreamWriter(System.out);
Log log = new WriterLog(outStream);
context.setLog(log);

ExecutionDiagnostic result = executor.execute(context,
					      modelExtents.toArray(new ModelExtent[modelExtents.size()]));

if(result.getSeverity() == Diagnostic.OK) {
    // the output objects got captured in the output extent
    UMLResource outResource = (UMLResource) rs.createResource(URI.createFileURI(new File("out.uml").getAbsolutePath()));
    outResource.getContents().addAll(output.getContents());
    try {
	outResource.save(null);
    } catch (IOException e) {
	e.printStackTrace();
    }
} else {
    IStatus status = BasicDiagnostic.toIStatus(result);
    StringBuilder s = new StringBuilder();
    s.append("Failed to execute ");
    s.append(txURI);
    s.append(": ");
    s.append(status.getMessage());
    for (IStatus child : status.getChildren()) {
	s.append("\n " + child.getMessage());
    }
    System.out.println(s);
}
   }
 
开发者ID:mrcalvin,项目名称:qvto-cli,代码行数:70,代码来源:App.java


示例8: getTransformationExecutor

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
@Override
public TransformationExecutor getTransformationExecutor(URI resourceURI) throws IOException {
    return new TransformationExecutor(resourceURI);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:5,代码来源:QVTOTransformationExecutorProvider.java


示例9: transform

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
private static void transform (OperationInterfaceContainer opInterfaceContainer, List<EObject> external, IOverviewConverterCallback callback)
{
			final Overview overviewModel = (Overview)EcoreUtil.getRootContainer(opInterfaceContainer);

               URI transformationURI = URI.createURI("platform:/plugin/eu.cloudscaleproject.env.csm2pcm/transforms/pcm2opInterfaceContainer.qvto");
               final TransformationExecutor executor = new TransformationExecutor(transformationURI);
               executor.loadTransformation();

               final ExecutionContextImpl context = new ExecutionContextImpl();

               
               context.setLog(new TransformationLogger());
               context.setConfigProperty("moduleID", opInterfaceContainer.getId());
               context.setConfigProperty("CSMID", CSM_ID_PREFIX);
               
               context.setConfigProperty("PCM_REPOSITORY_KEY", IOverviewConverter.KEY_PCM_REPOSITORY);
               context.setConfigProperty("PCM_SYSTEM_KEY", IOverviewConverter.KEY_PCM_SYSTEM);
               context.setConfigProperty("PCM_INTERFACE_KEY", IOverviewConverter.KEY_PCM_INTERFACE);
               context.setConfigProperty("PCM_OPERATION_KEY", IOverviewConverter.KEY_PCM_OPERATION);

			//clear interfaces
			OverviewArchitectureUtil.deleteInterfaces(opInterfaceContainer.getProvidedInterfaces());
			OverviewArchitectureUtil.deleteInterfaces(opInterfaceContainer.getRequiredInterfaces());

			List<EObject> inputCsmList = new ArrayList<EObject>();
			inputCsmList.add(overviewModel);
			
			ResourceSet dataSet = new ResourceSetImpl();
			
			//find resource set
			for(EObject eo : external){
				if(eo instanceof Repository){
					
					EcoreUtil.resolveAll(eo);
					
					if(eo.eResource() != null && eo.eResource().getResourceSet() != null){
						dataSet = eo.eResource().getResourceSet();
					}
				}
			}
			
			URI inDataTypeUri = URI.createURI("pathmap://PCM_MODELS/PrimitiveTypes.repository");
			Resource dataTypesResource = dataSet.getResource(inDataTypeUri, true);
			EList<EObject> inObjectsDataTypes = dataTypesResource.getContents();
			
			final ModelExtent inputCsm = new BasicModelExtent(inputCsmList);
			final ModelExtent inputExternal = new BasicModelExtent(external);
			final ModelExtent inputDataTypes = new BasicModelExtent(inObjectsDataTypes);
			
			ExecutionDiagnostic result = executor.execute(context, inputExternal, inputDataTypes, inputCsm);

			if(result.getSeverity() == Diagnostic.OK) {
				try {
					if (overviewModel.eResource() != null)
						overviewModel.eResource().save(null);
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				if(callback != null){
					callback.callback();
				}
			}
			else{
				// turn the result diagnostic into status and send it to error log			
				IStatus status = BasicDiagnostic.toIStatus(result);
				Activator.getDefault().getLog().log(status);
			}
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:70,代码来源:OverviewImport.java


示例10: runTransform

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
@Override
    public final void runTransform(final Shell shell, final IProgressMonitor monitor) throws InvocationTargetException {
// TODO: test     	
    	/* this does find applied Stereotypes
        resourceSet = createResourceSet();
        theSelectedResource = resourceSet.getResource(selection, true);
		TreeIterator<EObject> tree=theSelectedResource.getAllContents();
		while(tree.hasNext()){
			EObject eObject=tree.next();
			if(eObject instanceof Element){
				Element umlElement=(Element)eObject;
				if(!umlElement.getAppliedStereotypes().isEmpty()){
					System.out.println("TransformDelegate found "+umlElement);
				}
			}
		}
        
if(true)return;
*/    	
        final TransformationExecutor executor = new TransformationExecutor(transformationURI);

        final ExecutionContextImpl context = new ExecutionContextImpl();
        context.setLog(new ContextLog());
        context.setMonitor(new EvaluationMonitor() {

            @Override
            public boolean isCanceled() {
                return monitor.isCanceled();
            }

            @Override
            public void cancel() {
                monitor.setCanceled(true);
            }
        });

        for (final Entry<String, Object> configProperties : getConfigProperties().entrySet()) {
            context.setConfigProperty(configProperties.getKey(), configProperties.getValue());
        }

        resourceSet = createResourceSet();
        theSelectedResource = resourceSet.getResource(selection, true);

        final IStatus status = validate();
        if (!status.isOK() && !shouldContinue(shell, status)) {
            return;
        }

        final ModelExtent[] arguments = arguments();

        final Diagnostic diagnostic = executor.execute(context, arguments);

        if (diagnostic.getSeverity() == Diagnostic.ERROR) {
            throw diagnostic.getException() == null ? new InvocationTargetException(new RuntimeException(
                    diagnostic.getMessage()), diagnostic.getMessage()) : new InvocationTargetException(
                    diagnostic.getException(), diagnostic.getMessage());
        }
        postExecute();
        try {
            persist();
        } catch (final IOException e) {
            throw new InvocationTargetException(e, "Unable to persist the model.");
        }
    }
 
开发者ID:GRA-UML,项目名称:tool,代码行数:65,代码来源:TransformDelegate.java


示例11: runTransform

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
@Override
public final void runTransform(final Shell shell, final IProgressMonitor monitor) throws InvocationTargetException {
    final TransformationExecutor executor = new TransformationExecutor(transformationURI);

    final ExecutionContextImpl context = new ExecutionContextImpl();
    context.setLog(new ContextLog());
    context.setMonitor(new EvaluationMonitor() {

        @Override
        public boolean isCanceled() {
            return monitor.isCanceled();
        }

        @Override
        public void cancel() {
            monitor.setCanceled(true);
        }
    });

    for (final Entry<String, Object> configProperties : getConfigProperties().entrySet()) {
        context.setConfigProperty(configProperties.getKey(), configProperties.getValue());
    }

    resourceSet = createResourceSet();
    theSelectedResource = resourceSet.getResource(selection, true);

    final IStatus status = validate();
    if (!status.isOK() && !shouldContinue(shell, status)) {
        return;
    }

    final ModelExtent[] arguments = arguments();

    final Diagnostic diagnostic = executor.execute(context, arguments);

    if (diagnostic.getSeverity() == Diagnostic.ERROR) {
        throw diagnostic.getException() == null ? new InvocationTargetException(new RuntimeException(
                diagnostic.getMessage()), diagnostic.getMessage()) : new InvocationTargetException(
                diagnostic.getException(), diagnostic.getMessage());
    }
    postExecute();
    try {
        persist();
    } catch (final IOException e) {
        throw new InvocationTargetException(e, "Unable to persist the model.");
    }
}
 
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:48,代码来源:TransformDelegate.java


示例12: getTransformationExecutor

import org.eclipse.m2m.qvt.oml.TransformationExecutor; //导入依赖的package包/类
TransformationExecutor getTransformationExecutor(URI resourceURI) throws IOException; 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:2,代码来源:IQVTOTransformationExecutorProvider.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ButtonElement类代码示例发布时间:2022-05-23
下一篇:
Java Cas20ProtocolValidationSpecification类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap