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


Java Log类代码示例

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


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

示例1: build

import org.eclipse.m2m.qvt.oml.util.Log; //导入依赖的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

示例2: build

import org.eclipse.m2m.qvt.oml.util.Log; //导入依赖的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


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