本文整理汇总了Java中net.ssehub.easy.instantiation.core.model.execution.TracerFactory类的典型用法代码示例。如果您正苦于以下问题:Java TracerFactory类的具体用法?Java TracerFactory怎么用?Java TracerFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TracerFactory类属于net.ssehub.easy.instantiation.core.model.execution包,在下文中一共展示了TracerFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* Initializes the repository connector. This is done automatically on first access, but shall be done during
* layer startup.
*/
public static void initialize() {
if (null == loader) {
// start up EASy
try {
QmLogging.setLogLevel(Level.INFO);
QmLogging.disableUnwantedLogging();
//QmLogging.setLogLevel("org.eclipse.xtext.service.BindModule", Level.INFO);
loader = new ListLoader();
loader.setVerbose(false);
loader.startup();
} catch (IOException e) {
getLogger().error(e.getMessage());
}
if (readModels()) {
// set tracing
TracerFactory.setDefaultInstance(TracerFactory.DEFAULT);
}
}
}
示例2: executeScript
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* Creates a VIL executor for the contained PLP.
*
* @param artifactsFolder the name of the folder in testdata
* @param script the script
* @param targetFile the target directory
*
* @throws ModelManagementException
* @throws VilException
*/
private void executeScript(String artifactsFolder, File script, File targetFile) throws
ModelManagementException,
VilException {
// final File base = new File(getArtifactsFolder(), artifactsFolder);
// final File script = new File(getArtifactsFolder(), script);
// execute
//System.out.println(script.getAbsolutePath());
String scriptName = script.getName().replaceAll(".vil", "");
ProjectDescriptor source = new ProjectDescriptor(script.getAbsolutePath(), scriptName);
ProjectDescriptor target = new ProjectDescriptor(source, targetFile);
TracerFactory.setDefaultInstance(ConsoleTracerFactory.INSTANCE);
Executor executor = new Executor(source.getMainVilScript()).addSource(source).addTarget(target)
.addConfiguration(ProjectDescriptor.getConfiguration(scriptName));
executor.execute();
}
示例3: visitValueAssignmentExpression
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
@Override
public Object visitValueAssignmentExpression(ValueAssignmentExpression ex) throws VilException {
Object result;
VariableDeclaration var = ex.getVarDecl();
FieldDescriptor field = ex.getField();
Object val = ex.getValueExpression().accept(this);
if (null != val) {
try {
if (null != field) {
field.setValue(environment.getValue(var), val);
} else {
environment.setValue(var, val);
}
notifyValueDefined(var, field, val);
result = Boolean.TRUE;
} catch (VilException e) {
result = null;
TracerFactory.createInstantiatorTracer().traceError(e.getMessage());
}
} else {
result = null; // undefined
}
return result;
}
示例4: visitFieldAccessExpression
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
@Override
public Object visitFieldAccessExpression(FieldAccessExpression ex) throws VilException {
Object result = null;
try {
Object ownerValue;
if (null != ex.getVariable()) {
ownerValue = environment.getValue(ex.getVariable());
} else {
if (null == ex.getNested()) { // static -> variable == null
ownerValue = null;
} else {
ownerValue = ex.getNested().accept(this);
}
}
if (ex.isMetaAccess()) {
result = ex.getField().getMetaValue(ownerValue);
} else {
result = ex.getField().getValue(ownerValue);
}
} catch (VilException e) {
// -> undefined
TracerFactory.createInstantiatorTracer().traceError(e.getMessage());
}
return result;
}
示例5: visitRule
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
@Override
public Object visitRule(VtlRule rule) throws VilException {
net.ssehub.easy.instantiation.core.model.templateModel.ITracer tracer
= TracerFactory.createTemplateLanguageTracer();
TracerFactory.registerTemplateLanguageTracer(tracer);
Writer writer = new NullWriter(); // not for reuse
Map<String, Object> localParam = new HashMap<String, Object>(); // by default
localParam.put(PARAM_CONFIG, environment.getTopLevelConfiguration());
localParam.put(PARAM_TARGET, null); // for now
TemplateLangExecution exec = new TemplateLangExecution(tracer, writer, localParam);
Def def = rule.getDef();
Template template = (Template) def.getParent();
exec.getRuntimeEnvironment().switchContext(template);
exec.visitModelHeader(template);
Object result = def.accept(exec);
TracerFactory.unregisterTemplateLanguageTracer(tracer);
return result;
}
示例6: handleMessages
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* Handles AspectJ messages.
*
* @param handler the message handler
* @throws VilException in case that abort of processing is needed
*/
private static void handleMessages(MessageHandler handler) throws VilException {
IInstantiatorTracer tracer = TracerFactory.createInstantiatorTracer();
for (IMessage msg : handler.getUnmodifiableListView()) {
if (msg.isDebug() || msg.isInfo() || msg.isWarning()) {
tracer.traceMessage(msg.getMessage());
} else {
tracer.traceError(msg.getMessage());
}
}
if (handler.getErrors().length > 0) {
StringBuilder tmp = new StringBuilder();
for (IMessage message : handler.getMessages(null, true)) {
tmp.append(message.toString());
tmp.append("\r\n");
}
throw new VilException(tmp.toString(), VilException.ID_RUNTIME_EXECUTION);
}
}
示例7: testJavaDebug
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* For developing modified Java templates.
*
* @throws IOException shall not occur
*/
//@Ignore("just for development/debugging")
@Test
public void testJavaDebug() throws IOException {
TracerFactory.setInstance(new ConsoleTracerFactory(true));
String[] names = new String[3];
names[0] = "javaExperiments";
names[1] = "javaExperiments";
names[2] = "javaExperimentsDebug";
// no reasoning: we just need specific structures/values
File tmp = executeCase(names, null, "", null, false);
File expected = new File(tmp, "PriorityPip_DataManagementElement0DataManagementElement.java");
TextTestUtils.assertFileEquality(new File(tmp, "PrioPip_DME.java"), expected);
TextTestUtils.assertFileEquality(new File(tmp, "PrioPip_DME0.java"), expected);
TextTestUtils.assertFileEquality(new File(tmp, "PrioPip_DME1.java"), expected);
}
示例8: setTracerFactory
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* Sets the tracer factory.
*
* @return <code>true</code> if logging/tracing is enabled, <code>false</code> else
*/
private static boolean setTracerFactory() {
boolean log = AdaptationConfiguration.enableAdaptationRtVilLogging();
if (log) {
if (!setConfiguredTracerFactory()) {
TracerFactory.setInstance(ConsoleTracerFactory.INSTANCE); // thread-based setting
}
} else {
setConfiguredTracerFactory();
}
return log;
}
示例9: createProfilePipeline
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* Profiles the given algorithm. Create a specific pipeline with data source, specific family holding
* only the test algorithm. Stores data and control file into <code>source</code>.
*
* @param config the configuration to be used as basis for creating a profiling pipeline
* @param pipelineName the name of the pipeline to be created (must be a valid Java identifier)
* @param familyName the name of the family to test
* @param algorithmName the name of the algorithm within <code>family</code> to test
* @param source the source project descriptor, also to be used as target folder for instantiation (the folder may
* be empty)
* @return pipeline information
* @throws VilException in case of model query problems, model management problems, CST errors, unmatching IVML
* values or VIL execution errors
*/
@QMInternal
public static ProfileData createProfilePipeline(net.ssehub.easy.varModel.confModel.Configuration config,
String pipelineName, String familyName, String algorithmName, IProjectDescriptor source) throws VilException {
ProfileData result = null;
if (null == config.getProject()) {
throw new VilException("no project available - syntax/parsing error?", VilException.ID_INVALID);
}
try {
Project qm = createNewRoot(config, pipelineName, familyName, algorithmName);
Configuration cfg = new Configuration(qm);
TracerFactory.setInstance(ConsoleTracerFactory.INSTANCE); // clear thread specific instance
StandaloneProjectDescriptor target = new StandaloneProjectDescriptor(source, source.getBase());
Executor executor = new Executor(source.getMainVilScript())
.addSource(source).addTarget(target)
.addConfiguration(cfg)
.addCustomArgument("pipelineName", pipelineName)
.addStartRuleName("pipeline");
executor.execute();
TracerFactory.setInstance(null); // clear thread specific instance
File base = source.getBase();
Compound familyType = findCompound(qm, TYPE_FAMILY);
IDecisionVariable testFamily = findNamedVariable(config, familyType, familyName);
IDecisionVariable testAlgorithm = Configuration.dereference(findAlgorithm(testFamily, algorithmName, true));
String algArtifact = VariableHelper.getString(testAlgorithm, SLOT_ALGORITHM_ARTIFACT);
extractProfilingArtifact(algArtifact, algorithmName, base);
File pipFile = new File(base, "pipelines/eu/qualimaster/" + pipelineName + "/target/" + pipelineName
+ "-" + PIP_VERSION + "-jar-with-dependencies.jar");
File dataFile = getDataFile(base);
File controlFile = getControlFile(base);
result = new ProfileData(pipelineName, pipFile, dataFile, controlFile);
} catch (ModelQueryException | ModelManagementException | ValueDoesNotMatchTypeException
| CSTSemanticException e) {
throw new VilException(e.getMessage(), VilException.ID_RUNTIME);
}
return result;
}
示例10: enableTracing
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* Enables or disables tracing on registered tracers for this thread.
*
* @param enable enable or disable
*/
public static void enableTracing(boolean enable) {
net.ssehub.easy.instantiation.core.model.buildlangModel.ITracer bTracer
= TracerFactory.getRegisteredBuildLanguageTracer();
if (null != bTracer) {
bTracer.enable(enable);
}
net.ssehub.easy.instantiation.core.model.templateModel.ITracer tTracer
= TracerFactory.getRegisteredTemplateLanguageTracer();
if (null != tTracer) {
tTracer.enable(enable);
}
}
示例11: getCurrentTracer
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* Returns the current tracer for this thread.
*
* @return the current tracer (may be <b>null</b>)
*/
public static ITracer getCurrentTracer() {
// more specific one / nested one goes first
ITracer tracer = TracerFactory.getRegisteredTemplateLanguageTracer();
if (null == tracer) {
tracer = TracerFactory.getRegisteredBuildLanguageTracer();
}
return tracer;
}
示例12: run
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
@Override
public void run() {
TracerFactory.setInstance(tracers); // set thread-based
IInstantiatorTracer tracer = TracerFactory.createInstantiatorTracer();
try {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
if (null != manipulator) {
line = manipulator.manipulate(line);
}
if (null != line) {
if (isErrorStream) {
tracer.traceError(line);
} else {
tracer.traceMessage(line);
}
}
}
} catch (EOFException eof) {
// ok, terminate
} catch (IOException ioe) {
EASyLoggerFactory.INSTANCE.getLogger(StreamGobbler.class, Bundle.ID).exception(ioe);
} finally {
TracerFactory.setInstance(null); // reset thread-based
}
}
示例13: earlyStartup
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
@Override
public void earlyStartup() {
IWorkbench workbench = PlatformUI.getWorkbench();
workbench.getDisplay().syncExec(new Runnable() {
public void run() {
// I would expect the following line to be part of the startup of EASy core
EASyLogger logger = EASyLoggerFactory.INSTANCE.getLogger(Startup.class,
"de.uni_hildesheim.sse.easy.ui");
logger.info("EASy-Producer 2.0 is up and running...");
ResourcesMgmt.INSTANCE.findPLProjects();
}
});
// Register the observer for sending messages to the console of the running Eclipse-instance.
TracerFactory.setDefaultInstance(GuiTracerFactory.INSTANCE);
}
示例14: TimeMeasurementTracerFactory
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
/**
* Default constructor for on-demand class loading with no tracing.
*/
public TimeMeasurementTracerFactory() {
this(TracerFactory.DEFAULT);
}
示例15: createTestTracerFactory
import net.ssehub.easy.instantiation.core.model.execution.TracerFactory; //导入依赖的package包/类
@Override
public TracerFactory createTestTracerFactory(Writer trace, String[] baseFolders) {
return new TestTracerFactory(trace, baseFolders);
}