Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Schwarz2013-08-12 07:55:41 +0000
committerTobias Schwarz2013-08-12 07:59:34 +0000
commit1f482cb64df904d101e8fa2f5a13484c413bac1e (patch)
tree1eb9bc0c3c012e167a66387d3458f05829b9c4cf
parent6dbf71f1c3d8f5e6309e0637c74cfe327383e826 (diff)
downloadorg.eclipse.tcf-1f482cb64df904d101e8fa2f5a13484c413bac1e.tar.gz
org.eclipse.tcf-1f482cb64df904d101e8fa2f5a13484c413bac1e.tar.xz
org.eclipse.tcf-1f482cb64df904d101e8fa2f5a13484c413bac1e.zip
Target Explorer: add "savePoint" to step/stepGroup reference
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd31
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java19
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java17
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java7
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java12
5 files changed, 62 insertions, 24 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd
index 887944440..ff76c8206 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/schema/stepGroups.exsd
@@ -51,30 +51,6 @@ A step group bundles a set of single steps and/or other step groups into a more
</complexType>
</element>
- <element name="parameter1">
- <annotation>
- <documentation>
- A parameter for an &lt;code&gt;IExecutableExtension&lt;/code&gt;.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- &lt;p&gt;The parameter name.&lt;/p&gt;
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string" use="required">
- <annotation>
- <documentation>
- &lt;p&gt;The parameter value.&lt;/p&gt;
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
<element name="stepGroup">
<annotation>
<documentation>
@@ -297,6 +273,13 @@ Use the form &lt;i&gt;&amp;quot;id##secondaryId&amp;quot;&lt;/i&gt; to identify
</documentation>
</annotation>
</attribute>
+ <attribute name="savePoint" type="boolean" use="default" value="false">
+ <annotation>
+ <documentation>
+ Savepoints will not be rolled back after successful execution.
+ </documentation>
+ </annotation>
+ </attribute>
</complexType>
</element>
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java
index d488a31da..f89c2af6f 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroup.java
@@ -70,6 +70,7 @@ public class StepGroup extends ExecutableExtension implements IStepGroup {
private boolean hidden;
private boolean disable;
private boolean singleton;
+ private boolean savePoint;
private final List<String> dependencies = new ArrayList<String>();
private Expression expression;
private Map<String,String> parameters = new HashMap<String, String>();
@@ -170,6 +171,15 @@ public class StepGroup extends ExecutableExtension implements IStepGroup {
}
/**
+ * If a reference is marked as savepoint, the step or step group will not
+ * be rolled back if it was executed successfully.
+ * @return <code>true</code> if rollback should be done after successful execution.
+ */
+ public boolean isSavePoint() {
+ return savePoint;
+ }
+
+ /**
* Returns the list of dependencies.
* <p>
* The step or step group id might be fully qualified using the form
@@ -251,6 +261,11 @@ public class StepGroup extends ExecutableExtension implements IStepGroup {
this.singleton = Boolean.parseBoolean(value.trim());
}
+ value = config.getAttribute("savePoint"); //$NON-NLS-1$
+ if (value != null && value.trim().length() > 0) {
+ this.savePoint = Boolean.parseBoolean(value.trim());
+ }
+
// Read in the list of dependencies if specified.
dependencies.clear();
IConfigurationElement[] requires = config.getChildren("requires"); //$NON-NLS-1$
@@ -330,6 +345,7 @@ public class StepGroup extends ExecutableExtension implements IStepGroup {
buffer.append(", hidden = " + isHidden()); //$NON-NLS-1$
buffer.append(", disable = " + isDisable()); //$NON-NLS-1$
buffer.append(", singleton = " + isSingleton()); //$NON-NLS-1$
+ buffer.append(", savePoint = " + isSavePoint()); //$NON-NLS-1$
buffer.append(", parameters = " + getParameters()); //$NON-NLS-1$
return buffer.toString();
}
@@ -705,6 +721,9 @@ public class StepGroup extends ExecutableExtension implements IStepGroup {
if (reference.isSingleton() && !groupable.isSingleton()) {
groupable.setSingleton(reference.isSingleton());
}
+ if (reference.isSavePoint() && !groupable.isSavePoint()) {
+ groupable.setIsSavePoint(reference.isSavePoint());
+ }
}
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java
index 612130eb6..f84a63ab7 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/extensions/StepGroupable.java
@@ -26,6 +26,7 @@ public class StepGroupable implements IStepGroupable {
private boolean hidden = false;
private boolean removable = true;
private boolean singleton = false;
+ private boolean savePoint = false;
private final List<String> dependencies = new ArrayList<String>();
private IExecutableExtension extension;
@@ -192,6 +193,22 @@ public class StepGroupable implements IStepGroupable {
this.dependencies.addAll(Arrays.asList(dependencies));
}
+ /**
+ * Sets if or if not this reference is a savepoint.
+ * @param isSavePoint <code>true</code> if this reference should be a savepoint.
+ */
+ public void setIsSavePoint(boolean isSavePoint) {
+ savePoint = isSavePoint;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStepGroupable#isSavePoint()
+ */
+ @Override
+ public boolean isSavePoint() {
+ return savePoint;
+ }
+
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java
index 03902f544..7a1cbc402 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/interfaces/IStepGroupable.java
@@ -69,6 +69,13 @@ public interface IStepGroupable {
public boolean isDisabled();
/**
+ * If a reference is marked as savepoint, the step or step group will not
+ * be rolled back if it was executed successfully.
+ * @return <code>true</code> if rollback should be done after successful execution.
+ */
+ public boolean isSavePoint();
+
+ /**
* Returns the list of dependencies. The dependencies of a groupable are checked on execution.
* If one of the listed dependencies have not been executed before, the execution of the
* groupable will fail.
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java
index ab58e687b..d285f4955 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.runtime.stepper/src/org/eclipse/tcf/te/runtime/stepper/stepper/Stepper.java
@@ -514,6 +514,14 @@ public class Stepper implements IStepper {
// If the passed in groupable is associated with a step group
// -> get the groupable from that group and execute them
executeStepGroup((IStepGroup) groupable.getExtension(), statusContainer, executedSteps, id);
+
+ if (groupable.isSavePoint()) {
+ ExecutedContextStep last = executedSteps.isEmpty() ? null : executedSteps.get(executedSteps.size()-1);
+ while (last != null && last.id.toString().startsWith(id.toString())) {
+ executedSteps.remove(executedSteps.size()-1);
+ last = executedSteps.isEmpty() ? null : executedSteps.get(executedSteps.size()-1);
+ }
+ }
}
else if (groupable.getExtension() instanceof IStep) {
// If the passed in groupable is associated with a step
@@ -531,6 +539,10 @@ public class Stepper implements IStepper {
executedSteps.add(new ExecutedContextStep(id, step));
// Invoke the executor now
executor.execute(step, id, getContext(), getData(), getMonitor());
+
+ if (groupable.isSavePoint()) {
+ executedSteps.remove(executedSteps.size()-1);
+ }
}
catch (Exception e) {
// Catch the CoreException first hand as we need to continue the

Back to the top