Commit | Line | Data |
---|---|---|
ce38c104 | 1 | package org.eclipse.linuxtools.internal.lttng.jni_v2_6; |
3b7509b0 | 2 | /******************************************************************************* |
a3767fd9 | 3 | * Copyright (c) 2009, 2011 Ericsson, MontaVista Software |
3b7509b0 WB |
4 | * |
5 | * All rights reserved. This program and the accompanying materials are | |
6 | * made available under the terms of the Eclipse Public License v1.0 which | |
7 | * accompanies this distribution, and is available at | |
8 | * http://www.eclipse.org/legal/epl-v10.html | |
9 | * | |
10 | * Contributors: | |
11 | * William Bourque (wbourque@gmail.com) - Initial API and implementation | |
a3767fd9 | 12 | * Yufen Kuo (ykuo@mvista.com) - add support to allow user specify trace library path |
c9eef0da | 13 | * Yufen Kuo (ykuo@mvista.com) - bug 340341: handle gracefully when native library failed to initialize |
3b7509b0 | 14 | *******************************************************************************/ |
0152140d | 15 | |
ce38c104 FC |
16 | import org.eclipse.linuxtools.internal.lttng.jni.common.Jni_C_Pointer_And_Library_Id; |
17 | import org.eclipse.linuxtools.internal.lttng.jni.exception.JniException; | |
0152140d ASL |
18 | import org.eclipse.linuxtools.lttng.jni.JniTrace; |
19 | import org.eclipse.linuxtools.lttng.jni.JniTracefile; | |
0152140d | 20 | |
3b7509b0 WB |
21 | /** |
22 | * <b><u>JniTrace_v2_6</u></b> | |
23 | * <p> | |
24 | * JniTrace version to support Lttng traceformat of version 2.6.<br> | |
25 | * This class extend abstract class JniTrace with (possibly) version specific implementation (none yet).<br> | |
26 | * | |
27 | * It also make sure the correct library is loaded by liblttvlibraryloader.so | |
28 | * <p> | |
29 | */ | |
0152140d ASL |
30 | public class JniTrace_v2_6 extends JniTrace { |
31 | ||
3b7509b0 WB |
32 | // This is the dynamic library name that is passed to the library loader (liblttvlibraryloader.so) to load. |
33 | // It needs to be a complete name, like "libXYZ.so", unlike java that would take "XYZ". It could also take a complete path. | |
34 | // The library need to be accessible, i.e. LD_LIBRARY_PATH need to be set correctly. | |
3b38ea61 | 35 | private static final String LIBRARY_NAME = "liblttvtraceread-2.6.so"; //$NON-NLS-1$ |
0152140d | 36 | |
3b7509b0 WB |
37 | /* |
38 | * Forbid access to the default constructor | |
39 | */ | |
0152140d ASL |
40 | protected JniTrace_v2_6() { |
41 | super(); | |
42 | } | |
3b7509b0 | 43 | |
0152140d ASL |
44 | public JniTrace_v2_6(String newpath) throws JniException { |
45 | super(newpath); | |
46 | } | |
47 | ||
48 | public JniTrace_v2_6(String newpath, boolean newPrintDebug) throws JniException { | |
49 | super(newpath, newPrintDebug); | |
50 | } | |
51 | ||
52 | public JniTrace_v2_6(JniTrace_v2_6 oldTrace) { | |
53 | super(oldTrace); | |
e4dc0a9a | 54 | } |
0152140d | 55 | |
c85e8cb2 | 56 | public JniTrace_v2_6(Jni_C_Pointer_And_Library_Id newPtr, boolean newPrintDebug) throws JniException { |
0152140d ASL |
57 | super(newPtr, newPrintDebug); |
58 | } | |
c9eef0da | 59 | |
3b7509b0 | 60 | /** |
c9eef0da FC |
61 | * Get the trace library name |
62 | * <p> | |
3b7509b0 | 63 | * |
c9eef0da | 64 | * Get the version specific native trace library name |
3b7509b0 | 65 | * |
c9eef0da | 66 | * @return The native trace library name |
3b7509b0 | 67 | */ |
b9fb2d51 | 68 | @Override |
c9eef0da FC |
69 | public String getTraceLibName() { |
70 | return LIBRARY_NAME; | |
0152140d ASL |
71 | } |
72 | ||
3b7509b0 WB |
73 | /** |
74 | * Allocate (call constructor for) a new JniTracefile.<p> | |
75 | * | |
76 | * This method is made to bypass limitation related to abstract class, see comment in JniTrace | |
77 | * | |
78 | * @return JniTracefile a newly allocated JniTracefile | |
79 | * | |
80 | * @see org.eclipse.linuxtools.lttng.jni.JniTrace | |
81 | */ | |
b9fb2d51 | 82 | @Override |
c85e8cb2 | 83 | public JniTracefile allocateNewJniTracefile(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException { |
0152140d ASL |
84 | return new JniTracefile_v2_6(newPtr, newParentTrace); |
85 | } | |
86 | } |