~ubuntu-branches/ubuntu/trusty/eclipse-linuxtools/trusty

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.lttng.jni/src/org/eclipse/linuxtools/internal/lttng/jni_v2_5/JniTrace_v2_5.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2012-06-29 12:07:30 UTC
  • Revision ID: package-import@ubuntu.com-20120629120730-bfri1xys1i71dpn6
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.eclipse.linuxtools.internal.lttng.jni_v2_5;
 
2
/*******************************************************************************
 
3
 * Copyright (c) 2009, 2011 Ericsson, MontaVista Software
 
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
 *   Yufen Kuo       (ykuo@mvista.com) - add support to allow user specify trace library path
 
13
 *   Yufen Kuo       (ykuo@mvista.com) - bug 340341: handle gracefully when native library failed to initialize
 
14
 *******************************************************************************/
 
15
 
 
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;
 
18
import org.eclipse.linuxtools.lttng.jni.JniTrace;
 
19
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
 
20
 
 
21
/**
 
22
 * <b><u>JniTrace_v2_5</u></b>
 
23
 * <p>
 
24
 * JniTrace version to support Lttng traceformat of version 2.5.<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
 */
 
30
public class JniTrace_v2_5 extends JniTrace {
 
31
        
 
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. 
 
35
        private static final String LIBRARY_NAME = "liblttvtraceread-2.5.so"; //$NON-NLS-1$
 
36
        
 
37
        /*
 
38
         * Forbid access to the default constructor
 
39
         */
 
40
        protected JniTrace_v2_5() {
 
41
                super();
 
42
    }
 
43
    
 
44
        
 
45
        public JniTrace_v2_5(String newpath) throws JniException {
 
46
                super(newpath);
 
47
        }
 
48
        
 
49
    public JniTrace_v2_5(String newpath, boolean newPrintDebug) throws JniException {
 
50
        super(newpath, newPrintDebug);
 
51
    }
 
52
    
 
53
    
 
54
    public JniTrace_v2_5(JniTrace_v2_5 oldTrace) {
 
55
        super(oldTrace);
 
56
    }        
 
57
    
 
58
    public JniTrace_v2_5(Jni_C_Pointer_And_Library_Id newPtr, boolean newPrintDebug) throws JniException {
 
59
        super(newPtr, newPrintDebug);
 
60
    }
 
61
    
 
62
    
 
63
    /**
 
64
     * Get the trace library name
 
65
     * <p>
 
66
     * 
 
67
     * Get the version specific native trace library name
 
68
     * 
 
69
     * @return The native trace library name
 
70
     */
 
71
    @Override
 
72
    public String getTraceLibName() {
 
73
        return LIBRARY_NAME;
 
74
    }
 
75
    
 
76
    /**
 
77
     * Allocate (call constructor for) a new JniTracefile.<p>
 
78
     * 
 
79
     * This method is made to bypass limitation related to abstract class, see comment in JniTrace
 
80
     * 
 
81
     * @return JniTracefile     a newly allocated JniTracefile
 
82
     * 
 
83
     * @see org.eclipse.linuxtools.lttng.jni.JniTrace
 
84
     */
 
85
    @Override
 
86
        public JniTracefile allocateNewJniTracefile(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
 
87
        return new JniTracefile_v2_5(newPtr, newParentTrace);
 
88
    }
 
89
    
 
90
    
 
91
    
 
92
}