Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c04e7a9d956e5ba3b50bf745b6fe1a3f785b48b5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*******************************************************************************
 * Copyright (c) 2013, 2014 Wind River Systems, Inc. and others. All rights reserved.
 * This program and the accompanying materials are made available under the terms
 * of the Eclipse Public License v1.0 which accompanies this distribution, and is
 * available at http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * Wind River Systems - initial API and implementation
 *******************************************************************************/
package org.eclipse.tcf.te.runtime.services.interfaces;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;

/**
 * Simulator service.
 * <p>
 * Allows to start/stop external simulators.
 * <p>
 * Simulator instance related UI parts, like configuration panels, are retrieved
 * by clients via the {@link IUIService}.
 */
public interface ISimulatorService extends IService {

	/**
	 * Property: The associated simulator instance.
	 */
	public static final String PROP_SIM_INSTANCE = ISimulatorService.class.getName() + ".simInstance"; //$NON-NLS-1$
	public static final String PROP_EXIT_ERROR = ISimulatorService.class.getName() + ".exitError"; //$NON-NLS-1$

	/**
	 * The constants for the simulator state.
	 */
	public enum State { Stopped, Starting, Started, Stopping }

	/**
	 * Starts the simulator.
	 *
	 * @param context The context. Must not be <code>null</code>.
	 * @param config The encoded simulator settings or <code>null</code>.
	 * @param callback The callback to invoke once the operation finishes. Must not be <code>null</code>.
	 * @param monitor The progress monitor or <code>null</code>.
	 */
	public void start(Object context, String config, ICallback callback, IProgressMonitor monitor);

	/**
	 * Stops the simulator.
	 *
	 * @param context The context. Must not be <code>null</code>.
	 * @param config The encoded simulator settings or <code>null</code>.
	 * @param callback The callback to invoke once the operation finishes. Must not be <code>null</code>.
	 * @param monitor The progress monitor or <code>null</code>.
	 */
	public void stop(Object context, String config, ICallback callback, IProgressMonitor monitor);

	/**
	 * Cleanup after stop or simulator killed.
	 * Should be called from stop.
	 *
	 * @param context The context. Must not be <code>null</code>.
	 * @param config The encoded simulator settings or <code>null</code>.
	 */
	public void cleanup(Object context, String config);

	/**
	 * Checks if the simulator is running.
	 * <p>
	 * The result of the check is return as {@link Boolean} object by the callback's {@link ICallback#getResult()} method.
	 *
	 * @param context The context. Must not be <code>null</code>.
	 * @param config The encoded simulator settings or <code>null</code>.
	 * @param callback The callback to invoke once the operation finishes. Must not be <code>null</code>.
	 * @param monitor The progress monitor or <code>null</code>.
	 */
	public void isRunning(Object context, String config, ICallback callback, IProgressMonitor monitor);

	/**
	 * Get the state of the simulator for the given context.
	 * @param context The context. Must not be <code>null</code>.
	 * @param config The encoded simulator settings or <code>null</code>.
	 * @return The simulator state.
	 */
	public State getState(Object context, String config);

	/**
	 * Get the default configuration for the simulator.
	 * <p>
	 * The returned configuration does not need to be valid!
	 *
	 * @return The default configuration or <code>null</code>.
	 */
	public String getDefaultConfig();

	/**
	 * Get the address data for the given simulator config.
	 * @param context The context. Must not be <code>null</code>.
	 * @param config The encoded simulator settings or <code>null</code>.
	 * @param currentAddress The current address data.
	 * @return The new simulator address data.
	 */
	public IPropertiesContainer getSimulatorAddress(Object context, String config, IPropertiesContainer currentAddress);

	/**
	 * Validate a simulator configuration
	 * .
	 * @param context The context. Must not be <code>null</code>.
	 * @param config The configuration to validate.
	 * @param checkContextAttributes <code>true</code> if attributes stored in the context should be checked too.
	 *
	 * @return <code>true</code> if the configuration is valid.
	 */
	public boolean isValidConfig(Object context, String config, boolean checkContextAttributes);
}

Back to the top