1 package org
.eclipse
.linuxtools
.lttng
.jni_v2_5
;
2 /*******************************************************************************
3 * Copyright (c) 2009, 2011 Ericsson, MontaVista Software
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
11 * William Bourque (wbourque@gmail.com) - Initial API and implementation
12 * Yufen Kuo (ykuo@mvista.com) - add support to allow user specify trace library path
13 *******************************************************************************/
15 import org
.eclipse
.core
.runtime
.IPath
;
16 import org
.eclipse
.core
.runtime
.Path
;
17 import org
.eclipse
.linuxtools
.lttng
.jni
.JniTrace
;
18 import org
.eclipse
.linuxtools
.lttng
.jni
.JniTracefile
;
19 import org
.eclipse
.linuxtools
.lttng
.jni
.common
.Jni_C_Pointer_And_Library_Id
;
20 import org
.eclipse
.linuxtools
.lttng
.jni
.exception
.JniException
;
23 * <b><u>JniTrace_v2_5</u></b>
25 * JniTrace version to support Lttng traceformat of version 2.5.<br>
26 * This class extend abstract class JniTrace with (possibly) version specific implementation (none yet).<br>
28 * It also make sure the correct library is loaded by liblttvlibraryloader.so
31 public class JniTrace_v2_5
extends JniTrace
{
33 // This is the dynamic library name that is passed to the library loader (liblttvlibraryloader.so) to load.
34 // It needs to be a complete name, like "libXYZ.so", unlike java that would take "XYZ". It could also take a complete path.
35 // The library need to be accessible, i.e. LD_LIBRARY_PATH need to be set correctly.
36 private static final String LIBRARY_NAME
= "liblttvtraceread-2.5.so"; //$NON-NLS-1$
39 * Forbid access to the default constructor
41 protected JniTrace_v2_5() {
46 public JniTrace_v2_5(String newpath
) throws JniException
{
50 public JniTrace_v2_5(String newpath
, boolean newPrintDebug
) throws JniException
{
51 super(newpath
, newPrintDebug
);
55 public JniTrace_v2_5(JniTrace_v2_5 oldTrace
) {
59 public JniTrace_v2_5(Jni_C_Pointer_And_Library_Id newPtr
, boolean newPrintDebug
) throws JniException
{
60 super(newPtr
, newPrintDebug
);
65 * Initialize the C library.<p>
67 * Call the library loader with the .so we wish to load.
69 * @return True if the load went successful, false otherwise.
72 public int initializeLibrary() {
73 if (getTraceLibPath() == null)
74 return ltt_initializeHandle(LIBRARY_NAME
);
76 IPath path
= new Path(getTraceLibPath());
77 IPath traceLib
= path
.append(LIBRARY_NAME
);
78 return ltt_initializeHandle(traceLib
.toOSString());
83 * Allocate (call constructor for) a new JniTracefile.<p>
85 * This method is made to bypass limitation related to abstract class, see comment in JniTrace
87 * @return JniTracefile a newly allocated JniTracefile
89 * @see org.eclipse.linuxtools.lttng.jni.JniTrace
92 public JniTracefile
allocateNewJniTracefile(Jni_C_Pointer_And_Library_Id newPtr
, JniTrace newParentTrace
) throws JniException
{
93 return new JniTracefile_v2_5(newPtr
, newParentTrace
);