Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.core / src / org / eclipse / linuxtools / lttng / control / LttngCoreProviderFactory.java
CommitLineData
5d10d135
ASL
1/*******************************************************************************
2 * Copyright (c) 2009,2010 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12package org.eclipse.linuxtools.lttng.control;
13
c1c69938
FC
14import java.util.HashMap;
15import java.util.Map;
16
5d10d135 17import org.eclipse.linuxtools.lttng.event.LttngSyntheticEvent;
c1c69938 18import org.eclipse.linuxtools.lttng.model.LTTngTreeNode;
5d10d135
ASL
19
20/**
21 * @author alvaro
22 *
23 */
24public class LttngCoreProviderFactory {
25
c1c69938
FC
26 // List of provider IDs
27 public static final int STATISTICS_LTTNG_SYTH_EVENT_PROVIDER = 0;
28 public static final int CONTROL_FLOW_LTTNG_SYTH_EVENT_PROVIDER = 1;
29 public static final int RESOURCE_LTTNG_SYTH_EVENT_PROVIDER = 2;
30
31 private static final Map<Integer, LttngSyntheticEventProvider> fSyntheticEventProviders = new HashMap<Integer, LttngSyntheticEventProvider>();
32
33 /**
34 * Pre-creates all known LTTng providers.
35 */
36 public static void initialize() {
37 getEventProvider(STATISTICS_LTTNG_SYTH_EVENT_PROVIDER);
38 getEventProvider(CONTROL_FLOW_LTTNG_SYTH_EVENT_PROVIDER);
39 getEventProvider(RESOURCE_LTTNG_SYTH_EVENT_PROVIDER);
40 }
41
42 /**
43 * Gets a SyntheticEventProvider for the given ID. It creates a new provider
44 * if necessary
45 *
46 * @param providerId
47 * @return
48 */
49 public static LttngSyntheticEventProvider getEventProvider(int providerId) {
50 if (!fSyntheticEventProviders.containsKey(Integer.valueOf(providerId))) {
51 LttngSyntheticEventProvider synEventProvider = new LttngSyntheticEventProvider(LttngSyntheticEvent.class);
52 fSyntheticEventProviders.put(Integer.valueOf(providerId), synEventProvider);
53 }
54 return fSyntheticEventProviders.get(Integer.valueOf(providerId));
55 }
5d10d135 56
c1c69938
FC
57 /**
58 * Resets all LTTngSytheticEventProviders associated with the given
59 * Experiment
60 *
61 * @param experimentNode
62 */
63 public static void reset(LTTngTreeNode experimentNode) {
64 for (LttngSyntheticEventProvider provider : fSyntheticEventProviders.values()) {
65 provider.reset(experimentNode);
66 }
67 }
5d10d135 68}
This page took 0.032793 seconds and 5 git commands to generate.