1 /*******************************************************************************
2 * Copyright (c) 2009,2010 Ericsson
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
10 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.core
.control
;
14 import java
.util
.HashMap
;
17 import org
.eclipse
.linuxtools
.lttng
.core
.event
.LttngSyntheticEvent
;
18 import org
.eclipse
.linuxtools
.lttng
.core
.model
.LTTngTreeNode
;
24 public class LttngCoreProviderFactory
{
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;
31 private static final Map
<Integer
, LttngSyntheticEventProvider
> fSyntheticEventProviders
= new HashMap
<Integer
, LttngSyntheticEventProvider
>();
34 * Pre-creates all known LTTng providers.
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
);
43 * Gets a SyntheticEventProvider for the given ID. It creates a new provider
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
);
54 return fSyntheticEventProviders
.get(Integer
.valueOf(providerId
));
58 * Resets all LTTngSytheticEventProviders associated with the given
61 * @param experimentNode
63 public static void reset(LTTngTreeNode experimentNode
) {
64 for (LttngSyntheticEventProvider provider
: fSyntheticEventProviders
.values()) {
65 provider
.reset(experimentNode
);