Commit | Line | Data |
---|---|---|
79b33284 | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2012, 2014 Ericsson |
11252342 | 3 | * |
79b33284 FC |
4 | * All rights reserved. This program and the accompanying materials are |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
11252342 | 8 | * |
79b33284 FC |
9 | * Contributors: |
10 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
9bc60be7 | 13 | package org.eclipse.tracecompass.internal.lttng2.kernel.core; |
79b33284 | 14 | |
9fa32496 | 15 | import org.eclipse.core.runtime.IStatus; |
79b33284 | 16 | import org.eclipse.core.runtime.Plugin; |
9fa32496 | 17 | import org.eclipse.core.runtime.Status; |
dc327459 GB |
18 | import org.eclipse.tracecompass.internal.lttng2.kernel.core.event.matching.TcpEventMatching; |
19 | import org.eclipse.tracecompass.internal.lttng2.kernel.core.event.matching.TcpLttngEventMatching; | |
2bdf0193 | 20 | import org.eclipse.tracecompass.tmf.core.event.matching.TmfEventMatching; |
79b33284 FC |
21 | import org.osgi.framework.BundleContext; |
22 | ||
23 | /** | |
24 | * <b><u>Activator</u></b> | |
25 | * <p> | |
26 | * The activator class controls the plug-in life cycle | |
27 | */ | |
28 | public class Activator extends Plugin { | |
29 | ||
30 | // ------------------------------------------------------------------------ | |
31 | // Attributes | |
32 | // ------------------------------------------------------------------------ | |
33 | ||
11252342 AM |
34 | /** |
35 | * The plug-in ID | |
36 | */ | |
37 | public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng2.core"; //$NON-NLS-1$ | |
38 | ||
39 | /** | |
40 | * The shared instance | |
41 | */ | |
42 | private static Activator plugin; | |
79b33284 | 43 | |
79b33284 FC |
44 | // ------------------------------------------------------------------------ |
45 | // Constructors | |
46 | // ------------------------------------------------------------------------ | |
47 | ||
11252342 AM |
48 | /** |
49 | * The constructor | |
50 | */ | |
51 | public Activator() { | |
52 | } | |
79b33284 FC |
53 | |
54 | // ------------------------------------------------------------------------ | |
55 | // Accessors | |
56 | // ------------------------------------------------------------------------ | |
57 | ||
11252342 AM |
58 | /** |
59 | * Returns the shared instance | |
60 | * | |
61 | * @return the shared instance | |
62 | */ | |
63 | public static Activator getDefault() { | |
64 | return plugin; | |
65 | } | |
79b33284 FC |
66 | |
67 | // ------------------------------------------------------------------------ | |
68 | // Operators | |
69 | // ------------------------------------------------------------------------ | |
70 | ||
11252342 AM |
71 | @Override |
72 | public void start(BundleContext context) throws Exception { | |
73 | super.start(context); | |
74 | plugin = this; | |
e73a4ba5 GB |
75 | TmfEventMatching.registerMatchObject(new TcpEventMatching()); |
76 | TmfEventMatching.registerMatchObject(new TcpLttngEventMatching()); | |
11252342 AM |
77 | } |
78 | ||
79 | @Override | |
80 | public void stop(BundleContext context) throws Exception { | |
81 | plugin = null; | |
82 | super.stop(context); | |
83 | } | |
84 | ||
9fa32496 BH |
85 | /** |
86 | * Logs a message with severity INFO in the runtime log of the plug-in. | |
11252342 | 87 | * |
9fa32496 BH |
88 | * @param message A message to log |
89 | */ | |
90 | public void logInfo(String message) { | |
91 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message)); | |
92 | } | |
11252342 | 93 | |
9fa32496 BH |
94 | /** |
95 | * Logs a message and exception with severity INFO in the runtime log of the plug-in. | |
11252342 | 96 | * |
9fa32496 BH |
97 | * @param message A message to log |
98 | * @param exception A exception to log | |
99 | */ | |
100 | public void logInfo(String message, Throwable exception) { | |
101 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception)); | |
102 | } | |
103 | ||
104 | /** | |
105 | * Logs a message and exception with severity WARNING in the runtime log of the plug-in. | |
11252342 | 106 | * |
9fa32496 BH |
107 | * @param message A message to log |
108 | */ | |
109 | public void logWarning(String message) { | |
110 | getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message)); | |
111 | } | |
11252342 | 112 | |
9fa32496 BH |
113 | /** |
114 | * Logs a message and exception with severity WARNING in the runtime log of the plug-in. | |
11252342 | 115 | * |
9fa32496 BH |
116 | * @param message A message to log |
117 | * @param exception A exception to log | |
118 | */ | |
119 | public void logWarning(String message, Throwable exception) { | |
120 | getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception)); | |
121 | } | |
122 | ||
123 | /** | |
124 | * Logs a message and exception with severity ERROR in the runtime log of the plug-in. | |
11252342 | 125 | * |
9fa32496 BH |
126 | * @param message A message to log |
127 | */ | |
128 | public void logError(String message) { | |
129 | getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message)); | |
130 | } | |
11252342 | 131 | |
9fa32496 BH |
132 | /** |
133 | * Logs a message and exception with severity ERROR in the runtime log of the plug-in. | |
11252342 | 134 | * |
9fa32496 BH |
135 | * @param message A message to log |
136 | * @param exception A exception to log | |
137 | */ | |
138 | public void logError(String message, Throwable exception) { | |
139 | getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception)); | |
140 | } | |
79b33284 FC |
141 | |
142 | } |