Commit | Line | Data |
---|---|---|
0152140d | 1 | package org.eclipse.linuxtools.lttng.jni_v2_6; |
3b7509b0 WB |
2 | /******************************************************************************* |
3 | * Copyright (c) 2009 Ericsson | |
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 | |
12 | *******************************************************************************/ | |
0152140d ASL |
13 | |
14 | import org.eclipse.linuxtools.lttng.jni.JniTrace; | |
15 | import org.eclipse.linuxtools.lttng.jni.JniTracefile; | |
c85e8cb2 | 16 | import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id; |
0152140d ASL |
17 | import org.eclipse.linuxtools.lttng.jni.exception.JniException; |
18 | ||
3b7509b0 WB |
19 | /** |
20 | * <b><u>JniTrace_v2_6</u></b> | |
21 | * <p> | |
22 | * JniTrace version to support Lttng traceformat of version 2.6.<br> | |
23 | * This class extend abstract class JniTrace with (possibly) version specific implementation (none yet).<br> | |
24 | * | |
25 | * It also make sure the correct library is loaded by liblttvlibraryloader.so | |
26 | * <p> | |
27 | */ | |
0152140d ASL |
28 | public class JniTrace_v2_6 extends JniTrace { |
29 | ||
3b7509b0 WB |
30 | // This is the dynamic library name that is passed to the library loader (liblttvlibraryloader.so) to load. |
31 | // It needs to be a complete name, like "libXYZ.so", unlike java that would take "XYZ". It could also take a complete path. | |
32 | // The library need to be accessible, i.e. LD_LIBRARY_PATH need to be set correctly. | |
3b38ea61 | 33 | private static final String LIBRARY_NAME = "liblttvtraceread-2.6.so"; //$NON-NLS-1$ |
0152140d | 34 | |
3b7509b0 WB |
35 | /* |
36 | * Forbid access to the default constructor | |
37 | */ | |
0152140d ASL |
38 | protected JniTrace_v2_6() { |
39 | super(); | |
40 | } | |
41 | ||
3b7509b0 | 42 | |
0152140d ASL |
43 | public JniTrace_v2_6(String newpath) throws JniException { |
44 | super(newpath); | |
45 | } | |
46 | ||
47 | public JniTrace_v2_6(String newpath, boolean newPrintDebug) throws JniException { | |
48 | super(newpath, newPrintDebug); | |
49 | } | |
50 | ||
51 | public JniTrace_v2_6(JniTrace_v2_6 oldTrace) { | |
52 | super(oldTrace); | |
53 | } | |
54 | ||
c85e8cb2 | 55 | public JniTrace_v2_6(Jni_C_Pointer_And_Library_Id newPtr, boolean newPrintDebug) throws JniException { |
0152140d ASL |
56 | super(newPtr, newPrintDebug); |
57 | } | |
58 | ||
59 | ||
3b7509b0 WB |
60 | /** |
61 | * Initialize the C library.<p> | |
62 | * | |
63 | * Call the library loader with the .so we wish to load. | |
64 | * | |
65 | * @return True if the load went successful, false otherwise. | |
66 | */ | |
b9fb2d51 | 67 | @Override |
c85e8cb2 | 68 | public int initializeLibrary() { |
687cc7e7 | 69 | return ltt_initializeHandle(LIBRARY_NAME); |
0152140d ASL |
70 | } |
71 | ||
3b7509b0 WB |
72 | |
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 | } |