tmf: Internalize the state history storage backend
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.core / src / org / eclipse / linuxtools / lttng2 / kernel / core / trace / CtfKernelTrace.java
CommitLineData
11d6f468
AM
1/*******************************************************************************
2 * Copyright (c) 2012 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Alexandre Montplaisir - Initial API and implementation
11 ******************************************************************************/
12
13package org.eclipse.linuxtools.lttng2.kernel.core.trace;
14
15import java.io.File;
11d6f468
AM
16
17import org.eclipse.core.resources.IProject;
5e4bf87d 18import org.eclipse.core.resources.IResource;
e12ecd30 19import org.eclipse.core.runtime.CoreException;
dc0f7bfe 20import org.eclipse.linuxtools.internal.lttng2.kernel.core.stateprovider.CtfKernelStateInput;
e12ecd30 21import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
11d6f468
AM
22import org.eclipse.linuxtools.tmf.core.ctfadaptor.CtfTmfTrace;
23import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
18ab1d18 24import org.eclipse.linuxtools.tmf.core.statesystem.IStateChangeInput;
6e71ce46 25import org.eclipse.linuxtools.tmf.core.statesystem.StateSystemManager;
11d6f468
AM
26
27/**
28 * This is the specification of CtfTmfTrace for use with LTTng 2.x kernel
29 * traces. It uses the CtfKernelStateInput to generate the state history.
30 *
31 * @author alexmont
32 *
33 */
34public class CtfKernelTrace extends CtfTmfTrace {
35
e12ecd30
BH
36 /**
37 * The file name of the History Tree
38 */
39 public final static String HISTORY_TREE_FILE_NAME = "stateHistory.ht"; //$NON-NLS-1$
6752f420 40
11d6f468
AM
41 public CtfKernelTrace() {
42 super();
43 }
44
45 @Override
46 public boolean validate(final IProject project, final String path) {
47 if (!super.validate(project, path)) {
48 return false;
49 }
f483ae24 50 /* Add extra checks specific to kernel traces here */
11d6f468
AM
51 return true;
52 }
53
54 @Override
55 protected void buildStateSystem() throws TmfTraceException {
56 /* Set up the path to the history tree file we'll use */
6e71ce46 57 IResource resource = this.getResource();
e12ecd30
BH
58 String supplDirectory = null;
59
60 try {
61 // get the directory where the history file will be stored.
62 supplDirectory = resource.getPersistentProperty(TmfCommonConstants.TRACE_SUPPLEMENTARY_FOLDER);
63 } catch (CoreException e) {
9fa32496 64 throw new TmfTraceException(e.toString(), e);
e12ecd30
BH
65 }
66
67 final File htFile = new File(supplDirectory + File.separator + HISTORY_TREE_FILE_NAME);
6e71ce46 68 final IStateChangeInput htInput = new CtfKernelStateInput(this);
11d6f468 69
6e71ce46 70 this.ss = StateSystemManager.loadStateHistory(htFile, htInput);
11d6f468
AM
71 }
72}
This page took 0.028223 seconds and 5 git commands to generate.