From 0fc6e419dee0c58ce037cd1ca8d8b0c3f556e957 Mon Sep 17 00:00:00 2001 From: William Bourque Date: Fri, 12 Mar 2010 17:44:07 +0000 Subject: [PATCH] Activate the support for multiple trace version (bug #302987) --- .../lttng/trace/LTTngTraceVersion.java | 84 +------------------ 1 file changed, 3 insertions(+), 81 deletions(-) diff --git a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTraceVersion.java b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTraceVersion.java index 6c67e98d70..b3ec284cb0 100644 --- a/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTraceVersion.java +++ b/org.eclipse.linuxtools.lttng/src/org/eclipse/linuxtools/lttng/trace/LTTngTraceVersion.java @@ -1,47 +1,19 @@ package org.eclipse.linuxtools.lttng.trace; -/******************************************************************************* - * Copyright (c) 2009 Ericsson - * - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * William Bourque (wbourque@gmail.com) - Initial API and implementation - *******************************************************************************/ import org.eclipse.linuxtools.lttng.LttngException; import org.eclipse.linuxtools.lttng.jni.exception.JniTraceVersionException; import org.eclipse.linuxtools.lttng.jni.factory.JniTraceVersion; -/** - * LTTngTraceVersion

- * - * This class is responsible of handling the version number of a trace.

- * It will return the correct version number and validity information of a trace given its path.
- * - */ public class LTTngTraceVersion { private String tracepath = null; private JniTraceVersion traceVersion = new JniTraceVersion(); - /* - * Default constructor is forbidden - */ @SuppressWarnings("unused") private LTTngTraceVersion() { // Default constructor forbidden } - /** - * Default constructor, takes a tracepath as parameter. - * - * @param newPath (Valid) path to a LTTng trace directory. - * - * @throws LttngException Throwed if something go wrong (bad tracepath or the C library could not be loaded). - */ public LTTngTraceVersion(String newPath) throws LttngException { tracepath = newPath; @@ -49,68 +21,31 @@ public class LTTngTraceVersion { fillJniTraceVersion(tracepath); } - /* - * Fill (load version numbers) into the JniTraceVersion object.

- * This need to be done each time the tracepath is changed. - * - * @param newTracepath (Valid) path to a LTTng trace directory. - * - * @throws LttngException If something go wrong (bad tracepath or the C library could not be loaded). - * - * @see org.eclipse.linuxtools.lttng.jni.factory.JniTraceVersion - */ private void fillJniTraceVersion(String newTracepath) throws LttngException { try { - traceVersion.readVersionFromTrace(newTracepath); + traceVersion.readVersionNumber(newTracepath); } catch (JniTraceVersionException e) { - throw new LttngException( e.toString() ); + throw new LttngException("Could not get trace version!\nReturned error was : " + e.toString() + " (fillJniTraceVersion)"); } } - /** - * Get for the full version number as String - * - * @return version number as String - */ public String getTraceVersionString() { - return traceVersion.getVersionAsString(); + return traceVersion.toString(); } - /** - * Get for the major version number - * - * @return major version number as int - */ public int getTraceMinorVersion() { return traceVersion.getMinor(); } - /** - * Get for the minor version number - * - * @return minor version number as int - */ public int getTraceMajorVersion() { return traceVersion.getMajor(); } - /** - * Get for the full version number as float - * - * @return version number as float - */ public float getTraceFloatVersion() { return traceVersion.getVersionAsFloat(); } - /** - * Verify is the currently loaded path was a valid LTTng tracepath.

- * - * Internally, the version number will be checked, any number <= 0 is expected to be wrong. - * - * @return A boolean saying if the tracepath appears to be valid or not. - */ public boolean isValidLttngTrace() { if ( traceVersion.getVersionAsFloat() > 0 ) { return true; @@ -120,23 +55,10 @@ public class LTTngTraceVersion { } } - /** - * Get for the currently loaded tracepath - * - * @return the tracepath currently in use - */ public String getTracepath() { return tracepath; } - /** - * Set a new tracepath

- * - * Note : Setting this will load the new version information into memory.
- * Errors will be catched but a warning will be printed if something go wrong. - * - * @param newTracepath The new tracepath to set. - */ public void setTracepath(String newTracepath) { try { fillJniTraceVersion(newTracepath); -- 2.34.1