Skip to main content
summaryrefslogtreecommitdiffstats
blob: 5794d57dc5ff443b2c66c2c38d4a8a9a6a98e412 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package org.eclipse.linuxtools.lttng.jni_v2_3;
/*******************************************************************************
 * 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.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;

/**
 * <b><u>JniTrace_v2_3</u></b>
 * <p>
 * JniTrace version to support Lttng traceformat of version 2.3.<br>
 * This class extend abstract class JniTrace with (possibly) version specific implementation.<br>
 *  
 * It also make sure the correct library is loaded by liblttvlibraryloader.so 
 * <p>
 */
public class JniTrace_v2_3 extends JniTrace {
	
	// This is the dynamic library name that is passed to the library loader (liblttvlibraryloader.so) to load.
	// It needs to be a complete name, like "libXYZ.so", unlike java that would take "XYZ". It could also take a complete path.
	//	The library need to be accessible, i.e. LD_LIBRARY_PATH need to be set correctly. 
	private static final String LIBRARY_NAME = "liblttvtraceread-2.3.so";
	
	/*
	 * Forbid access to the default constructor
	 */
	protected JniTrace_v2_3() {
		super();
    }
    
	
	public JniTrace_v2_3(String newpath) throws JniException {
		super(newpath);
	}
	
    public JniTrace_v2_3(String newpath, boolean newPrintDebug) throws JniException {
    	super(newpath, newPrintDebug);
    }
    
    
    public JniTrace_v2_3(JniTrace_v2_3 oldTrace) {
    	super(oldTrace);
    }        
    
    public JniTrace_v2_3(Jni_C_Pointer_And_Library_Id newPtr, boolean newPrintDebug) throws JniException {
    	super(newPtr, newPrintDebug);
    }
    
    
    /**
     * Initialize the C library.<p>
     * 
     * Call the library loader with the .so we wish to load.
     * 
     * @return 	The library id if sucessful, -1 if something went wrong
     */
    @Override
	public int initializeLibrary() {
    	return ltt_initializeHandle(LIBRARY_NAME);
    }
    
    
    /**
     * Allocate (call constructor for) a new JniTracefile.<p>
     * 
     * This method is made to bypass limitation related to abstract class, see comment in JniTrace
     * 
     * @return JniTracefile 	a newly allocated JniTracefile
     * 
     * @see org.eclipse.linuxtools.lttng.jni.JniTrace
     */
    @Override
	public JniTracefile allocateNewJniTracefile(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
    	return new JniTracefile_v2_3(newPtr, newParentTrace);
    }
}

Back to the top