4405a55e29ef9059df79dde302d78b4d816ce0b2
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core.tests / stubs / org / eclipse / tracecompass / statesystem / core / tests / stubs / backend / HistoryTreeBackendStub.java
1 /*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
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
10 package org.eclipse.tracecompass.statesystem.core.tests.stubs.backend;
11
12 import java.io.File;
13 import java.io.IOException;
14
15 import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HTConfig;
16 import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HistoryTree;
17 import org.eclipse.tracecompass.internal.statesystem.core.backend.historytree.HistoryTreeBackend;
18
19 /**
20 * Stub class for the {@link HistoryTreeBackend}. It creates a
21 * {@link HistoryTreeStub} to grant access to some protected methods.
22 *
23 * @author Geneviève Bastien
24 */
25 public class HistoryTreeBackendStub extends HistoryTreeBackend {
26
27 /**
28 * Constructor for new history files. Use this when creating a new history
29 * from scratch.
30 *
31 * @param ssid
32 * The state system's ID
33 * @param newStateFile
34 * The filename/location where to store the state history (Should
35 * end in .ht)
36 * @param providerVersion
37 * Version of of the state provider. We will only try to reopen
38 * existing files if this version matches the one in the
39 * framework.
40 * @param startTime
41 * The earliest time stamp that will be stored in the history
42 * @param blockSize
43 * The size of the blocks in the history file. This should be a
44 * multiple of 4096.
45 * @param maxChildren
46 * The maximum number of children each core node can have
47 * @throws IOException
48 * Thrown if we can't create the file for some reason
49 */
50 public HistoryTreeBackendStub(String ssid,
51 File newStateFile,
52 int providerVersion,
53 long startTime,
54 int blockSize,
55 int maxChildren) throws IOException {
56 super(ssid, newStateFile, providerVersion, startTime, blockSize, maxChildren);
57 }
58
59 /**
60 * Existing history constructor. Use this to open an existing state-file.
61 *
62 * @param ssid
63 * The state system's id
64 * @param existingStateFile
65 * Filename/location of the history we want to load
66 * @param providerVersion
67 * Expected version of of the state provider plugin.
68 * @throws IOException
69 * If we can't read the file, if it doesn't exist, is not
70 * recognized, or if the version of the file does not match the
71 * expected providerVersion.
72 */
73 public HistoryTreeBackendStub(String ssid, File existingStateFile, int providerVersion)
74 throws IOException {
75 super(ssid, existingStateFile, providerVersion);
76 }
77
78 @Override
79 protected HistoryTree initializeSHT(HTConfig conf) throws IOException {
80 return new HistoryTreeStub(conf);
81 }
82
83 @Override
84 protected HistoryTree initializeSHT(File existingStateFile, int providerVersion) throws IOException {
85 return new HistoryTreeStub(existingStateFile, providerVersion);
86 }
87
88 /**
89 * Get the History Tree built by this backend.
90 *
91 * @return The history tree
92 */
93 public HistoryTreeStub getHistoryTree() {
94 return (HistoryTreeStub) super.getSHT();
95 }
96
97 }
This page took 0.034349 seconds and 4 git commands to generate.