0aa13f6a5b26d0a6b936388def196b20cd199980
1 /*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.statesystem
.core
.tests
.stubs
.backend
;
13 import java
.io
.IOException
;
15 import org
.eclipse
.tracecompass
.internal
.statesystem
.core
.backend
.historytree
.HTConfig
;
16 import org
.eclipse
.tracecompass
.internal
.statesystem
.core
.backend
.historytree
.HistoryTreeBackend
;
17 import org
.eclipse
.tracecompass
.internal
.statesystem
.core
.backend
.historytree
.IHistoryTree
;
20 * Stub class for the {@link HistoryTreeBackend}. It creates a
21 * {@link HistoryTreeClassicStub} to grant access to some protected methods.
23 * @author Geneviève Bastien
25 public class HistoryTreeBackendStub
extends HistoryTreeBackend
{
27 private static HistoryTreeType HT_TYPE
= HistoryTreeType
.CLASSIC
;
30 * Sets the type of tree to build. Since the history tree is initialized in
31 * the parent's constructor, this stub class needs to know the type of tree
35 * The type of history tree to build for this backend
37 public static void setTreeType(HistoryTreeType htType
) {
42 * Enumeration of all history tree types implemented. This will be used to
43 * create the right type of history tree
45 public enum HistoryTreeType
{
47 * The classic history tree
53 * Constructor for new history files. Use this when creating a new history
57 * The state system's ID
59 * The filename/location where to store the state history (Should
61 * @param providerVersion
62 * Version of of the state provider. We will only try to reopen
63 * existing files if this version matches the one in the
66 * The earliest time stamp that will be stored in the history
68 * The size of the blocks in the history file. This should be a
71 * The maximum number of children each core node can have
73 * Thrown if we can't create the file for some reason
75 public HistoryTreeBackendStub(String ssid
,
80 int maxChildren
) throws IOException
{
81 super(ssid
, newStateFile
, providerVersion
, startTime
, blockSize
, maxChildren
);
85 * Existing history constructor. Use this to open an existing state-file.
88 * The state system's id
89 * @param existingStateFile
90 * Filename/location of the history we want to load
91 * @param providerVersion
92 * Expected version of of the state provider plugin.
94 * If we can't read the file, if it doesn't exist, is not
95 * recognized, or if the version of the file does not match the
96 * expected providerVersion.
98 public HistoryTreeBackendStub(String ssid
, File existingStateFile
, int providerVersion
)
100 super(ssid
, existingStateFile
, providerVersion
);
104 protected IHistoryTree
initializeSHT(HTConfig conf
) throws IOException
{
107 return new HistoryTreeClassicStub(conf
);
109 return new HistoryTreeClassicStub(conf
);
114 protected IHistoryTree
initializeSHT(File existingStateFile
, int providerVersion
) throws IOException
{
117 return new HistoryTreeClassicStub(existingStateFile
, providerVersion
);
119 return new HistoryTreeClassicStub(existingStateFile
, providerVersion
);
124 * Get the History Tree built by this backend.
126 * @return The history tree
128 public HistoryTreeClassicStub
getHistoryTree() {
129 return (HistoryTreeClassicStub
) super.getSHT();
This page took 0.03592 seconds and 4 git commands to generate.