Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 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 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.state.model; | |
13 | ||
14 | import org.eclipse.linuxtools.lttng.state.LttngStateException; | |
8827c197 | 15 | import org.eclipse.linuxtools.lttng.state.resource.ILttngStateContext; |
5d10d135 ASL |
16 | |
17 | /** | |
18 | * Entry point to the package | |
19 | * | |
20 | * @author alvaro | |
21 | * | |
22 | */ | |
23 | public class StateModelFactory { | |
24 | ||
25 | // ======================================================================== | |
26 | // Methods | |
27 | // ======================================================================= | |
28 | ||
29 | /** | |
30 | * Return an instance of the entry class, the entry class contains | |
31 | * references to the internal model elements. | |
32 | * | |
33 | * One instance is expected to be created per LttngTrace. | |
34 | * | |
35 | * This method shall be used when a trace is not opened yet and will be | |
36 | * initialized later via the init() method. | |
37 | * | |
38 | * @return | |
39 | */ | |
40 | public static LttngTraceState getStateEntryInstance() { | |
41 | return new LttngTraceState(); | |
42 | } | |
43 | ||
44 | /** | |
45 | * Provide a LttngTraceState when the input data reference is known e.g. | |
46 | * when exchanging the State provider to check point clone. | |
47 | * | |
48 | * @return | |
49 | */ | |
50 | public static LttngTraceState getStateEntryInstance( | |
8827c197 | 51 | ILttngStateContext stateInputRef) { |
5d10d135 ASL |
52 | LttngTraceState traceState = new LttngTraceState(); |
53 | try { | |
54 | traceState.init(stateInputRef); | |
55 | } catch (LttngStateException e) { | |
56 | e.printStackTrace(); | |
57 | } | |
58 | return traceState; | |
59 | } | |
60 | } |