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
|
/*******************************************************************************
* Copyright (c) 2011 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.stepper.stepper;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.tcf.te.runtime.stepper.StepperManager;
import org.eclipse.tcf.te.runtime.stepper.activator.CoreBundleActivator;
import org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper;
import org.eclipse.tcf.te.runtime.stepper.extensions.ContextStepExecutor;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IContext;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepExecutor;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepGroup;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStepperProperties;
import org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId;
import org.eclipse.tcf.te.runtime.stepper.interfaces.tracing.ITraceIds;
/**
* A single context stepper implementation.
* <p>
* The single context stepper implementation applies following assumptions:
* <ul>
* <li>The step group to execute needs to be passed to the stepper via the properties container
* given by the {@link #onInitialize(org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor)}
* call.</li>
* <li>The stepper executes single steps through {@link DefaultStepExecutor}.
* <li>The stepper stops the step group execution if the progress monitor is set to canceled
* or a status with severity {@link IStatus#CANCEL} is thrown by a single step.
* <li>The stepper stops the step group execution on first error.</li>
* <li>The stepper collect warnings and information thrown by the single steps till the
* end of the step group execution. Warnings and information are not stopping the execution.</li>
* <li>The stepper ignores any status thrown by the single steps with severity {@link IStatus#OK}.</li>
* <li>A single stepper instance can execute only one step group at a time.</li>
* </ul>
* <p>
* The stepper implementation can be traced and profiled by setting the debug options:
* <ul>
* <li><i>org.eclipse.tcf.te.runtime.stepper/trace/stepping</i></li>
* <li><i>org.eclipse.tcf.te.runtime.stepper/profile/stepping</i></li>
* </ul>
*/
public class SingleContextStepper extends AbstractContextStepper {
/**
* Constructor.
*/
public SingleContextStepper() {
super();
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper#getName()
*/
@Override
protected String getName() {
return getData() != null ? getData().getStringProperty(IContextStepperProperties.PROP_NAME) : null;
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper#getContexts()
*/
@Override
protected IContext[] getContexts() {
return getData() != null && getData().getProperty(IContextStepperProperties.PROP_CONTEXTS) != null ? (IContext[])getData().getProperty(IContextStepperProperties.PROP_CONTEXTS) : new IContext[0];
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper#getStepGroupId()
*/
@Override
protected String getStepGroupId() {
return getData() != null ? getData().getStringProperty(IContextStepperProperties.PROP_STEP_GROUP_ID) : null;
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper#getStepGroup(java.lang.String)
*/
@Override
protected IContextStepGroup getStepGroup(String id) {
Assert.isNotNull(id);
CoreBundleActivator.getTraceHandler().trace("SingleContextStepper#getStepGroup:" //$NON-NLS-1$
+ " id = '" + id + "'", //$NON-NLS-1$ //$NON-NLS-2$
0, ITraceIds.TRACE_STEPPING, IStatus.WARNING, this);
return StepperManager.getInstance().getStepGroupExtManager().getStepGroup(id, false);
}
/* (non-Javadoc)
* @see org.eclipse.tcf.te.runtime.stepper.extensions.AbstractContextStepper#doCreateStepExecutor(org.eclipse.tcf.te.runtime.stepper.interfaces.IContextStep, java.lang.String, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId)
*/
@Override
protected IContextStepExecutor doCreateStepExecutor(IContextStep step, String secondaryId, IFullQualifiedId fullQualifiedStepId) {
Assert.isNotNull(step);
Assert.isNotNull(secondaryId);
Assert.isNotNull(fullQualifiedStepId);
return new ContextStepExecutor();
}
}
|